Skip to content

citation replacement in mangle_docstrings fails with more than 9 citations #49

Closed
@sergiocallegari

Description

@sergiocallegari

Citations are recognized according to the following docstring

'^.. \\[([a-z0-9_.-])\\]'

Clearly, this only matches when there is a single char between the square brackets.
With this, the following logic

# start renaming from the longest string, to avoid overwriting parts
references.sort(key=lambda x: -len(x))

is never used. Furthermore, such sorting does not seem to be necessary anyway, since the citations
are replaced /including/ the square brackets:

lines[i] = lines[i].replace(sixu('[%s]_') % r,
                            sixu('[%s]_') % new_r)

which should be enough to assure that reference keys are never overwritten in parts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions