summaryrefslogtreecommitdiff
path: root/_extensions/js/multicol-nohead/multicol-nohead.lua
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-06-08 09:38:55 +0200
committerJonas Smedegaard <dr@jones.dk>2025-06-08 18:07:03 +0200
commit1c239a02d3fce1beeb93c89167ffdfae72ebec5c (patch)
treecf4cfaca6ecba0e6dd8a550821b4c5ae83cd106a /_extensions/js/multicol-nohead/multicol-nohead.lua
parentbb82d76b1a6a1170b6848f538df2a19462eca02a (diff)
end multicols before pagebreak
Diffstat (limited to '_extensions/js/multicol-nohead/multicol-nohead.lua')
-rw-r--r--_extensions/js/multicol-nohead/multicol-nohead.lua10
1 files changed, 10 insertions, 0 deletions
diff --git a/_extensions/js/multicol-nohead/multicol-nohead.lua b/_extensions/js/multicol-nohead/multicol-nohead.lua
index a5bba1b..d242ac7 100644
--- a/_extensions/js/multicol-nohead/multicol-nohead.lua
+++ b/_extensions/js/multicol-nohead/multicol-nohead.lua
@@ -7,6 +7,11 @@ local multicol_end = pandoc.RawBlock('latex', [[
\end{multicols}
]])
+-- TODO: detect pre-quarto-filter pattern too
+local function is_newpage_command(elem)
+ return elem.t == "RawBlock" and elem.text == "\\newpage{}"
+end
+
-- TODO: include header level 2 and author paragraph above multicolumn
function is_author(elem)
return elem.t == Para and elem.content[1].text == "Forfatter:"
@@ -22,6 +27,11 @@ function Pandoc(doc)
if elem.t == "Header" and elem.level == 1 then
multicol_places[i] = multicol_now and "renew" or "begin"
multicol_now = true
+ elseif is_newpage_command(elem) then
+ if multicol_now then
+ multicol_places[i] = "end"
+ multicol_now = false
+ end
elseif elem.t == "HorizontalRule" then
if multicol_now then
multicol_places[i] = "end"