summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2021-11-16 17:43:15 +0100
committerVolpeon <git@volpeon.ink>2021-11-16 17:43:15 +0100
commit28527ca2a2336c371966cef441247f11a6805686 (patch)
tree2c940d0cd65116343d05ed75b9e7188e0a7cb133
parentSlightly smaller cards (diff)
downloadvolpeon.ink-28527ca2a2336c371966cef441247f11a6805686.tar.gz
volpeon.ink-28527ca2a2336c371966cef441247f11a6805686.tar.bz2
volpeon.ink-28527ca2a2336c371966cef441247f11a6805686.zip
Make variables accessible from content files
-rw-r--r--content/projects/emojis/blobfox/index.md9
-rw-r--r--content/projects/emojis/bunhd/index.md9
-rw-r--r--content/projects/emojis/vlpn/index.md9
-rw-r--r--filters/code.lua13
-rw-r--r--filters/common_actions.lua53
-rw-r--r--filters/headers.lua16
-rw-r--r--filters/vars.lua38
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---
2title: Blobfox 2title: Blobfox
3category: emojis 3category: emojis
4preview: preview.jpg 4last_update: 2020-09-04
5preview: preview.jpg
5--- 6---
6 7
7![](screenshot.png) 8![](screenshot.png)
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
12To install these emojis on Pleroma, you can run the following commands: 13To 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---
2title: BunHD 2title: BunHD
3category: emojis 3category: emojis
4preview: preview.png 4last_update: 2019-09-30
5preview: preview.png
5--- 6---
6 7
7![](screenshot.png) 8![](screenshot.png)
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
12To install these emojis on Pleroma, you can run the following commands: 13To 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---
2title: vlpn 2title: vlpn
3category: emojis 3category: emojis
4preview: preview.png 4last_update: 2021-07-23
5preview: preview.png
5--- 6---
6 7
7![](preview.png) 8![](preview.png)
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
12To install these emojis on Pleroma, you can run the following command: 13To 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 @@
1function 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
13end
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 @@
1function 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
13end
14
15function 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
30end
31
32function 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
53end
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 @@
1function 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
16end
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 @@
1local vars = {}
2
3function 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
12end
13
14function meta(meta) vars = meta end
15
16function 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
36end
37
38return { { Meta = meta }, { Str = str } }