From 381297c95c7446182e90e459cd0257a8fc86b4cf Mon Sep 17 00:00:00 2001 From: Volpeon Date: Tue, 29 Dec 2020 12:24:04 +0100 Subject: Improved CSS classes for page content, added proper ref list macro, build scripts load and watch Pandoc filters automatically --- filters/element_classes.lua | 15 +++++++++++++++ filters/links_to_refs.lua | 3 --- filters/macros.lua | 23 +++++++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) create mode 100644 filters/element_classes.lua delete mode 100644 filters/links_to_refs.lua create mode 100644 filters/macros.lua (limited to 'filters') 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 @@ +function CodeBlock(el) + el.attributes.class = 'c-page__prefixed c-page__prefixed--pre' + return el +end + +function Header(el) + if el.level == 1 then + el.attributes.class = 'c-page__prefixed c-page__prefixed--h1' + elseif el.level == 2 then + el.attributes.class = 'c-page__prefixed c-page__prefixed--h2' + elseif el.level == 3 then + el.attributes.class = 'c-page__prefixed c-page__prefixed--h3' + end + return el +end 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 @@ -function Link (el) - return { pandoc.Span(el.content), pandoc.Note { pandoc.Plain(pandoc.Link(el.content, el.target, el.title)) } } -end 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 @@ +function Div(el) + if el.attributes.macro == nil then + return el + end + + if el.attributes.macro == 'refs' and el.content[1].tag == 'BulletList' then + local newchildren = pandoc.List() + + newchildren:insert(pandoc.RawBlock('html', '')) + + el.content = newchildren + end + + return el.content +end -- cgit v1.2.3-70-g09d2