Browse Source

make svgs in docs interactive

Thomas Buck 11 months ago
parent
commit
8389b1fa64

+ 3
- 0
.github/workflows/docs.yml View File

21
         with:
21
         with:
22
           fetch-depth: 0
22
           fetch-depth: 0
23
 
23
 
24
+      - name: Checkout repo submodules
25
+        run: git submodule update --init
26
+
24
       - name: Install dependencies
27
       - name: Install dependencies
25
         run: |
28
         run: |
26
           sudo add-apt-repository --yes ppa:kicad/kicad-7.0-releases
29
           sudo add-apt-repository --yes ppa:kicad/kicad-7.0-releases

+ 3
- 0
.gitmodules View File

1
+[submodule "docs/svg-pan-zoom"]
2
+	path = docs/svg-pan-zoom
3
+	url = https://github.com/bumbu/svg-pan-zoom

+ 10
- 4
docs/generate_docs.sh View File

9
 
9
 
10
 echo "Generating plot includes"
10
 echo "Generating plot includes"
11
 rm -rf src/inc_dispensy_sch.md
11
 rm -rf src/inc_dispensy_sch.md
12
-for f in src/plot/dispensy_sch.svg/*.svg; do
12
+echo "<script src=\"js/svg-pan-zoom.js\" charset=\"UTF-8\"></script>" >> src/inc_dispensy_sch.md
13
+for f in `ls src/plot/dispensy_sch.svg/*.svg | sort -r`; do
13
     file=`echo $f | sed 's:src/:./:g'`
14
     file=`echo $f | sed 's:src/:./:g'`
14
     name=`echo $f | sed 's:src/plot/dispensy_sch.svg/::g' | sed 's:.svg::g'`
15
     name=`echo $f | sed 's:src/plot/dispensy_sch.svg/::g' | sed 's:.svg::g'`
16
+    echo $name
15
     echo "<h2>$name</h2>" >> src/inc_dispensy_sch.md
17
     echo "<h2>$name</h2>" >> src/inc_dispensy_sch.md
16
     echo "<div style=\"background-color: white;\">" >> src/inc_dispensy_sch.md
18
     echo "<div style=\"background-color: white;\">" >> src/inc_dispensy_sch.md
17
-    echo "<a href=\"$file\">" >> src/inc_dispensy_sch.md
18
-    echo "<img src=\"$file\" alt=\"Main-Board PCB layout as SVG\">" >> src/inc_dispensy_sch.md
19
-    echo "</a></div>" >> src/inc_dispensy_sch.md
19
+    echo "<embed type=\"image/svg+xml\" src=\"$file\" id=\"pz_$name\" style=\"width:100%;\"/>" >> src/inc_dispensy_sch.md
20
+    echo "<script>" >> src/inc_dispensy_sch.md
21
+    echo "document.getElementById('pz_$name').addEventListener('load', function(){" >> src/inc_dispensy_sch.md
22
+    echo "svgPanZoom(document.getElementById('pz_$name'), {controlIconsEnabled: true});" >> src/inc_dispensy_sch.md
23
+    echo "})" >> src/inc_dispensy_sch.md
24
+    echo "</script>" >> src/inc_dispensy_sch.md
25
+    echo "</div>" >> src/inc_dispensy_sch.md
20
     echo >> src/inc_dispensy_sch.md
26
     echo >> src/inc_dispensy_sch.md
21
 done
27
 done
22
 
28
 

+ 1
- 0
docs/src/js/svg-pan-zoom.js View File

1
+../../svg-pan-zoom/dist/svg-pan-zoom.js

+ 1
- 0
docs/src/js/svg-pan-zoom.min.js View File

1
+../../svg-pan-zoom/dist/svg-pan-zoom.min.js

+ 7
- 3
docs/src/main_board_pcb.md View File

4
 
4
 
5
 You can also view the [Main-Board PCB layout as PDF](./plot/dispensy_pcb.pdf).
5
 You can also view the [Main-Board PCB layout as PDF](./plot/dispensy_pcb.pdf).
6
 
6
 
7
+<script src="js/svg-pan-zoom.js" charset="UTF-8"></script>
7
 <div style="background-color: white;">
8
 <div style="background-color: white;">
8
-    <a href="./plot/dispensy_pcb.svg">
9
-        <img src="./plot/dispensy_pcb.svg" alt="Main-Board PCB layout as SVG">
10
-    </a>
9
+    <embed type="image/svg+xml" src="../plot/dispensy_pcb.svg" id="pz_dispensy" style="width:100%;"/>
10
+    <script>
11
+        document.getElementById('pz_dispensy').addEventListener('load', function(){
12
+            svgPanZoom(document.getElementById('pz_dispensy'), {controlIconsEnabled: true});
13
+        })
14
+    </script>
11
 </div>
15
 </div>

+ 1
- 0
docs/svg-pan-zoom

1
+Subproject commit 632c04b408854926087266022aff7557a363e1ba

+ 3
- 3
hardware/dispensy.kicad_pro View File

501
     ],
501
     ],
502
     [
502
     [
503
       "635c7f01-c861-45f9-bb15-e53673572e1d",
503
       "635c7f01-c861-45f9-bb15-e53673572e1d",
504
-      "External PSU"
504
+      "EXT_PSU"
505
     ],
505
     ],
506
     [
506
     [
507
       "f8ce2893-59d6-4502-b3c7-412c7467c1ef",
507
       "f8ce2893-59d6-4502-b3c7-412c7467c1ef",
508
-      "RP2040"
508
+      "PI"
509
     ],
509
     ],
510
     [
510
     [
511
       "2c5a08e6-462b-42d7-a36a-f09062d79876",
511
       "2c5a08e6-462b-42d7-a36a-f09062d79876",
512
-      "5V PSU"
512
+      "PI_PSU"
513
     ]
513
     ]
514
   ],
514
   ],
515
   "text_variables": {}
515
   "text_variables": {}

+ 2
- 2
hardware/dispensy.kicad_sch View File

2102
     (stroke (width 0.1524) (type solid))
2102
     (stroke (width 0.1524) (type solid))
2103
     (fill (color 0 0 0 0.0000))
2103
     (fill (color 0 0 0 0.0000))
2104
     (uuid 635c7f01-c861-45f9-bb15-e53673572e1d)
2104
     (uuid 635c7f01-c861-45f9-bb15-e53673572e1d)
2105
-    (property "Sheetname" "External PSU" (at 102.87 170.7384 0)
2105
+    (property "Sheetname" "EXT_PSU" (at 102.87 170.7384 0)
2106
       (effects (font (size 1.27 1.27)) (justify left bottom))
2106
       (effects (font (size 1.27 1.27)) (justify left bottom))
2107
     )
2107
     )
2108
     (property "Sheetfile" "psu_lm2576.kicad_sch" (at 102.87 177.1146 0)
2108
     (property "Sheetfile" "psu_lm2576.kicad_sch" (at 102.87 177.1146 0)
2127
     (stroke (width 0.1524) (type solid))
2127
     (stroke (width 0.1524) (type solid))
2128
     (fill (color 0 0 0 0.0000))
2128
     (fill (color 0 0 0 0.0000))
2129
     (uuid f8ce2893-59d6-4502-b3c7-412c7467c1ef)
2129
     (uuid f8ce2893-59d6-4502-b3c7-412c7467c1ef)
2130
-    (property "Sheetname" "RP2040" (at 106.68 42.4684 0)
2130
+    (property "Sheetname" "PI" (at 106.68 42.4684 0)
2131
       (effects (font (size 1.27 1.27)) (justify left bottom))
2131
       (effects (font (size 1.27 1.27)) (justify left bottom))
2132
     )
2132
     )
2133
     (property "Sheetfile" "pi.kicad_sch" (at 106.68 84.4046 0)
2133
     (property "Sheetfile" "pi.kicad_sch" (at 106.68 84.4046 0)

+ 1
- 1
hardware/pi.kicad_sch View File

7888
     (stroke (width 0.1524) (type solid))
7888
     (stroke (width 0.1524) (type solid))
7889
     (fill (color 0 0 0 0.0000))
7889
     (fill (color 0 0 0 0.0000))
7890
     (uuid 2c5a08e6-462b-42d7-a36a-f09062d79876)
7890
     (uuid 2c5a08e6-462b-42d7-a36a-f09062d79876)
7891
-    (property "Sheetname" "5V PSU" (at 125.73 155.4984 0)
7891
+    (property "Sheetname" "PI_PSU" (at 125.73 155.4984 0)
7892
       (effects (font (size 1.27 1.27)) (justify left bottom))
7892
       (effects (font (size 1.27 1.27)) (justify left bottom))
7893
     )
7893
     )
7894
     (property "Sheetfile" "psu_lm2576.kicad_sch" (at 125.73 161.8746 0)
7894
     (property "Sheetfile" "psu_lm2576.kicad_sch" (at 125.73 161.8746 0)

Loading…
Cancel
Save