[gtk/doc-chapters-markdown] docs: Be more careful when expanding abbreviations



commit bdb0b605f4c8afe0200b7a033804f5cf309c6e0a
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat May 23 21:33:25 2020 -0400

    docs: Be more careful when expanding abbreviations
    
    We must not expand #symbol in the middle of a url,
    where it is probably a fragment identifier. Restrict
    problem.

 docs/reference/gtk/gtk-markdown-to-docbook | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/docs/reference/gtk/gtk-markdown-to-docbook b/docs/reference/gtk/gtk-markdown-to-docbook
index b461a44230..247c613dce 100755
--- a/docs/reference/gtk/gtk-markdown-to-docbook
+++ b/docs/reference/gtk/gtk-markdown-to-docbook
@@ -37,10 +37,13 @@ def ExpandAbbreviations(symbol, text):
     text = re.sub(r'\\\%', r'\%', text)
 
     # Convert '#symbol', but not '\#symbol'.
+
+    # Only convert #foo after a space to avoid interfering with
+    # fragment identifiers in urls
     def f3(m):
         return m.group(1) + MakeHashXRef(m.group(2), "type")
 
-    text = re.sub(r'(\A|[^\\])#([\w\-:\.]+[\w]+)', f3, text)
+    text = re.sub(r'(\A|[ ])#([\w\-:\.]+[\w]+)', f3, text)
     text = re.sub(r'\\#', '#', text)
 
     return text


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