You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-11 13:10:58 +00:00
makerst.py: Properly escape \ for rst
Fixes godotengine/godot-docs#1486.
This commit is contained in:
@@ -155,9 +155,19 @@ def rstize_text(text, cclass):
|
|||||||
text = pre_text + "\n\n" + post_text
|
text = pre_text + "\n\n" + post_text
|
||||||
pos += 2
|
pos += 2
|
||||||
|
|
||||||
|
next_brac_pos = text.find('[')
|
||||||
|
|
||||||
|
# Escape \ character, otherwise it ends up as an escape character in rst
|
||||||
|
pos = 0
|
||||||
|
while True:
|
||||||
|
pos = text.find('\\', pos, next_brac_pos)
|
||||||
|
if pos == -1:
|
||||||
|
break
|
||||||
|
text = text[:pos] + "\\\\" + text[pos + 1:]
|
||||||
|
pos += 2
|
||||||
|
|
||||||
# Escape * character to avoid interpreting it as emphasis
|
# Escape * character to avoid interpreting it as emphasis
|
||||||
pos = 0
|
pos = 0
|
||||||
next_brac_pos = text.find('[')
|
|
||||||
while True:
|
while True:
|
||||||
pos = text.find('*', pos, next_brac_pos)
|
pos = text.find('*', pos, next_brac_pos)
|
||||||
if pos == -1:
|
if pos == -1:
|
||||||
|
|||||||
Reference in New Issue
Block a user