Skip to content

Commit b3c2153

Browse files
committed
Use jog for traversals in normalization filters
1 parent 67c4ca7 commit b3c2153

File tree

2 files changed

+41
-21
lines changed

2 files changed

+41
-21
lines changed

src/resources/filters/main.lua

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,26 @@ local quarto_init_filters = {
233233

234234
local quarto_normalize_filters = {
235235
{ name = "normalize-draft",
236-
filter = normalize_draft() },
236+
filter = normalize_draft(),
237+
traverse = 'jog',
238+
},
237239

238-
{ name = "normalize", filter = filterIf(function()
239-
if quarto_global_state.active_filters == nil then
240-
return false
241-
end
242-
return quarto_global_state.active_filters.normalization
243-
end, normalize_filter()) },
240+
{ name = "normalize",
241+
filter = filterIf(
242+
function()
243+
if quarto_global_state.active_filters == nil then
244+
return false
245+
end
246+
return quarto_global_state.active_filters.normalization
247+
end,
248+
normalize_filter()),
249+
traverse = 'jog',
250+
},
244251

245-
{ name = "normalize-capture-reader-state", filter = normalize_capture_reader_state() }
252+
{ name = "normalize-capture-reader-state",
253+
filter = normalize_capture_reader_state(),
254+
traverse = 'jog',
255+
}
246256
}
247257

248258
tappend(quarto_normalize_filters, quarto_ast_pipeline())

src/resources/filters/normalize/astpipeline.lua

Lines changed: 23 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,32 +22,42 @@ function quarto_ast_pipeline()
2222
}
2323
end
2424
return {
25-
{ name = "normalize-table-merge-raw-html", filter = table_merge_raw_html() },
25+
{ name = "normalize-table-merge-raw-html",
26+
filter = table_merge_raw_html(),
27+
traverse = 'jog',
28+
},
2629

2730
-- this filter can't be combined with others because it's top-down processing.
2831
-- unfortunate.
29-
{ name = "normalize-html-table-processing", filter = parse_html_tables() },
32+
{ name = "normalize-html-table-processing",
33+
filter = parse_html_tables(),
34+
traverse = 'jog',
35+
},
3036

31-
{ name = "normalize-combined-1", filter = combineFilters({
32-
extract_latex_quartomarkdown_commands(),
33-
forward_cell_subcaps(),
34-
parse_extended_nodes(),
35-
code_filename(),
36-
normalize_fixup_data_uri_image_extension(),
37-
warn_on_stray_triple_colons(),
38-
})
37+
{ name = "normalize-combined-1",
38+
filter = combineFilters({
39+
extract_latex_quartomarkdown_commands(),
40+
forward_cell_subcaps(),
41+
parse_extended_nodes(),
42+
code_filename(),
43+
normalize_fixup_data_uri_image_extension(),
44+
warn_on_stray_triple_colons(),
45+
}),
46+
traverse = 'jog',
3947
},
4048
{
4149
name = "normalize-combine-2",
4250
filter = combineFilters({
43-
parse_md_in_html_rawblocks(),
44-
parse_floatreftargets(),
45-
parse_blockreftargets()
51+
parse_md_in_html_rawblocks(),
52+
parse_floatreftargets(),
53+
parse_blockreftargets()
4654
}),
55+
traverse = 'jog',
4756
},
4857
{
4958
name = "normalize-3",
5059
filter = handle_subfloatreftargets(),
60+
traverse = 'jog',
5161
}
5262
}
5363
end

0 commit comments

Comments
 (0)