Açıklama Yok
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 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. for IN in $INSCH
  36. do
  37. o="src/inc_$IN.md"
  38. echo "Include for $IN at $o"
  39. rm -rf $o
  40. echo "<script src=\"js/svg-pan-zoom.js\" charset=\"UTF-8\"></script>" >> $o
  41. for f in `ls src/plot/$IN.svg/*.svg | sort -r`; do
  42. file=`echo $f | sed 's:src/:./:g'`
  43. name=`echo $f | sed "s:src/plot/$IN.svg/::g" | sed 's:.svg::g'`
  44. echo "Sheet at $name"
  45. echo "<h2>$name</h2>" >> $o
  46. echo "<div style=\"background-color: white; border: 1px solid black;\">" >> $o
  47. echo "<embed type=\"image/svg+xml\" src=\"$file\" id=\"pz_$name\" style=\"width:100%;\"/>" >> $o
  48. echo "<script>" >> $o
  49. echo "document.getElementById('pz_$name').addEventListener('load', function(){" >> $o
  50. echo "svgPanZoom(document.getElementById('pz_$name'), {controlIconsEnabled: true, minZoom: 1.0});" >> $o
  51. echo "})" >> $o
  52. echo "</script>" >> $o
  53. echo "</div>" >> $o
  54. echo >> $o
  55. echo "[Direct link to \`$name\`]($file)." >> $o
  56. echo >> $o
  57. done
  58. echo
  59. done
  60. echo "Generating docs"
  61. if [ "$1" = "serve" ] ; then
  62. mdbook serve --open
  63. elif [ "$1" = "build" ] ; then
  64. mdbook build
  65. else
  66. echo "Invalid command. 'build' or 'serve'."
  67. fi