[gi-docgen/function-match] Restrict the function escape regular expression
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gi-docgen/function-match] Restrict the function escape regular expression
- Date: Mon, 27 Sep 2021 19:53:20 +0000 (UTC)
commit 7a586a33648a01de4ca05797c1d9bd6dc7c34660
Author: Emmanuele Bassi <ebassi gnome org>
Date: Mon Sep 27 20:52:01 2021 +0100
Restrict the function escape regular expression
We only want to match function names followed by `()`, but there are too
many cases in which we end up messing it up.
gidocgen/mdext.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/gidocgen/mdext.py b/gidocgen/mdext.py
index 33a71fb..5106871 100644
--- a/gidocgen/mdext.py
+++ b/gidocgen/mdext.py
@@ -17,7 +17,7 @@ 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_]*)\(\)")
+FUNCTION_RE = re.compile(r"(^|\s+)([a-z][a-z0-9_]*)\(\)(\s+|$)")
class GtkDocPreprocessor(Preprocessor):
@@ -55,7 +55,7 @@ class GtkDocPreprocessor(Preprocessor):
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_line = re.sub(FUNCTION_RE, r"\g<1>`\g<2>()`\g<3>", new_line)
new_lines.append(new_line)
return new_lines
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]