summaryrefslogtreecommitdiff
path: root/DOC/bin/tidy.py
diff options
context:
space:
mode:
authorPeter Michael Green <plugwash@debian.org>2021-01-28 19:07:37 +0000
committerPeter Michael Green <plugwash@debian.org>2021-01-28 19:07:37 +0000
commitb13be442cbed5e73aac1158e488a87aefb38d03f (patch)
treed57d605144790b1e1a93231b9826d403da31726c /DOC/bin/tidy.py
parentedb6ffdb45648a882874a0dbad38f591b1c1f9ea (diff)
parentcc17196c7586c3625ac8adf8f34838d320ffeda6 (diff)
Merge tag 'v78' of https://github.com/joan2937/pigpio into debian
Diffstat (limited to 'DOC/bin/tidy.py')
-rwxr-xr-xDOC/bin/tidy.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/DOC/bin/tidy.py b/DOC/bin/tidy.py
new file mode 100755
index 0000000..4a789f4
--- /dev/null
+++ b/DOC/bin/tidy.py
@@ -0,0 +1,28 @@
+#!/usr/bin/env python3
+
+import glob
+
+def snafu(t, s, r):
+ l = t
+ while l.find(s) != -1:
+ l = l.replace(s, r)
+ return l
+
+for n in glob.glob("tmp/body/*.body"):
+
+ f = open(n, "r");
+ t = f.read()
+ f.close()
+
+ t = snafu(t, "<br><h2>", "<h2>")
+ t = snafu(t, "<br><h3>", "<h3>")
+ t = snafu(t, "</h2><br>", "</h2>")
+ t = snafu(t, "</h2>\n<br>", "</h2>\n")
+ t = snafu(t, "</h3><br>", "</h3>")
+ t = snafu(t, "</h3>\n<br>", "</h3>\n")
+ t = snafu(t, "<br><br><br>", "<br><br>")
+
+ f = open(n, "w");
+ f.write(t)
+ f.close()
+