説明なし
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

generate_docs.sh 3.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #!/bin/bash
  2. # SPDX-FileCopyrightText: 2024 Thomas Buck <thomas@xythobuz.de>
  3. # SPDX-License-Identifier: CERN-OHL-S-2.0+
  4. #
  5. # ------------------------------------------------------------------------------
  6. # | Copyright (c) 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://git.xythobuz.de/thomas/drumkit |
  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. INSCH="drumkit.kicad_sch"
  28. INPCB="drumkit.kicad_pcb"
  29. cd "$(dirname "$0")"
  30. #echo "Generating plots"
  31. rm -rf src/plot
  32. #../pcb/generate_plot.sh
  33. cp -r ../pcb/plot src
  34. #echo
  35. #echo "Generating stls"
  36. rm -rf src/stl
  37. #../3dprint/generate_stls.sh
  38. cp -r ../3dprint/stl src
  39. #echo
  40. for IN in $INSCH
  41. do
  42. o="src/inc_$IN.md"
  43. echo "Include for $IN at $o"
  44. rm -rf $o
  45. echo "<script src=\"js/svg-pan-zoom.js\" charset=\"UTF-8\"></script>" >> $o
  46. for f in `ls src/plot/$IN.svg/*.svg | sort -r`; do
  47. file=`echo $f | sed 's:src/:./:g'`
  48. name=`echo $f | sed "s:src/plot/$IN.svg/::g" | sed 's:.svg::g'`
  49. echo "Sheet at $name"
  50. echo "<h2>$name</h2>" >> $o
  51. echo "<div style=\"background-color: white; border: 1px solid black;\">" >> $o
  52. echo "<embed type=\"image/svg+xml\" src=\"$file\" id=\"pz_$name\" style=\"width:100%;\"/>" >> $o
  53. echo "<script>" >> $o
  54. echo "document.getElementById('pz_$name').addEventListener('load', function(){" >> $o
  55. echo "svgPanZoom(document.getElementById('pz_$name'), {controlIconsEnabled: true, minZoom: 1.0});" >> $o
  56. echo "})" >> $o
  57. echo "</script>" >> $o
  58. echo "</div>" >> $o
  59. echo >> $o
  60. echo "[Direct link to \`$name\`]($file)." >> $o
  61. echo >> $o
  62. done
  63. echo
  64. done
  65. echo "Generating docs"
  66. if [ "$1" = "serve" ] ; then
  67. mdbook serve --open
  68. elif [ "$1" = "build" ] ; then
  69. mdbook build
  70. else
  71. echo "Invalid command. 'build' or 'serve'."
  72. fi