mirror of
https://github.com/aantron/better-enums.git
synced 2025-12-06 16:56:42 +08:00
Merge 04d98103249f749613a0254c2c7fd535184c8843 into 520d8ee39037c9c94aa6e708a4fd6c0fa313ae80
This commit is contained in:
commit
fa7342d1d5
@ -95,7 +95,7 @@ def compose_page(relative_path, definitions):
|
|||||||
|
|
||||||
while True:
|
while True:
|
||||||
new_text = scrub_comments(text)
|
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)
|
new_text = apply_template(new_text, definitions)
|
||||||
|
|
||||||
if new_text == text:
|
if new_text == text:
|
||||||
|
|||||||
@ -142,10 +142,10 @@ def to_html(text):
|
|||||||
return definitions
|
return definitions
|
||||||
|
|
||||||
def clean_text(text):
|
def clean_text(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)>", "\g<2>", text)
|
text = re.sub("<(?P<tag>[^> ]+)[^>]*>(.*?)</(?P=tag)>", r"\g<2>", text)
|
||||||
text = re.sub("—", "-", text)
|
text = re.sub("—", "-", text)
|
||||||
text = re.sub("\$cxx", "C++", text)
|
text = re.sub(r"\$cxx", "C++", text)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
class CxxRenderer(mistune.Renderer):
|
class CxxRenderer(mistune.Renderer):
|
||||||
@ -188,7 +188,7 @@ class CxxRenderer(mistune.Renderer):
|
|||||||
code = re.sub("</?em>", "", code)
|
code = re.sub("</?em>", "", code)
|
||||||
|
|
||||||
if lang == "comment":
|
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)
|
code = re.sub("^$", "//", code, flags = re.MULTILINE)
|
||||||
return self._join_paragraph() + code + "\n"
|
return self._join_paragraph() + code + "\n"
|
||||||
else:
|
else:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user