diff options
author | Daniel Thompson <daniel.thompson@linaro.org> | 2016-05-16 16:30:16 +0100 |
---|---|---|
committer | Daniel Thompson <daniel.thompson@linaro.org> | 2016-05-16 16:30:16 +0100 |
commit | 60fee7c0edeb357b541a7a7b4f7a7cecabade80f (patch) | |
tree | 2cf2d31379394e96cdfb87d2aaa315bd5b10b7d3 | |
parent | 323cc397073526577e8a475c72df5d8b8004c02d (diff) |
checkfaq: Check for github table syntax
github table syntax is not support by cmark but, even if we changed
to a more feature full HTML renderer, we still can't have tables on
wordpress so lets make sure we squawk if someone uses the full
table feature.
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
-rw-r--r-- | checkfaq.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/checkfaq.py b/checkfaq.py index a937585..e6459ff 100644 --- a/checkfaq.py +++ b/checkfaq.py @@ -2,6 +2,7 @@ from __future__ import print_function +import re import sys msgctx = None @@ -26,10 +27,17 @@ def check(f): lineno = 0 draft = False + pre = False for ln in f.readlines(): lineno += 1 msgctx = (f.name, lineno, ln.strip()) + # Track whether we are in a preformatted block + if '<pre>' in ln: + pre = True + if '</pre>' in ln: + pre = False + # Warn for every draft question (but disable all other checks) if '**' in ln and 'Q:' in ln and '?' in ln: draft = 'DRAFT' in ln @@ -57,6 +65,13 @@ def check(f): err('Private note') break + # Check for signs of github flavoured markdown. This is not + # supported by cmark (and mostly also not by wordpress) + + # Table syntax (this is targetting the --- | ---- | ---- line) + if re.match('^[ ]*-[ -]*[|+][ -|+]*$', ln.rstrip()) and not pre: + err('github table syntax extensions are not supported (use <pre>?)') + for fname in sys.argv[1:]: with open(fname) as f: check(f) |