Fix invalid Python escape sequences
(cherry picked from commit 4986d6d317
)
This commit is contained in:
parent
2d3b2abcf6
commit
39271362c3
|
@ -1301,7 +1301,7 @@ def make_enum(t: str, is_bitfield: bool, state: State) -> str:
|
||||||
if is_bitfield:
|
if is_bitfield:
|
||||||
if not state.classes[c].enums[e].is_bitfield:
|
if not state.classes[c].enums[e].is_bitfield:
|
||||||
print_error(f'{state.current_class}.xml: Enum "{t}" is not bitfield.', state)
|
print_error(f'{state.current_class}.xml: Enum "{t}" is not bitfield.', state)
|
||||||
return f"|bitfield|\<:ref:`{e}<enum_{c}_{e}>`\>"
|
return f"|bitfield|\\<:ref:`{e}<enum_{c}_{e}>`\\>"
|
||||||
else:
|
else:
|
||||||
return f":ref:`{e}<enum_{c}_{e}>`"
|
return f":ref:`{e}<enum_{c}_{e}>`"
|
||||||
|
|
||||||
|
@ -1891,9 +1891,9 @@ def format_text_block(
|
||||||
post_text = text[endurl_pos + 6 :]
|
post_text = text[endurl_pos + 6 :]
|
||||||
|
|
||||||
if pre_text and pre_text[-1] not in MARKUP_ALLOWED_PRECEDENT:
|
if pre_text and pre_text[-1] not in MARKUP_ALLOWED_PRECEDENT:
|
||||||
pre_text += "\ "
|
pre_text += "\\ "
|
||||||
if post_text and post_text[0] not in MARKUP_ALLOWED_SUBSEQUENT:
|
if post_text and post_text[0] not in MARKUP_ALLOWED_SUBSEQUENT:
|
||||||
post_text = "\ " + post_text
|
post_text = "\\ " + post_text
|
||||||
|
|
||||||
text = pre_text + tag_text + post_text
|
text = pre_text + tag_text + post_text
|
||||||
pos = len(pre_text) + len(tag_text)
|
pos = len(pre_text) + len(tag_text)
|
||||||
|
@ -1970,9 +1970,9 @@ def format_text_block(
|
||||||
|
|
||||||
# Properly escape things like `[Node]s`
|
# Properly escape things like `[Node]s`
|
||||||
if escape_pre and pre_text and pre_text[-1] not in MARKUP_ALLOWED_PRECEDENT:
|
if escape_pre and pre_text and pre_text[-1] not in MARKUP_ALLOWED_PRECEDENT:
|
||||||
pre_text += "\ "
|
pre_text += "\\ "
|
||||||
if escape_post and post_text and post_text[0] not in MARKUP_ALLOWED_SUBSEQUENT:
|
if escape_post and post_text and post_text[0] not in MARKUP_ALLOWED_SUBSEQUENT:
|
||||||
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
|
||||||
|
@ -1980,7 +1980,7 @@ def format_text_block(
|
||||||
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 = f"{post_text[:iter_pos]}\*{post_text[iter_pos + 1 :]}"
|
post_text = f"{post_text[:iter_pos]}\\*{post_text[iter_pos + 1 :]}"
|
||||||
iter_pos += 2
|
iter_pos += 2
|
||||||
|
|
||||||
iter_pos = 0
|
iter_pos = 0
|
||||||
|
@ -1989,7 +1989,7 @@ def format_text_block(
|
||||||
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 = f"{post_text[:iter_pos]}\_{post_text[iter_pos + 1 :]}"
|
post_text = f"{post_text[:iter_pos]}\\_{post_text[iter_pos + 1 :]}"
|
||||||
iter_pos += 2
|
iter_pos += 2
|
||||||
else:
|
else:
|
||||||
iter_pos += 1
|
iter_pos += 1
|
||||||
|
@ -2030,7 +2030,7 @@ def escape_rst(text: str, until_pos: int = -1) -> str:
|
||||||
pos = text.find("*", pos, until_pos)
|
pos = text.find("*", pos, until_pos)
|
||||||
if pos == -1:
|
if pos == -1:
|
||||||
break
|
break
|
||||||
text = f"{text[:pos]}\*{text[pos + 1 :]}"
|
text = f"{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
|
||||||
|
@ -2040,7 +2040,7 @@ def escape_rst(text: str, until_pos: int = -1) -> 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 = f"{text[:pos]}\_{text[pos + 1 :]}"
|
text = f"{text[:pos]}\\_{text[pos + 1 :]}"
|
||||||
pos += 2
|
pos += 2
|
||||||
else:
|
else:
|
||||||
pos += 1
|
pos += 1
|
||||||
|
|
|
@ -471,7 +471,7 @@ def configure_msvc(env, vcvars_msvc_config):
|
||||||
env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"]
|
env["BUILDERS"]["ProgramOriginal"] = env["BUILDERS"]["Program"]
|
||||||
env["BUILDERS"]["Program"] = methods.precious_program
|
env["BUILDERS"]["Program"] = methods.precious_program
|
||||||
|
|
||||||
env.Append(LINKFLAGS=["/NATVIS:platform\windows\godot.natvis"])
|
env.Append(LINKFLAGS=["/NATVIS:platform\\windows\\godot.natvis"])
|
||||||
env.AppendUnique(LINKFLAGS=["/STACK:" + str(STACK_SIZE)])
|
env.AppendUnique(LINKFLAGS=["/STACK:" + str(STACK_SIZE)])
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue