Нет описания
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

generate_docs.sh 3.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. # SPDX-FileCopyrightText: 2023 - 2024 Thomas Buck <thomas@xythobuz.de>
  3. # SPDX-License-Identifier: CERN-OHL-S-2.0+
  4. #
  5. # ------------------------------------------------------------------------------
  6. # | Copyright (c) 2023 - 2024 Thomas Buck <thomas@xythobuz.de> |
  7. # | |
  8. # | This source describes Open Hardware and is licensed under the CERN-OHL-S v2 |
  9. # | or any later version. |
  10. # | |
  11. # | You may redistribute and modify this source and make products using it under |
  12. # | the terms of the CERN-OHL-S v2 (https://ohwr.org/cern_ohl_s_v2.txt) |
  13. # | or any later version. |
  14. # | |
  15. # | This source is distributed WITHOUT ANY EXPRESS OR IMPLIED WARRANTY, |
  16. # | INCLUDING OF MERCHANTABILITY, SATISFACTORY QUALITY AND FITNESS FOR A |
  17. # | PARTICULAR PURPOSE. Please see the CERN-OHL-S v2 (or any later version) |
  18. # | for applicable conditions. |
  19. # | |
  20. # | Source location: https://github.com/drinkrobotics/dispensy |
  21. # | |
  22. # | As per CERN-OHL-S v2 section 4, should You produce hardware based on this |
  23. # | source, You must where practicable maintain the Source Location visible |
  24. # | on the external case of the Gizmo or other products you make using this |
  25. # | source. |
  26. # ------------------------------------------------------------------------------
  27. cd "$(dirname "$0")"
  28. #echo "Generating plots"
  29. rm -rf src/plot
  30. #../hardware/generate_plot.sh
  31. cp -r ../hardware/plot src
  32. echo "Generating plot includes"
  33. rm -rf src/inc_dispensy_sch.md
  34. echo "<script src=\"js/svg-pan-zoom.js\" charset=\"UTF-8\"></script>" >> src/inc_dispensy_sch.md
  35. for f in `ls src/plot/dispensy_sch.svg/*.svg | sort -r`; do
  36. file=`echo $f | sed 's:src/:./:g'`
  37. name=`echo $f | sed 's:src/plot/dispensy_sch.svg/::g' | sed 's:.svg::g'`
  38. echo $name
  39. echo "<h2>$name</h2>" >> src/inc_dispensy_sch.md
  40. echo "<div style=\"background-color: white;\">" >> src/inc_dispensy_sch.md
  41. echo "<embed type=\"image/svg+xml\" src=\"$file\" id=\"pz_$name\" style=\"width:100%;\"/>" >> src/inc_dispensy_sch.md
  42. echo "<script>" >> src/inc_dispensy_sch.md
  43. echo "document.getElementById('pz_$name').addEventListener('load', function(){" >> src/inc_dispensy_sch.md
  44. echo "svgPanZoom(document.getElementById('pz_$name'), {controlIconsEnabled: true});" >> src/inc_dispensy_sch.md
  45. echo "})" >> src/inc_dispensy_sch.md
  46. echo "</script>" >> src/inc_dispensy_sch.md
  47. echo "</div>" >> src/inc_dispensy_sch.md
  48. echo >> src/inc_dispensy_sch.md
  49. done
  50. echo "Preparing modelview dependencies"
  51. cd modelview
  52. sed -i 's/info\.inner/info_elem\.inner/g' modelview.js
  53. ./fetch_deps.sh
  54. cd ..
  55. rm -rf src/js/deps
  56. cp -r modelview/deps src/js
  57. echo "Generating docs"
  58. if [ "$1" = "serve" ] ; then
  59. mdbook serve --open
  60. elif [ "$1" = "build" ] ; then
  61. mdbook build
  62. else
  63. echo "Invalid command. 'build' or 'serve'."
  64. fi