From 1c239a02d3fce1beeb93c89167ffdfae72ebec5c Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Sun, 8 Jun 2025 09:38:55 +0200 Subject: end multicols before pagebreak --- _extensions/js/multicol-nohead/multicol-nohead.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to '_extensions/js/multicol-nohead/multicol-nohead.lua') 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" -- cgit v1.2.3