[gi-docgen/gtkdoc-sigils: 2/2] Re-instate gtk-doc's function matching




commit cb162df8a82b0af31f9f950c604474add694ec68
Author: Emmanuele Bassi <ebassi gnome org>
Date:   Wed Aug 11 19:49:40 2021 +0100

    Re-instate gtk-doc's function matching
    
    Now that we ignore code blocks, and we have a better regular expression
    for it, we can go back and turn "foo_bar()" into `foo_bar()`.

 gidocgen/mdext.py | 5 +++++
 1 file changed, 5 insertions(+)
---
diff --git a/gidocgen/mdext.py b/gidocgen/mdext.py
index a081e74..33a71fb 100644
--- a/gidocgen/mdext.py
+++ b/gidocgen/mdext.py
@@ -17,6 +17,8 @@ ARG_SIGIL_RE = re.compile(r"(^|\W)@([A-Za-z0-9_]+)\b")
 
 CONST_SIGIL_RE = re.compile(r"(^|\W)%([A-Z0-9_]+)\b")
 
+FUNCTION_RE = re.compile(r"\b([a-z][a-z0-9_]*)\(\)")
+
 
 class GtkDocPreprocessor(Preprocessor):
     """Remove all gtk-doc sigils from the Markdown text"""
@@ -52,6 +54,9 @@ class GtkDocPreprocessor(Preprocessor):
                 # Argument sygil
                 new_line = re.sub(ARG_SIGIL_RE, r"\g<1>`\g<2>`", new_line)
 
+                # Function
+                new_line = re.sub(FUNCTION_RE, r"`\g<1>()`", new_line)
+
             new_lines.append(new_line)
         return new_lines
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]