summaryrefslogtreecommitdiff
path: root/makespec.py
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-04 23:28:52 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-04 23:28:52 -0800
commit2590e3b4448798db88f650a4fbc37cec3b741a4a (patch)
treebe970774f4d009a27b09a54d44c82e1aec528da1 /makespec.py
parentace1b42818ebdbee46ca0153fb0b49e1494321e0 (diff)
Moved spec.html error checks into makespec.py.
Diffstat (limited to 'makespec.py')
-rw-r--r--makespec.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/makespec.py b/makespec.py
index 2361636..762d62d 100644
--- a/makespec.py
+++ b/makespec.py
@@ -129,6 +129,28 @@ elif specformat == "html":
if retcode == 0:
result = re.sub(r'␣', '<span class="space"> </span>', result)
sys.stdout.write(template.substitute(metadata, body=result))
+
+ # check for errors:
+ idents = []
+ for ident in re.findall(r'id="([^"]*)"', result):
+ if ident in idents:
+ sys.stderr.write("WARNING: duplicate identifier '" + ident +
+ "'\n")
+ else:
+ idents.append(ident)
+ for href in re.findall(r'href="#([^"]*)"', result):
+ if not (href in idents):
+ sys.stderr.write("WARNING: internal link with no anchor '" +
+ href + "'\n")
+ reftexts = []
+ for ref in refs:
+ ref = re.sub('].*',']',ref).upper()
+ if ref in reftexts:
+ sys.stderr.write("WARNING: duplicate reference link '" +
+ ref + "'\n")
+ else:
+ reftexts.append(ref)
+
else:
sys.stderr.write("Error converting markdown version of spec:\n")
sys.stderr.write(err)