pycco-docs / pycco

Literate-style documentation generator.

Home Page:https://pycco-docs.github.io/pycco/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Comments starting with cross-references fail on preprocess

textbook opened this issue · comments

The regex used by preprocess requires a character other than a backtick prior to the first cross-reference in a comment, so if the comment starts with a cross-reference it is not handled correctly. To recreate, save the following sample as testing.py and process with pycco testing.py.

# ==Link Target==

def test_link():
    """[[testing.py#link-target]]"""
    pass

Instead of [^], a negative lookbehind (?<!) can be used to remove this requirement. This also means that the opening whitespace in the replacement strings in replace_crossref is no longer required.