From 2590e3b4448798db88f650a4fbc37cec3b741a4a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 4 Jan 2015 23:28:52 -0800 Subject: Moved spec.html error checks into makespec.py. --- makespec.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'makespec.py') 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'␣', ' ', 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) -- cgit v1.2.3