diff options
author | Volpeon <git@volpeon.ink> | 2021-11-16 17:43:15 +0100 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2021-11-16 17:43:15 +0100 |
commit | 28527ca2a2336c371966cef441247f11a6805686 (patch) | |
tree | 2c940d0cd65116343d05ed75b9e7188e0a7cb133 /filters/headers.lua | |
parent | Slightly smaller cards (diff) | |
download | volpeon.ink-28527ca2a2336c371966cef441247f11a6805686.tar.gz volpeon.ink-28527ca2a2336c371966cef441247f11a6805686.tar.bz2 volpeon.ink-28527ca2a2336c371966cef441247f11a6805686.zip |
Make variables accessible from content files
Diffstat (limited to 'filters/headers.lua')
-rw-r--r-- | filters/headers.lua | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/filters/headers.lua b/filters/headers.lua new file mode 100644 index 0000000..4e3a689 --- /dev/null +++ b/filters/headers.lua | |||
@@ -0,0 +1,16 @@ | |||
1 | function Header(el) | ||
2 | if el.level == 1 then | ||
3 | local newchildren = pandoc.List() | ||
4 | newchildren:insert(pandoc.Span(el.content, { class = 's-headlines__title-inner' })) | ||
5 | el.content = newchildren | ||
6 | end | ||
7 | |||
8 | if el.level <= 3 and el.identifier ~= '' then | ||
9 | el.content:insert(pandoc.Space()) | ||
10 | el.content:insert(pandoc.Link(pandoc.RawInline('html', | ||
11 | '<svg class="o-icon" width="1em" height="1em"><use href="/symbols.svg#icon-link"></use></svg>'), | ||
12 | '#' .. el.identifier, nil, { class = 's-headlines__link' })) | ||
13 | end | ||
14 | |||
15 | return el | ||
16 | end | ||