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