Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/resources/filters/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,12 @@ local quarto_pre_filters = {
traverser = 'jog',
},

{ name = "strip-notes-from-hidden",
filter = strip_notes_from_hidden(),
flags = { "has_notes" },
traverser = 'jog',
},

{ name = "pre-combined-hidden",
filter = combineFilters({
hidden(),
Expand Down
5 changes: 4 additions & 1 deletion src/resources/filters/normalize/flags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ function compute_flags()
end,
Figure = function(node)
flags.has_pandoc3_figure = true
end
end,
Note = function(node)
flags.has_notes = true
end,
}, {
Meta = function(el)
local lightbox_auto = lightbox_module.automatic(el)
Expand Down
25 changes: 0 additions & 25 deletions src/resources/filters/normalize/normalize.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,6 @@ local authors = require 'modules/authors'
local license = require 'modules/license'
local shortcode_ast = require 'modules/astshortcode'

local function stripNotes(el)
local result = _quarto.ast.walk(el, {
Note = function(_el)
return pandoc.Null()
end
})
return result
end

function normalize_filter()
return {
Meta = function(meta)
Expand Down Expand Up @@ -59,22 +50,6 @@ function normalize_filter()
normalized = shortcode_ast.parse(normalized)

return normalized
end,
Div = function(div)
-- Don't allow footnotes in the hidden element (markdown pipeline)
-- since that will result in duplicate footnotes
-- in the rendered output
if div.classes:includes('hidden') then
return stripNotes(div)
end
end,
Span = function(span)
-- Don't allow footnotes in the hidden element (markdown pipeline)
-- since that will result in duplicate footnotes
-- in the rendered output
if span.classes:includes('hidden') then
return stripNotes(span)
end
end
}
end
Expand Down
34 changes: 29 additions & 5 deletions src/resources/filters/quarto-pre/hidden.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,32 @@ function hidden()
end
end






function strip_notes_from_hidden()
local function stripNotes(el)
local result = _quarto.ast.walk(el, {
Note = function(_el)
return pandoc.Null()
end
})
return result
end

return {
Div = function(div)
-- Don't allow footnotes in the hidden element (markdown pipeline)
-- since that will result in duplicate footnotes
-- in the rendered output
if div.classes:includes('hidden') then
return stripNotes(div)
end
end,
Span = function(span)
-- Don't allow footnotes in the hidden element (markdown pipeline)
-- since that will result in duplicate footnotes
-- in the rendered output
if span.classes:includes('hidden') then
return stripNotes(span)
end
end
}
end
Loading