diff options
Diffstat (limited to 'filters/common_actions.lua')
| -rw-r--r-- | filters/common_actions.lua | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/filters/common_actions.lua b/filters/common_actions.lua deleted file mode 100644 index cfe2d58..0000000 --- a/filters/common_actions.lua +++ /dev/null | |||
| @@ -1,53 +0,0 @@ | |||
| 1 | function CodeBlock(el) | ||
| 2 | if el.classes[1] == "plain" then | ||
| 3 | el = pandoc.Div({ el }, { class = 's-code' }) | ||
| 4 | elseif el.classes[1] then | ||
| 5 | local formatted = pandoc.pipe('pygmentize', { | ||
| 6 | '-l', el.classes[1], '-f', 'html', '-O', 'cssclass=s-code s-code--highlight', | ||
| 7 | }, el.text) | ||
| 8 | |||
| 9 | if formatted then el = pandoc.RawBlock('html', formatted) end | ||
| 10 | end | ||
| 11 | |||
| 12 | return el | ||
| 13 | end | ||
| 14 | |||
| 15 | function Header(el) | ||
| 16 | if el.level == 1 then | ||
| 17 | local newchildren = pandoc.List() | ||
| 18 | newchildren:insert(pandoc.Span(el.content, { class = 's-headlines__title-inner' })) | ||
| 19 | el.content = newchildren | ||
| 20 | end | ||
| 21 | |||
| 22 | if el.level <= 3 and el.identifier ~= '' then | ||
| 23 | el.content:insert(pandoc.Space()) | ||
| 24 | el.content:insert(pandoc.Link(pandoc.RawInline('html', | ||
| 25 | '<svg class="o-icon" width="1em" height="1em"><use href="/symbols.svg#icon-link"></use></svg>'), | ||
| 26 | '#' .. el.identifier, nil, { class = 's-headlines__link' })) | ||
| 27 | end | ||
| 28 | |||
| 29 | return el | ||
| 30 | end | ||
| 31 | |||
| 32 | function Div(el) | ||
| 33 | if el.attributes.macro == nil then return el end | ||
| 34 | |||
| 35 | if el.attributes.macro == 'refs' and el.content[1].tag == 'BulletList' then | ||
| 36 | local newchildren = pandoc.List() | ||
| 37 | |||
| 38 | newchildren:insert(pandoc.RawBlock('html', '<ul>')) | ||
| 39 | |||
| 40 | for _, children in ipairs(el.content[1].content) do | ||
| 41 | newchildren:insert(pandoc.RawBlock('html', | ||
| 42 | '<li class="c-page__prefixed c-page__prefixed--ref">')) | ||
| 43 | newchildren:extend(children) | ||
| 44 | newchildren:insert(pandoc.RawBlock('html', '</li>')) | ||
| 45 | end | ||
| 46 | |||
| 47 | newchildren:insert(pandoc.RawBlock('html', '</ul>')) | ||
| 48 | |||
| 49 | el.content = newchildren | ||
| 50 | end | ||
| 51 | |||
| 52 | return el.content | ||
| 53 | end | ||
