summaryrefslogtreecommitdiff
path: root/_extensions/js/multicol-nohead/multicol-nohead.lua
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-06-13 16:51:50 +0200
committerJonas Smedegaard <dr@jones.dk>2025-06-13 21:20:59 +0200
commit9132e4754d50bc8cd773577194abac90562553af (patch)
tree045a5433cd8f5fc2fe546f852d783ec6cc3a480d /_extensions/js/multicol-nohead/multicol-nohead.lua
parent8e478d7a2259237b7ca3532f5b684a4e962f6edc (diff)
support wide image
Diffstat (limited to '_extensions/js/multicol-nohead/multicol-nohead.lua')
-rw-r--r--_extensions/js/multicol-nohead/multicol-nohead.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/_extensions/js/multicol-nohead/multicol-nohead.lua b/_extensions/js/multicol-nohead/multicol-nohead.lua
index 85e0dd8..d74e87a 100644
--- a/_extensions/js/multicol-nohead/multicol-nohead.lua
+++ b/_extensions/js/multicol-nohead/multicol-nohead.lua
@@ -31,6 +31,13 @@ local function is_columnar_header(elem)
return elem.t == "Header" and elem.level == 1
end
+-- a standalone image with optional caption that has class .wide
+-- TODO: detect pre-quarto-filter pattern too
+local function is_wide(elem)
+ return ((elem.t == "Para" and has_class(elem.content[1], "wide"))
+ or (elem.t == "Figure" and has_class(elem.content[1].content[1], "wide")))
+end
+
-- TODO: detect pre-quarto-filter pattern too
local function is_newpage_command(elem)
return (elem.t == "RawBlock" and elem.text == "\\newpage{}")
@@ -100,6 +107,10 @@ function Pandoc(doc)
if is_columnar_header(elem) then
multicol_places[i] = multicol_now and "renew" or "begin"
multicol_now = true
+ elseif is_wide(elem) then
+ if multicol_now then
+ multicol_places[i] = "renew"
+ end
elseif is_advertising(elem) then
doc.blocks[i] = ad(elem)
if multicol_now then