diff options
| -rw-r--r-- | content/projects/emojis/blobfox/index.md | 9 | ||||
| -rw-r--r-- | content/projects/emojis/bunhd/index.md | 9 | ||||
| -rw-r--r-- | content/projects/emojis/vlpn/index.md | 9 | ||||
| -rw-r--r-- | filters/code.lua | 13 | ||||
| -rw-r--r-- | filters/common_actions.lua | 53 | ||||
| -rw-r--r-- | filters/headers.lua | 16 | ||||
| -rw-r--r-- | filters/vars.lua | 38 |
7 files changed, 82 insertions, 65 deletions
diff --git a/content/projects/emojis/blobfox/index.md b/content/projects/emojis/blobfox/index.md index b0029c4..5009575 100644 --- a/content/projects/emojis/blobfox/index.md +++ b/content/projects/emojis/blobfox/index.md | |||
| @@ -1,12 +1,13 @@ | |||
| 1 | --- | 1 | --- |
| 2 | title: Blobfox | 2 | title: Blobfox |
| 3 | category: emojis | 3 | category: emojis |
| 4 | preview: preview.jpg | 4 | last_update: 2020-09-04 |
| 5 | preview: preview.jpg | ||
| 5 | --- | 6 | --- |
| 6 | 7 | ||
| 7 |  | 8 |  |
| 8 | 9 | ||
| 9 | **Latest release:** v1.6 (2020-09-04 18:02 CEST) | 10 | **Latest release:** v1.6 (%last_update.yyyy_mm_dd%) |
| 10 | **Download:** [regular version](blobfox.zip), [flipped version](blobfox_flip.zip) | 11 | **Download:** [regular version](blobfox.zip), [flipped version](blobfox_flip.zip) |
| 11 | 12 | ||
| 12 | To install these emojis on Pleroma, you can run the following commands: | 13 | To install these emojis on Pleroma, you can run the following commands: |
diff --git a/content/projects/emojis/bunhd/index.md b/content/projects/emojis/bunhd/index.md index e46c524..e3b24fd 100644 --- a/content/projects/emojis/bunhd/index.md +++ b/content/projects/emojis/bunhd/index.md | |||
| @@ -1,12 +1,13 @@ | |||
| 1 | --- | 1 | --- |
| 2 | title: BunHD | 2 | title: BunHD |
| 3 | category: emojis | 3 | category: emojis |
| 4 | preview: preview.png | 4 | last_update: 2019-09-30 |
| 5 | preview: preview.png | ||
| 5 | --- | 6 | --- |
| 6 | 7 | ||
| 7 |  | 8 |  |
| 8 | 9 | ||
| 9 | **Latest release:** v1.2.1 (2019-09-30 16:26 CET) | 10 | **Latest release:** v1.2.1 (%last_update.yyyy_mm_dd%) |
| 10 | **Download:** [regular version](bunhd.zip), [flipped version](bunhd_flip.zip) | 11 | **Download:** [regular version](bunhd.zip), [flipped version](bunhd_flip.zip) |
| 11 | 12 | ||
| 12 | To install these emojis on Pleroma, you can run the following commands: | 13 | To install these emojis on Pleroma, you can run the following commands: |
diff --git a/content/projects/emojis/vlpn/index.md b/content/projects/emojis/vlpn/index.md index e63ccfc..bbc2d5d 100644 --- a/content/projects/emojis/vlpn/index.md +++ b/content/projects/emojis/vlpn/index.md | |||
| @@ -1,12 +1,13 @@ | |||
| 1 | --- | 1 | --- |
| 2 | title: vlpn | 2 | title: vlpn |
| 3 | category: emojis | 3 | category: emojis |
| 4 | preview: preview.png | 4 | last_update: 2021-07-23 |
| 5 | preview: preview.png | ||
| 5 | --- | 6 | --- |
| 6 | 7 | ||
| 7 |  | 8 |  |
| 8 | 9 | ||
| 9 | **Latest release:** v1.1 (2021-07-23) | 10 | **Latest release:** v1.1 (%last_update.yyyy_mm_dd%) |
| 10 | **[Download](vlpn.zip)** | 11 | **[Download](vlpn.zip)** |
| 11 | 12 | ||
| 12 | To install these emojis on Pleroma, you can run the following command: | 13 | To install these emojis on Pleroma, you can run the following command: |
diff --git a/filters/code.lua b/filters/code.lua new file mode 100644 index 0000000..aca3ce8 --- /dev/null +++ b/filters/code.lua | |||
| @@ -0,0 +1,13 @@ | |||
| 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 | ||
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 | ||
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 | ||
diff --git a/filters/vars.lua b/filters/vars.lua new file mode 100644 index 0000000..e60019e --- /dev/null +++ b/filters/vars.lua | |||
| @@ -0,0 +1,38 @@ | |||
| 1 | local vars = {} | ||
| 2 | |||
| 3 | function string.split(str, sep) | ||
| 4 | sep = sep or '%s' | ||
| 5 | |||
| 6 | local parts = pandoc.List() | ||
| 7 | |||
| 8 | for field, s in str:gmatch("([^" .. sep .. "]*)(" .. sep .. "?)") do | ||
| 9 | parts:insert(field) | ||
| 10 | if s == "" then return parts end | ||
| 11 | end | ||
| 12 | end | ||
| 13 | |||
| 14 | function meta(meta) vars = meta end | ||
| 15 | |||
| 16 | function str(el) | ||
| 17 | local prefix, varref, suffix = el.text:match('^(.*)%%(.*)%%(.*)$') | ||
| 18 | |||
| 19 | if varref then | ||
| 20 | local parts = varref:split(".") | ||
| 21 | local var = vars | ||
| 22 | |||
| 23 | for i = 1, #parts do | ||
| 24 | local part = parts[i] | ||
| 25 | local v = var[part] | ||
| 26 | |||
| 27 | if not v then return el end | ||
| 28 | |||
| 29 | var = v | ||
| 30 | end | ||
| 31 | |||
| 32 | if var then return pandoc.Str(prefix .. var .. suffix) end | ||
| 33 | end | ||
| 34 | |||
| 35 | return el | ||
| 36 | end | ||
| 37 | |||
| 38 | return { { Meta = meta }, { Str = str } } | ||
