fix(py): fix SyntaxWarning: invalid escape sequence

This commit is contained in:
Eisuke Kawashima 2025-06-07 03:42:52 +09:00
parent 520d8ee390
commit 04d9810324
No known key found for this signature in database
GPG Key ID: AE0456361ACA5F4B
2 changed files with 5 additions and 5 deletions

View File

@ -95,7 +95,7 @@ def compose_page(relative_path, definitions):
while True:
new_text = scrub_comments(text)
new_text = re.sub("\$\$", "$$$$", new_text)
new_text = re.sub(r"\$\$", "$$$$", new_text)
new_text = apply_template(new_text, definitions)
if new_text == text:

View File

@ -142,10 +142,10 @@ def to_html(text):
return definitions
def clean_text(text):
text = re.sub("<(?P<tag>[^> ]+)[^>]*>(.*?)</(?P=tag)>", "\g<2>", text)
text = re.sub("<(?P<tag>[^> ]+)[^>]*>(.*?)</(?P=tag)>", "\g<2>", text)
text = re.sub("<(?P<tag>[^> ]+)[^>]*>(.*?)</(?P=tag)>", r"\g<2>", text)
text = re.sub("<(?P<tag>[^> ]+)[^>]*>(.*?)</(?P=tag)>", r"\g<2>", text)
text = re.sub("&mdash;", "-", text)
text = re.sub("\$cxx", "C++", text)
text = re.sub(r"\$cxx", "C++", text)
return text
class CxxRenderer(mistune.Renderer):
@ -188,7 +188,7 @@ class CxxRenderer(mistune.Renderer):
code = re.sub("</?em>", "", code)
if lang == "comment":
code = re.sub("^(.)", "// \g<1>", code, flags = re.MULTILINE)
code = re.sub("^(.)", r"// \g<1>", code, flags = re.MULTILINE)
code = re.sub("^$", "//", code, flags = re.MULTILINE)
return self._join_paragraph() + code + "\n"
else: