Преглед изворни кода

make svgs in docs interactive

Thomas Buck пре 11 месеци
родитељ
комит
8389b1fa64

+ 3
- 0
.github/workflows/docs.yml Прегледај датотеку

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

+ 3
- 0
.gitmodules Прегледај датотеку

@@ -0,0 +1,3 @@
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 Прегледај датотеку

@@ -9,14 +9,20 @@ cp -r ../hardware/plot src
9 9
 
10 10
 echo "Generating plot includes"
11 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 14
     file=`echo $f | sed 's:src/:./:g'`
14 15
     name=`echo $f | sed 's:src/plot/dispensy_sch.svg/::g' | sed 's:.svg::g'`
16
+    echo $name
15 17
     echo "<h2>$name</h2>" >> src/inc_dispensy_sch.md
16 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 26
     echo >> src/inc_dispensy_sch.md
21 27
 done
22 28
 

+ 1
- 0
docs/src/js/svg-pan-zoom.js Прегледај датотеку

@@ -0,0 +1 @@
1
+../../svg-pan-zoom/dist/svg-pan-zoom.js

+ 1
- 0
docs/src/js/svg-pan-zoom.min.js Прегледај датотеку

@@ -0,0 +1 @@
1
+../../svg-pan-zoom/dist/svg-pan-zoom.min.js

+ 7
- 3
docs/src/main_board_pcb.md Прегледај датотеку

@@ -4,8 +4,12 @@ This page shows the current version of the PCB layout as SVG graphics.
4 4
 
5 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 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 15
 </div>

+ 1
- 0
docs/svg-pan-zoom

@@ -0,0 +1 @@
1
+Subproject commit 632c04b408854926087266022aff7557a363e1ba

+ 3
- 3
hardware/dispensy.kicad_pro Прегледај датотеку

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

+ 2
- 2
hardware/dispensy.kicad_sch Прегледај датотеку

@@ -2102,7 +2102,7 @@
2102 2102
     (stroke (width 0.1524) (type solid))
2103 2103
     (fill (color 0 0 0 0.0000))
2104 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 2106
       (effects (font (size 1.27 1.27)) (justify left bottom))
2107 2107
     )
2108 2108
     (property "Sheetfile" "psu_lm2576.kicad_sch" (at 102.87 177.1146 0)
@@ -2127,7 +2127,7 @@
2127 2127
     (stroke (width 0.1524) (type solid))
2128 2128
     (fill (color 0 0 0 0.0000))
2129 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 2131
       (effects (font (size 1.27 1.27)) (justify left bottom))
2132 2132
     )
2133 2133
     (property "Sheetfile" "pi.kicad_sch" (at 106.68 84.4046 0)

+ 1
- 1
hardware/pi.kicad_sch Прегледај датотеку

@@ -7888,7 +7888,7 @@
7888 7888
     (stroke (width 0.1524) (type solid))
7889 7889
     (fill (color 0 0 0 0.0000))
7890 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 7892
       (effects (font (size 1.27 1.27)) (justify left bottom))
7893 7893
     )
7894 7894
     (property "Sheetfile" "psu_lm2576.kicad_sch" (at 125.73 161.8746 0)

Loading…
Откажи
Сачувај