Skip to content

Commit 38cc537

Browse files
correct lua regex
i think i had it in my head that because you need to replace % with %% to search for it you should also replace - with --, which works but it's incorrect
1 parent bf5bc5a commit 38cc537

File tree

2 files changed

+25
-23
lines changed

2 files changed

+25
-23
lines changed

src/resources/filters/normalize/parsehtml.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ function parse_html_tables()
8080
return htmltext
8181
else
8282
local index = 1
83-
content = content:gsub(data_uri_uuid:gsub('-', '--'), function(_)
83+
content = content:gsub(data_uri_uuid:gsub('-', '%%-'), function(_)
8484
local data_uri = data_uris[index]
8585
index = index + 1
8686
return data_uri

tests/docs/typst/ansi/ansi-colors.qmd

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,28 +8,30 @@ format:
88
---
99

1010
```{python}
11-
from ansi2html import Ansi2HTMLConverter
11+
import ansi2html
12+
# from ansi2html import Ansi2HTMLConverter
1213
from IPython.core.display import display, Markdown
1314
14-
conv = Ansi2HTMLConverter()
15-
line = ''
16-
lines = []
17-
for i in range(256):
18-
if (i == 8) or (i >=16 and i%6 == 4):
19-
lines.append(line)
20-
line = ''
21-
line += f'\x1b[38;5;{i}m{i:>3} '
22-
lines.append(line)
23-
# the center 216 is a 6x6x6 cube
24-
# pack it in two columns of three 6x6 squares
25-
lines2 = [lines[0], lines[1]]
26-
for i in range(0, 6, 2):
27-
for j in range(6):
28-
lines2.append(lines[i*6 + j + 2] + lines[i*6 + 6 + j + 2])
29-
lines2.append(lines[38] + lines[39])
30-
lines2.append(lines[40] + lines[41])
31-
display(Markdown(
32-
'::: {html-pre-tag-processing="parse"}\n\n```{=html}\n'
33-
+ conv.convert('\n'.join(lines2)) +
34-
'\n```\n:::\n'))
15+
print(ansi2html)
16+
# conv = ansi2html.Ansi2HTMLConverter()
17+
# line = ''
18+
# lines = []
19+
# for i in range(256):
20+
# if (i == 8) or (i >=16 and i%6 == 4):
21+
# lines.append(line)
22+
# line = ''
23+
# line += f'\x1b[38;5;{i}m{i:>3} '
24+
# lines.append(line)
25+
# # the center 216 is a 6x6x6 cube
26+
# # pack it in two columns of three 6x6 squares
27+
# lines2 = [lines[0], lines[1]]
28+
# for i in range(0, 6, 2):
29+
# for j in range(6):
30+
# lines2.append(lines[i*6 + j + 2] + lines[i*6 + 6 + j + 2])
31+
# lines2.append(lines[38] + lines[39])
32+
# lines2.append(lines[40] + lines[41])
33+
# display(Markdown(
34+
# '::: {html-pre-tag-processing="parse"}\n\n```{=html}\n'
35+
# + conv.convert('\n'.join(lines2)) +
36+
# '\n```\n:::\n'))
3537
```

0 commit comments

Comments
 (0)