summaryrefslogtreecommitdiff
path: root/_extensions/js/multicol-nohead/multicol-nohead.lua
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-06-09 09:27:36 +0200
committerJonas Smedegaard <dr@jones.dk>2025-06-09 10:23:10 +0200
commit8408fa71bdfc743042624a5cd3b5b6b779def8d3 (patch)
tree6ab4a362a3ce1cd70659364f5776fd821a89daf8 /_extensions/js/multicol-nohead/multicol-nohead.lua
parent4fed879b927d41251a7863994afaa9e7eb3dd67b (diff)
generalize function is_columnar_header(); drop unused function is_author()
Diffstat (limited to '_extensions/js/multicol-nohead/multicol-nohead.lua')
-rw-r--r--_extensions/js/multicol-nohead/multicol-nohead.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/_extensions/js/multicol-nohead/multicol-nohead.lua b/_extensions/js/multicol-nohead/multicol-nohead.lua
index 4b753a4..85e0dd8 100644
--- a/_extensions/js/multicol-nohead/multicol-nohead.lua
+++ b/_extensions/js/multicol-nohead/multicol-nohead.lua
@@ -27,6 +27,10 @@ local function has_class(elem, class)
return false
end
+local function is_columnar_header(elem)
+ return elem.t == "Header" and elem.level == 1
+end
+
-- TODO: detect pre-quarto-filter pattern too
local function is_newpage_command(elem)
return (elem.t == "RawBlock" and elem.text == "\\newpage{}")
@@ -44,11 +48,6 @@ local function is_advertising(elem)
return false
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:"
-end
-
-- wrap images with class .ad to span half or full page
local function ad(elem)
local amount = #elem.content
@@ -98,7 +97,7 @@ function Pandoc(doc)
local multicol_now = false
local multicol_places = {}
for i, elem in ipairs(doc.blocks) do
- if elem.t == "Header" and elem.level == 1 then
+ if is_columnar_header(elem) then
multicol_places[i] = multicol_now and "renew" or "begin"
multicol_now = true
elseif is_advertising(elem) then