diff options
author | Alexis Hildebrandt <afh@surryhill.net> | 2015-01-27 11:55:08 +0100 |
---|---|---|
committer | Alexis Hildebrandt <afh@surryhill.net> | 2015-01-27 22:02:59 +0100 |
commit | 11a01f1b5aeff063740edfbe99dba35003237551 (patch) | |
tree | c30df6911bd553f2229c1012214963a589d1c393 /test/CheckTexinfo.py | |
parent | 19f4f587f0a527056707465bdd9b441a53236711 (diff) | |
download | fork-ledger-11a01f1b5aeff063740edfbe99dba35003237551.tar.gz fork-ledger-11a01f1b5aeff063740edfbe99dba35003237551.tar.bz2 fork-ledger-11a01f1b5aeff063740edfbe99dba35003237551.zip |
[doc] Report undocumented value expression functions
in the manpage and texinfo manual.
Diffstat (limited to 'test/CheckTexinfo.py')
-rwxr-xr-x | test/CheckTexinfo.py | 41 |
1 files changed, 39 insertions, 2 deletions
diff --git a/test/CheckTexinfo.py b/test/CheckTexinfo.py index 34d0e153..cd167eba 100755 --- a/test/CheckTexinfo.py +++ b/test/CheckTexinfo.py @@ -16,10 +16,47 @@ from CheckOptions import CheckOptions class CheckTexinfo (CheckOptions): def __init__(self, args): CheckOptions.__init__(self, args) - self.option_pattern = '@item --([-A-Za-z]+).*@c option' + self.option_pattern = '^@item\s+--([-A-Za-z]+)' + self.function_pattern = '^@defun\s+([-A-Za-z_]+)' self.source_file = join(self.source, 'doc', 'ledger3.texi') self.source_type = 'texinfo' + + def find_functions(self, filename): + functions = set() + state_normal = 0 + state_function = 1 + state = state_normal + function = None + fun_doc = str() + fun_example = False + item_regex = re.compile(self.function_pattern) + itemx_regex = re.compile('^@defunx') + example_regex = re.compile('^@smallexample\s+@c\s+command:') + fix_regex = re.compile('FIX') + comment_regex = re.compile('^\s*@c') + for line in open(filename): + line = line.strip() + if state == state_normal: + match = item_regex.match(line) + if match: + state = state_function + function = match.group(1) + elif state == state_function: + if line == '@end defun': + if function and fun_example and len(fun_doc) and not fix_regex.search(fun_doc): + functions.add(function) + state = state_normal + fun_example = None + fun_doc = str() + elif itemx_regex.match(line): + continue + elif example_regex.match(line): + fun_example = True + elif not comment_regex.match(line): + fun_doc += line + return functions + def find_options(self, filename): options = set() state_normal = 0 @@ -27,7 +64,7 @@ class CheckTexinfo (CheckOptions): state = state_normal option = None opt_doc = str() - item_regex = re.compile('^@item --([-A-Za-z]+)') + item_regex = re.compile(self.option_pattern) itemx_regex = re.compile('^@itemx') fix_regex = re.compile('FIX') comment_regex = re.compile('^\s*@c') |