Skip to content

Commit 6817469

Browse files
committed
Make some filters use 'topdown' traversal
It allows to stop the traversal early, which is particularly useful when using `jog`.
1 parent 874c438 commit 6817469

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/resources/filters/normalize/normalize.lua

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ local shortcode_ast = require 'modules/astshortcode'
2222

2323
local function stripNotes(el)
2424
local result = _quarto.ast.walk(el, {
25-
Note = function(_el)
26-
return pandoc.Null()
25+
Note = function()
26+
return {}
2727
end
2828
})
2929
return result
3030
end
3131

3232
function normalize_filter()
3333
return {
34+
traverse = 'topdown',
3435
Meta = function(meta)
3536
-- normalizes the author/affiliation metadata
3637
local normalized = authors.processAuthorMeta(meta) or meta
@@ -65,15 +66,15 @@ function normalize_filter()
6566
-- since that will result in duplicate footnotes
6667
-- in the rendered output
6768
if div.classes:includes('hidden') then
68-
return stripNotes(div)
69+
return stripNotes(div), false
6970
end
7071
end,
7172
Span = function(span)
7273
-- Don't allow footnotes in the hidden element (markdown pipeline)
7374
-- since that will result in duplicate footnotes
74-
-- in the rendered output
75+
-- in the rendered output
7576
if span.classes:includes('hidden') then
76-
return stripNotes(span)
77+
return stripNotes(span), false
7778
end
7879
end
7980
}

0 commit comments

Comments
 (0)