Skip to content

Commit

Permalink
Use jog for traversals in the flags filters
Browse files Browse the repository at this point in the history
  • Loading branch information
tarleb committed Dec 6, 2024
1 parent e4d9bee commit 3b4d0a3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion src/resources/filters/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ tappend(quarto_normalize_filters, quarto_ast_pipeline())
local quarto_pre_filters = {
-- quarto-pre
{ name = "flags",
filter = compute_flags()
filters = compute_flags(),
traverse = 'jog',
},

{ name = "pre-server-shiny",
Expand Down
24 changes: 12 additions & 12 deletions src/resources/filters/normalize/flags.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,7 @@ function compute_flags()
return false
end

return {
Meta = function(el)
local lightbox_auto = lightbox_module.automatic(el)
if lightbox_auto then
flags.has_lightbox = true
elseif lightbox_auto == false then
flags.has_lightbox = false
end
end,
return {{
Header = function(el)
if find_shortcode_in_attributes(el) then
flags.has_shortcodes = true
Expand Down Expand Up @@ -76,7 +68,6 @@ function compute_flags()
if el.text:find("%{%{%<") then
flags.has_shortcodes = true
end

end,
Div = function(node)
if find_shortcode_in_attributes(node) then
Expand Down Expand Up @@ -187,5 +178,14 @@ function compute_flags()
Figure = function(node)
flags.has_pandoc3_figure = true
end
}
end
}, {
Meta = function(el)
local lightbox_auto = lightbox_module.automatic(el)
if lightbox_auto then
flags.has_lightbox = true
elseif lightbox_auto == false then
flags.has_lightbox = false
end
end,
}}
end

0 comments on commit 3b4d0a3

Please sign in to comment.