Exemplo n.º 1
0
def check_crossref(language):
    '''
    Check cross-references.
    '''
    content = get_all_docs(language)
    used = _match_lines(content, r'\[([^\]]+)\]\(#REF\)')
    crossref = get_crossref(language)
    defined = {x for x in crossref.keys() if x.startswith('s:')}
    report('Cross References', 'missing', used - defined)
Exemplo n.º 2
0
def check_figref(language):
    '''
    Check figure references.
    '''
    content = get_all_docs(language)
    used = _match_lines(content, r'\[([^\]]+)\]\(#FIG\)')
    crossref = get_crossref(language)
    defined = {x for x in crossref.keys() if x.startswith('f:')}
    report('Figure References', 'missing', used - defined)
    report('Figure References', 'unused', defined - used)
Exemplo n.º 3
0
def main(which, language, include_dir):
    '''
    Apply all pre- or post-processing handlers.
    '''
    lines = sys.stdin.readlines()
    crossref = get_crossref(language)
    for handler in HANDLERS:
        h = handler(crossref, include_dir)
        lines = getattr(h, which)(lines)
    sys.stdout.writelines(lines)