summaryrefslogtreecommitdiffstats
path: root/filters
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2020-12-29 12:24:04 +0100
committerVolpeon <git@volpeon.ink>2020-12-29 12:24:04 +0100
commit381297c95c7446182e90e459cd0257a8fc86b4cf (patch)
tree5a330a18ea60d983bc6f05976295a316a8ad7a24 /filters
parentHandle blog entry categories (diff)
downloadvolpeon.ink-381297c95c7446182e90e459cd0257a8fc86b4cf.tar.gz
volpeon.ink-381297c95c7446182e90e459cd0257a8fc86b4cf.tar.bz2
volpeon.ink-381297c95c7446182e90e459cd0257a8fc86b4cf.zip
Improved CSS classes for page content, added proper ref list macro, build scripts load and watch Pandoc filters automatically
Diffstat (limited to 'filters')
-rw-r--r--filters/element_classes.lua15
-rw-r--r--filters/links_to_refs.lua3
-rw-r--r--filters/macros.lua23
3 files changed, 38 insertions, 3 deletions
diff --git a/filters/element_classes.lua b/filters/element_classes.lua
new file mode 100644
index 0000000..643ff75
--- /dev/null
+++ b/filters/element_classes.lua
@@ -0,0 +1,15 @@
1function CodeBlock(el)
2 el.attributes.class = 'c-page__prefixed c-page__prefixed--pre'
3 return el
4end
5
6function Header(el)
7 if el.level == 1 then
8 el.attributes.class = 'c-page__prefixed c-page__prefixed--h1'
9 elseif el.level == 2 then
10 el.attributes.class = 'c-page__prefixed c-page__prefixed--h2'
11 elseif el.level == 3 then
12 el.attributes.class = 'c-page__prefixed c-page__prefixed--h3'
13 end
14 return el
15end
diff --git a/filters/links_to_refs.lua b/filters/links_to_refs.lua
deleted file mode 100644
index f19a0f9..0000000
--- a/filters/links_to_refs.lua
+++ /dev/null
@@ -1,3 +0,0 @@
1function Link (el)
2 return { pandoc.Span(el.content), pandoc.Note { pandoc.Plain(pandoc.Link(el.content, el.target, el.title)) } }
3end
diff --git a/filters/macros.lua b/filters/macros.lua
new file mode 100644
index 0000000..86e94ba
--- /dev/null
+++ b/filters/macros.lua
@@ -0,0 +1,23 @@
1function Div(el)
2 if el.attributes.macro == nil then
3 return el
4 end
5
6 if el.attributes.macro == 'refs' and el.content[1].tag == 'BulletList' then
7 local newchildren = pandoc.List()
8
9 newchildren:insert(pandoc.RawBlock('html', '<ul>'))
10
11 for k, children in ipairs(el.content[1].content) do
12 newchildren:insert(pandoc.RawBlock('html', '<li class="c-page__prefixed c-page__prefixed--ref">'))
13 newchildren:extend(children)
14 newchildren:insert(pandoc.RawBlock('html', '</li>'))
15 end
16
17 newchildren:insert(pandoc.RawBlock('html', '</ul>'))
18
19 el.content = newchildren
20 end
21
22 return el.content
23end