mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 06:00:22 +00:00
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.
This commit is contained in:
parent
10cd539104
commit
3338d24da4
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user