No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

generate_docs.sh 1.3KB

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. cd "$(dirname "$0")"
  3. echo "Generating plots"
  4. rm -rf src/plot
  5. ../hardware/generate_plot.sh
  6. cp -r ../hardware/plot src
  7. echo "Generating plot includes"
  8. rm -rf src/inc_dispensy_sch.md
  9. echo "<script src=\"js/svg-pan-zoom.js\" charset=\"UTF-8\"></script>" >> src/inc_dispensy_sch.md
  10. for f in `ls src/plot/dispensy_sch.svg/*.svg | sort -r`; do
  11. file=`echo $f | sed 's:src/:./:g'`
  12. name=`echo $f | sed 's:src/plot/dispensy_sch.svg/::g' | sed 's:.svg::g'`
  13. echo $name
  14. echo "<h2>$name</h2>" >> src/inc_dispensy_sch.md
  15. echo "<div style=\"background-color: white;\">" >> src/inc_dispensy_sch.md
  16. echo "<embed type=\"image/svg+xml\" src=\"$file\" id=\"pz_$name\" style=\"width:100%;\"/>" >> src/inc_dispensy_sch.md
  17. echo "<script>" >> src/inc_dispensy_sch.md
  18. echo "document.getElementById('pz_$name').addEventListener('load', function(){" >> src/inc_dispensy_sch.md
  19. echo "svgPanZoom(document.getElementById('pz_$name'), {controlIconsEnabled: true});" >> src/inc_dispensy_sch.md
  20. echo "})" >> src/inc_dispensy_sch.md
  21. echo "</script>" >> src/inc_dispensy_sch.md
  22. echo "</div>" >> src/inc_dispensy_sch.md
  23. echo >> src/inc_dispensy_sch.md
  24. done
  25. echo "Generating docs"
  26. if [ "$1" = "serve" ] ; then
  27. mdbook serve --open
  28. elif [ "$1" = "build" ] ; then
  29. mdbook build
  30. else
  31. echo "Invalid command. 'build' or 'serve'."
  32. fi