Skip to content

Commit caf0b84

Browse files
bors[bot]qwandor
andauthored
Merge #556
556: Build peripheral comparisons pages as part of html target r=adamgreig a=qwandor Also cleaned up the HTML a bit. Co-authored-by: Andrew Walbran <qwandor@gmail.com>
2 parents 0996ce1 + fcf378d commit caf0b84

File tree

5 files changed

+109
-81
lines changed

5 files changed

+109
-81
lines changed

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,14 @@ svdformat: $(FORMATTED_SVDS)
9595

9696
check: $(CHECK_SRCS)
9797

98-
html/index.html: $(PATCHED_SVDS)
98+
html/index.html: $(PATCHED_SVDS) scripts/makehtml.py scripts/makehtml.index.template.html scripts/makehtml.template.html
9999
@mkdir -p html
100100
python3 scripts/makehtml.py html/ svd/stm32*.svd.patched
101101

102-
html: html/index.html
102+
html/comparisons.html: $(PATCHED_SVDS) scripts/htmlcomparesvdall.sh scripts/htmlcomparesvd.py
103+
scripts/htmlcomparesvdall.sh
104+
105+
html: html/index.html html/comparisons.html
103106

104107
lint: $(PATCHED_SVDS)
105108
xmllint --schema svd/cmsis-svd.xsd --noout $(PATCHED_SVDS)

scripts/htmlcomparesvd.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import sys
1+
import argparse
22
import os.path
33
import xml.etree.ElementTree as ET
44

@@ -208,10 +208,15 @@ def html_tables(parts):
208208

209209

210210
def main():
211-
parts = [parse(svdfile) for svdfile in sys.argv[1:]]
211+
parser = argparse.ArgumentParser()
212+
parser.add_argument("htmldir", help="Path to write HTML files to")
213+
parser.add_argument("svdfiles", help="Path to patched SVD files", nargs="*")
214+
args = parser.parse_args()
215+
216+
parts = [parse(svdfile) for svdfile in args.svdfiles]
212217
files = html_tables(parts)
213218
for fn in files:
214-
with open(os.path.join("html", fn), "w") as f:
219+
with open(os.path.join(args.htmldir, fn), "w") as f:
215220
f.write(files[fn])
216221

217222
if __name__ == "__main__":

scripts/htmlcomparesvdall.sh

100644100755
Lines changed: 86 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,91 @@
11
#!/usr/bin/env bash
22
set -euxo pipefail
33

4-
mkdir html
5-
6-
mkdir html/stm32f
7-
python3 scripts/htmlcomparesvd.py svd/stm32f{0x8,103,107,217,303,3x8,469,7x2,7x9}.svd.patched
8-
sed -i 's#<table>#<p>Only a representative member of each family included; click to view entire family</p><table>#' html/index.html
9-
sed -i 's#stm32f0x8#<a href="stm32f0/index.html">STM32F0x8</a>#' html/index.html
10-
sed -i 's#stm32f103#<a href="stm32f1/index.html">STM32F103</a>#' html/index.html
11-
sed -i 's#stm32f107#<a href="stm32f1/index.html">STM32F107</a>#' html/index.html
12-
sed -i 's#stm32f217#<a href="stm32f2/index.html">STM32F217</a>#' html/index.html
13-
sed -i 's#stm32f303#<a href="stm32f3/index.html">STM32F303</a>#' html/index.html
14-
sed -i 's#stm32f3x8#<a href="stm32f3/index.html">STM32F3x8</a>#' html/index.html
15-
sed -i 's#stm32f469#<a href="stm32f4/index.html">STM32F469</a>#' html/index.html
16-
sed -i 's#stm32f7x2#<a href="stm32f7/index.html">STM32F7x2</a>#' html/index.html
17-
sed -i 's#stm32f7x9#<a href="stm32f7/index.html">STM32F7x9</a>#' html/index.html
18-
mv html/*.html html/stm32f
19-
20-
mkdir html/stm32f/stm32f0
21-
python3 scripts/htmlcomparesvd.py svd/stm32f0*.svd.patched
22-
mv html/*.html html/stm32f/stm32f0
23-
24-
mkdir html/stm32f/stm32f1
25-
python3 scripts/htmlcomparesvd.py svd/stm32f1*.svd.patched
26-
mv html/*.html html/stm32f/stm32f1
27-
28-
mkdir html/stm32f/stm32f2
29-
python3 scripts/htmlcomparesvd.py svd/stm32f2*.svd.patched
30-
mv html/*.html html/stm32f/stm32f2
31-
32-
mkdir html/stm32f/stm32f3
33-
python3 scripts/htmlcomparesvd.py svd/stm32f3*.svd.patched
34-
mv html/*.html html/stm32f/stm32f3
35-
36-
mkdir html/stm32f/stm32f4
37-
python3 scripts/htmlcomparesvd.py svd/stm32f4*.svd.patched
38-
mv html/*.html html/stm32f/stm32f4
39-
40-
mkdir html/stm32f/stm32f7
41-
python3 scripts/htmlcomparesvd.py svd/stm32f7*.svd.patched
42-
mv html/*.html html/stm32f/stm32f7
43-
44-
mkdir html/stm32l
45-
python3 scripts/htmlcomparesvd.py svd/stm32l{0x3,162,4x6}.svd.patched
46-
sed -i 's#<table>#<p>Only a representative member of each family included; click to view entire family<\/p><table>#' html/index.html
47-
sed -i 's#stm32l0x3#<a href="stm32l0/index.html">STM32L0x3</a>#' html/index.html
48-
sed -i 's#stm32l162#<a href="stm32l1/index.html">STM32L162</a>#' html/index.html
49-
sed -i 's#stm32l4x6#<a href="stm32l4/index.html">STM32L4x6</a>#' html/index.html
50-
mv html/*.html html/stm32l
51-
52-
mkdir html/stm32l/stm32l0
53-
python3 scripts/htmlcomparesvd.py svd/stm32l0*.svd.patched
54-
mv html/*.html html/stm32l/stm32l0
55-
56-
mkdir html/stm32l/stm32l1
57-
python3 scripts/htmlcomparesvd.py svd/stm32l1*.svd.patched
58-
mv html/*.html html/stm32l/stm32l1
59-
60-
mkdir html/stm32l/stm32l4
61-
python3 scripts/htmlcomparesvd.py svd/stm32l4*.svd.patched
62-
mv html/*.html html/stm32l/stm32l4
63-
64-
mkdir html/stm32h
65-
python3 scripts/htmlcomparesvd.py svd/stm32h7x3.svd.patched
66-
sed -i 's#<table>#<p>Only a representative member of each family included; click to view entire family</p><table>#' html/index.html
67-
sed -i 's#stm32h7x3#<a href="stm32h7/index.html">STM32H7x3</a>#' html/index.html
68-
mv html/*.html html/stm32h
69-
70-
mkdir html/stm32h/stm32h7
71-
python3 scripts/htmlcomparesvd.py svd/stm32h7x3.svd.patched
72-
mv html/*.html html/stm32h/stm32h7
73-
74-
cat > html/index.html <<EOF
4+
mkdir -p html/stm32f
5+
python3 scripts/htmlcomparesvd.py html/stm32f svd/stm32f{0x8,103,107,217,303,3x4,469,7x2,7x9}.svd.patched
6+
sed -i 's#<table>#<p>Only a representative member of each family included; click to view entire family</p><table>#' html/stm32f/index.html
7+
sed -i 's#stm32f0x8#<a href="stm32f0/index.html">STM32F0x8</a>#' html/stm32f/index.html
8+
sed -i 's#stm32f103#<a href="stm32f1/index.html">STM32F103</a>#' html/stm32f/index.html
9+
sed -i 's#stm32f107#<a href="stm32f1/index.html">STM32F107</a>#' html/stm32f/index.html
10+
sed -i 's#stm32f217#<a href="stm32f2/index.html">STM32F217</a>#' html/stm32f/index.html
11+
sed -i 's#stm32f303#<a href="stm32f3/index.html">STM32F303</a>#' html/stm32f/index.html
12+
sed -i 's#stm32f3x4#<a href="stm32f3/index.html">STM32F3x4</a>#' html/stm32f/index.html
13+
sed -i 's#stm32f469#<a href="stm32f4/index.html">STM32F469</a>#' html/stm32f/index.html
14+
sed -i 's#stm32f7x2#<a href="stm32f7/index.html">STM32F7x2</a>#' html/stm32f/index.html
15+
sed -i 's#stm32f7x9#<a href="stm32f7/index.html">STM32F7x9</a>#' html/stm32f/index.html
16+
17+
mkdir -p html/stm32f/stm32f0
18+
python3 scripts/htmlcomparesvd.py html/stm32f/stm32f0 svd/stm32f0*.svd.patched
19+
20+
mkdir -p html/stm32f/stm32f1
21+
python3 scripts/htmlcomparesvd.py html/stm32f/stm32f1 svd/stm32f1*.svd.patched
22+
23+
mkdir -p html/stm32f/stm32f2
24+
python3 scripts/htmlcomparesvd.py html/stm32f/stm32f2 svd/stm32f2*.svd.patched
25+
26+
mkdir -p html/stm32f/stm32f3
27+
python3 scripts/htmlcomparesvd.py html/stm32f/stm32f3 svd/stm32f3*.svd.patched
28+
29+
mkdir -p html/stm32f/stm32f4
30+
python3 scripts/htmlcomparesvd.py html/stm32f/stm32f4 svd/stm32f4*.svd.patched
31+
32+
mkdir -p html/stm32f/stm32f7
33+
python3 scripts/htmlcomparesvd.py html/stm32f/stm32f7 svd/stm32f7*.svd.patched
34+
35+
mkdir -p html/stm32l
36+
python3 scripts/htmlcomparesvd.py html/stm32l svd/stm32l{0x3,162,4x6}.svd.patched
37+
sed -i 's#<table>#<p>Only a representative member of each family included; click to view entire family<\/p><table>#' html/stm32l/index.html
38+
sed -i 's#stm32l0x3#<a href="stm32l0/index.html">STM32L0x3</a>#' html/stm32l/index.html
39+
sed -i 's#stm32l162#<a href="stm32l1/index.html">STM32L162</a>#' html/stm32l/index.html
40+
sed -i 's#stm32l4x6#<a href="stm32l4/index.html">STM32L4x6</a>#' html/stm32l/index.html
41+
42+
mkdir -p html/stm32l/stm32l0
43+
python3 scripts/htmlcomparesvd.py html/stm32l/stm32l0 svd/stm32l0*.svd.patched
44+
45+
mkdir -p html/stm32l/stm32l1
46+
python3 scripts/htmlcomparesvd.py html/stm32l/stm32l1 svd/stm32l1*.svd.patched
47+
48+
mkdir -p html/stm32l/stm32l4
49+
python3 scripts/htmlcomparesvd.py html/stm32l/stm32l4 svd/stm32l4*.svd.patched
50+
51+
mkdir -p html/stm32h
52+
python3 scripts/htmlcomparesvd.py html/stm32h svd/stm32h753.svd.patched
53+
sed -i 's#<table>#<p>Only a representative member of each family included; click to view entire family</p><table>#' html/stm32h/index.html
54+
sed -i 's#stm32h753#<a href="stm32h7/index.html">STM32H753</a>#' html/stm32h/index.html
55+
56+
mkdir -p html/stm32h/stm32h7
57+
python3 scripts/htmlcomparesvd.py html/stm32h/stm32h7 svd/stm32h7*.svd.patched
58+
59+
cat > html/comparisons.html <<EOF
7560
<!DOCTYPE html>
76-
<a href="stm32f/index.html">STM32F</a><br>
77-
<a href="stm32l/index.html">STM32L</a><br>
78-
<a href="stm32h/index.html">STM32H</a><br>
61+
<head>
62+
<meta charset="utf-8">
63+
<meta name=viewport content="width=device-width, initial-scale=1">
64+
<title>stm32-rs Peripheral Comparisons</title>
65+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
66+
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
67+
</head>
68+
69+
<body>
70+
<nav class="navbar navbar-inverse">
71+
<div class="container">
72+
<div class="navbar-header">
73+
<a class="navbar-brand" href="index.html">stm32-rs Device Coverage</a>
74+
</div>
75+
<div class="navbar-collapse collapse">
76+
<ul class="nav navbar-nav">
77+
<li class="active"><a href="#">Peripheral Comparisons</a></li>
78+
</ul>
79+
</div>
80+
</div>
81+
</nav>
82+
83+
<h1>Device families</h1>
84+
<ul>
85+
<li><a href="stm32f/index.html">STM32F</a></li>
86+
<li><a href="stm32l/index.html">STM32L</a></li>
87+
<li><a href="stm32h/index.html">STM32H</a></li>
88+
</ul>
89+
</body>
90+
</html>
7991
EOF

scripts/makehtml.index.template.html

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
<nav class="navbar navbar-inverse">
1414
<div class=container>
1515
<div class=navbar-header>
16-
<a class=navbar-brand href=#>stm32-rs Device Coverage</a>
16+
<a class="navbar-brand active" href="#"">stm32-rs Device Coverage</a>
17+
</div>
18+
<div class="navbar-collapse collapse">
19+
<ul class="nav navbar-nav">
20+
<li><a href="comparisons.html">Peripheral Comparisons</a></li>
21+
</ul>
1722
</div>
1823
</div>
1924
</nav>

scripts/makehtml.template.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,12 @@
5757
<nav class="navbar navbar-inverse">
5858
<div class=container>
5959
<div class=navbar-header>
60-
<a class=navbar-brand href=#>{{ device.name }} Peripheral Coverage</a>
60+
<a class="navbar-brand" href="index.html">stm32-rs Device Coverage</a>
6161
</div>
6262
<div class="navbar-collapse collapse">
63+
<ul class="nav navbar-nav">
64+
<li class="active"><a href="#">{{ device.name }} Peripheral Coverage</a></li>
65+
</ul>
6366
<ul class="nav navbar-nav navbar-right">
6467
<li><a href=# id=show-all-registers>Show All Registers</a></li>
6568
<li><a href=# id=hide-all-registers>Hide All Registers</a></li>

0 commit comments

Comments
 (0)