summaryrefslogtreecommitdiffstats
path: root/filters
diff options
context:
space:
mode:
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