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.
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.
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 astesting.py
and process withpycco testing.py
.Instead of
[^
], a negative lookbehind
(?<!)
can be used to remove this requirement. This also means that the opening whitespace in the replacement strings inreplace_crossref
is no longer required.