diff options
| author | Volpeon <git@volpeon.ink> | 2021-01-07 08:50:48 +0100 |
|---|---|---|
| committer | Volpeon <git@volpeon.ink> | 2021-01-07 08:50:48 +0100 |
| commit | ad478954cf77842364d03e1d5ee85e366e699ee7 (patch) | |
| tree | 90359dfec83694a758878b37510d9dca1493ef43 /filters/common_actions.lua | |
| parent | Improved subpage organization code in metadata filter (diff) | |
| download | volpeon.ink-ad478954cf77842364d03e1d5ee85e366e699ee7.tar.gz volpeon.ink-ad478954cf77842364d03e1d5ee85e366e699ee7.tar.bz2 volpeon.ink-ad478954cf77842364d03e1d5ee85e366e699ee7.zip | |
Improved general structure, resolve category name in metadata filter, added hideable nav items, added header for page layout
Diffstat (limited to 'filters/common_actions.lua')
| -rw-r--r-- | filters/common_actions.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/filters/common_actions.lua b/filters/common_actions.lua index 1d13e3a..a358b99 100644 --- a/filters/common_actions.lua +++ b/filters/common_actions.lua | |||
| @@ -2,7 +2,10 @@ function CodeBlock(el) | |||
| 2 | if next(el.classes) == nil then | 2 | if next(el.classes) == nil then |
| 3 | el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--pre'} | 3 | el.classes = el.classes .. {'c-page__prefixed', 'c-page__prefixed--pre'} |
| 4 | else | 4 | else |
| 5 | local formatted = pandoc.pipe('pygmentize', {'-l', el.classes[1], '-f', 'html', '-O', 'cssclass=c-page__code s-code'}, el.text) | 5 | local formatted = pandoc.pipe('pygmentize', { |
| 6 | '-l', el.classes[1], '-f', 'html', '-O', | ||
| 7 | 'cssclass=c-page__code s-code' | ||
| 8 | }, el.text) | ||
| 6 | el = pandoc.RawBlock('html', formatted) | 9 | el = pandoc.RawBlock('html', formatted) |
| 7 | end | 10 | end |
| 8 | 11 | ||
| @@ -21,9 +24,7 @@ function Header(el) | |||
| 21 | end | 24 | end |
| 22 | 25 | ||
| 23 | function Div(el) | 26 | function Div(el) |
| 24 | if el.attributes.macro == nil then | 27 | if el.attributes.macro == nil then return el end |
| 25 | return el | ||
| 26 | end | ||
| 27 | 28 | ||
| 28 | if el.attributes.macro == 'refs' and el.content[1].tag == 'BulletList' then | 29 | if el.attributes.macro == 'refs' and el.content[1].tag == 'BulletList' then |
| 29 | local newchildren = pandoc.List() | 30 | local newchildren = pandoc.List() |
| @@ -31,7 +32,8 @@ function Div(el) | |||
| 31 | newchildren:insert(pandoc.RawBlock('html', '<ul>')) | 32 | newchildren:insert(pandoc.RawBlock('html', '<ul>')) |
| 32 | 33 | ||
| 33 | for k, children in ipairs(el.content[1].content) do | 34 | for k, children in ipairs(el.content[1].content) do |
| 34 | newchildren:insert(pandoc.RawBlock('html', '<li class="c-page__prefixed c-page__prefixed--ref">')) | 35 | newchildren:insert(pandoc.RawBlock('html', |
| 36 | '<li class="c-page__prefixed c-page__prefixed--ref">')) | ||
| 35 | newchildren:extend(children) | 37 | newchildren:extend(children) |
| 36 | newchildren:insert(pandoc.RawBlock('html', '</li>')) | 38 | newchildren:insert(pandoc.RawBlock('html', '</li>')) |
| 37 | end | 39 | end |
