pycco-docs / pycco

Literate-style documentation generator.
https://pycco-docs.github.io/pycco/
Other
842 stars 144 forks source link

Comments starting with cross-references fail on preprocess #81

Closed textbook closed 8 years ago

textbook commented 9 years ago

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.