mirror of
https://github.com/godotengine/godot.git
synced 2024-11-24 13:12:42 +00:00
make_rst: Fix invalid Python escape sequences
Some checks failed
🔗 GHA / 📊 Static (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🌐 JavaScript (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / ☁ Server (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🌐 JavaScript (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / ☁ Server (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
This commit is contained in:
parent
f92989c23b
commit
067ac39c78
@ -646,7 +646,7 @@ def escape_rst(text, until_pos=-1): # type: (str) -> str
|
|||||||
pos = text.find("*", pos, until_pos)
|
pos = text.find("*", pos, until_pos)
|
||||||
if pos == -1:
|
if pos == -1:
|
||||||
break
|
break
|
||||||
text = text[:pos] + "\*" + text[pos + 1 :]
|
text = text[:pos] + "\\*" + text[pos + 1 :]
|
||||||
pos += 2
|
pos += 2
|
||||||
|
|
||||||
# Escape _ character at the end of a word to avoid interpreting it as an inline hyperlink
|
# Escape _ character at the end of a word to avoid interpreting it as an inline hyperlink
|
||||||
@ -656,7 +656,7 @@ def escape_rst(text, until_pos=-1): # type: (str) -> str
|
|||||||
if pos == -1:
|
if pos == -1:
|
||||||
break
|
break
|
||||||
if not text[pos + 1].isalnum(): # don't escape within a snake_case word
|
if not text[pos + 1].isalnum(): # don't escape within a snake_case word
|
||||||
text = text[:pos] + "\_" + text[pos + 1 :]
|
text = text[:pos] + "\\_" + text[pos + 1 :]
|
||||||
pos += 2
|
pos += 2
|
||||||
else:
|
else:
|
||||||
pos += 1
|
pos += 1
|
||||||
@ -914,7 +914,7 @@ def rstize_text(text, state): # type: (str, State) -> str
|
|||||||
|
|
||||||
# Properly escape things like `[Node]s`
|
# Properly escape things like `[Node]s`
|
||||||
if escape_post and post_text and (post_text[0].isalnum() or post_text[0] == "("): # not punctuation, escape
|
if escape_post and post_text and (post_text[0].isalnum() or post_text[0] == "("): # not punctuation, escape
|
||||||
post_text = "\ " + post_text
|
post_text = "\\ " + post_text
|
||||||
|
|
||||||
next_brac_pos = post_text.find("[", 0)
|
next_brac_pos = post_text.find("[", 0)
|
||||||
iter_pos = 0
|
iter_pos = 0
|
||||||
@ -922,7 +922,7 @@ def rstize_text(text, state): # type: (str, State) -> str
|
|||||||
iter_pos = post_text.find("*", iter_pos, next_brac_pos)
|
iter_pos = post_text.find("*", iter_pos, next_brac_pos)
|
||||||
if iter_pos == -1:
|
if iter_pos == -1:
|
||||||
break
|
break
|
||||||
post_text = post_text[:iter_pos] + "\*" + post_text[iter_pos + 1 :]
|
post_text = post_text[:iter_pos] + "\\*" + post_text[iter_pos + 1 :]
|
||||||
iter_pos += 2
|
iter_pos += 2
|
||||||
|
|
||||||
iter_pos = 0
|
iter_pos = 0
|
||||||
@ -931,7 +931,7 @@ def rstize_text(text, state): # type: (str, State) -> str
|
|||||||
if iter_pos == -1:
|
if iter_pos == -1:
|
||||||
break
|
break
|
||||||
if not post_text[iter_pos + 1].isalnum(): # don't escape within a snake_case word
|
if not post_text[iter_pos + 1].isalnum(): # don't escape within a snake_case word
|
||||||
post_text = post_text[:iter_pos] + "\_" + post_text[iter_pos + 1 :]
|
post_text = post_text[:iter_pos] + "\\_" + post_text[iter_pos + 1 :]
|
||||||
iter_pos += 2
|
iter_pos += 2
|
||||||
else:
|
else:
|
||||||
iter_pos += 1
|
iter_pos += 1
|
||||||
|
Loading…
Reference in New Issue
Block a user