Skip to content

Commit ca91e4c

Browse files
committed
Docs: Fix
1 parent 0429662 commit ca91e4c

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

scripts/doxygen_filter.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,39 @@
22
import re
33

44
def filter_text(content):
5+
content = content.replace(r'\implies', r'\Longrightarrow')
6+
57
pattern = re.compile(
6-
r'(```[\s\S]*?```|`[^`\n]*?`)'
8+
r'(```[\s\S]*?```)'
9+
r'|(`[^`\n]*?`)'
710
r'|(\$\$[\s\S]*?\$\$)'
811
r'|((?<!\$)\$(?!\$)[^\n$]+?(?<!\$)\$(?!\$))'
912
r'|(\\\|)',
1013
re.MULTILINE
1114
)
1215

1316
def replacer(match):
14-
g_code = match.group(1)
15-
g_block_math = match.group(2)
16-
g_inline_math = match.group(3)
17-
g_escaped_pipe = match.group(4)
17+
g_block_code = match.group(1)
18+
g_inline_code = match.group(2)
19+
g_block_math = match.group(3)
20+
g_inline_math = match.group(4)
21+
g_escaped_pipe = match.group(5)
1822

19-
if g_code:
20-
return g_code
21-
22-
elif g_block_math:
23+
if g_block_code:
24+
return g_block_code
25+
26+
if g_inline_code:
27+
return g_inline_code.replace(r'\|', '&#124;')
28+
29+
if g_block_math:
2330
inner = g_block_math[2:-2]
2431
return f"\\f[{inner}\\f]"
2532

26-
elif g_inline_math:
33+
if g_inline_math:
2734
inner = g_inline_math[1:-1]
2835
return f"\\f${inner}\\f$"
2936

30-
elif g_escaped_pipe:
37+
if g_escaped_pipe:
3138
return "&#124;"
3239

3340
return match.group(0)
@@ -40,7 +47,7 @@ def replacer(match):
4047

4148
filename = sys.argv[1]
4249
try:
43-
with open(filename, 'r', encoding='utf-8') as f:
50+
with open(filename, 'r', encoding='utf-8', errors='ignore') as f:
4451
print(filter_text(f.read()))
4552
except Exception as e:
4653
sys.stderr.write(str(e))

0 commit comments

Comments
 (0)