summaryrefslogtreecommitdiff
path: root/_extensions/js
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2025-05-31 14:54:58 +0200
committerJonas Smedegaard <dr@jones.dk>2025-06-07 08:55:45 +0200
commitd32faa12679eb29b122f63fbf541cd2b47169e0e (patch)
treeda842d80f2a2c7ecd876f0145ced35dc7db1fffe /_extensions/js
parent89e81dc251c27bfd546a6409a9071b2116f41657 (diff)
add and use new filter extension multicol
Diffstat (limited to '_extensions/js')
-rw-r--r--_extensions/js/multicol-nohead/_extension.yml6
-rw-r--r--_extensions/js/multicol-nohead/multicol-nohead.lua47
-rw-r--r--_extensions/js/stylish-issue/_extension.yaml12
3 files changed, 53 insertions, 12 deletions
diff --git a/_extensions/js/multicol-nohead/_extension.yml b/_extensions/js/multicol-nohead/_extension.yml
new file mode 100644
index 0000000..104f8ab
--- /dev/null
+++ b/_extensions/js/multicol-nohead/_extension.yml
@@ -0,0 +1,6 @@
+title: Multicol-NoHead
+author: Jonas Smedegaard
+version: 0.0.1
+contributes:
+ filters:
+ - multicol-nohead.lua
diff --git a/_extensions/js/multicol-nohead/multicol-nohead.lua b/_extensions/js/multicol-nohead/multicol-nohead.lua
new file mode 100644
index 0000000..1fa5d4a
--- /dev/null
+++ b/_extensions/js/multicol-nohead/multicol-nohead.lua
@@ -0,0 +1,47 @@
+-- Render content below header in three columns
+
+local multicol_begin = pandoc.RawBlock('latex', [[
+\begin{multicols}{2}\raggedcolumns
+]])
+local multicol_end = pandoc.RawBlock('latex', [[
+\end{multicols}
+]])
+
+local multicol_now = false
+
+-- 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
+
+function multicol_delimit(elem)
+ if multicol_now == true then
+ return {multicol_end, elem, multicol_begin}
+ else
+ multicol_now = true
+ return {elem, multicol_begin}
+ end
+end
+
+function Header(elem)
+ if FORMAT:match 'latex' then
+ if elem.level == 1 then
+ return multicol_delimit(elem)
+ end
+ end
+end
+
+function HorizontalRule(elem)
+ if FORMAT:match 'latex' then
+ return multicol_delimit(elem)
+ end
+end
+
+function Pandoc(doc)
+ if FORMAT:match 'latex' then
+ if multicol_now == true then
+ doc.blocks:insert(multicol_end)
+ return doc
+ end
+ end
+end
diff --git a/_extensions/js/stylish-issue/_extension.yaml b/_extensions/js/stylish-issue/_extension.yaml
index f799288..9d03703 100644
--- a/_extensions/js/stylish-issue/_extension.yaml
+++ b/_extensions/js/stylish-issue/_extension.yaml
@@ -56,15 +56,3 @@ contributes:
# suppress figure label
- text: |
\usepackage[labelformat=empty]{caption}
-
- include-before-body:
- - text: |
-# enable multiple tagged columns
- - text: |
- \begin{multicols}{2}
- \raggedcolumns
-
- include-after-body:
-# conclude multiple tagged columns
- - text: |
- \end{multicols}