Expand sigil replacement for functions, enum values
This MR contains three commits, all of which modify gidocgen/mdext.py
.
-
Create a
SigilReplacement
class which handles the replacement of sigil strings in the documentation, encapsulating both the pattern and replacement strings together into a single object for readability. All of the existing patterns and replacements are converted intoSigilReplacement
instances which are stored in a tuple, then applied in order programmatically. This is entirely a code-readability / quality-of-life change. -
Adjust the
SigilReplacement("Function")
pattern so that functions followed by punctuation will be matched and processed. Previously, this would be matched:Call gtk_image_new_from_icon_name() to construct.
But this would not:
Call gtk_image_new_from_icon_name(), the constructor.
-
Add a
SigilReplacement("Enum")
to match enum values, which previously were not being replaced.
The last change can help avoid MarkDown parsing disasters like the following (from the live Gtk3 docs):