diff options
author | Volpeon <git@volpeon.ink> | 2022-06-18 15:51:18 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2022-06-18 15:51:18 +0200 |
commit | a43ca52aa2d102c7499c7fd8478304a26ea2cd0a (patch) | |
tree | d44afb4720ffdb088a3c8f05f27befb446b195ae /filters/lib | |
parent | Improved exhibit (diff) | |
download | volpeon.ink-a43ca52aa2d102c7499c7fd8478304a26ea2cd0a.tar.gz volpeon.ink-a43ca52aa2d102c7499c7fd8478304a26ea2cd0a.tar.bz2 volpeon.ink-a43ca52aa2d102c7499c7fd8478304a26ea2cd0a.zip |
Improved Lua filters, improved exhibit pages
Diffstat (limited to 'filters/lib')
-rw-r--r-- | filters/lib/common.lua | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/filters/lib/common.lua b/filters/lib/common.lua new file mode 100644 index 0000000..7654eb9 --- /dev/null +++ b/filters/lib/common.lua | |||
@@ -0,0 +1,30 @@ | |||
1 | function wide(el) | ||
2 | local els = pandoc.List() | ||
3 | |||
4 | els:insert(pandoc.RawBlock("html", "</div>")) | ||
5 | if pcall(function() return #el end) then | ||
6 | els:extend(el) | ||
7 | else | ||
8 | els:insert(el) | ||
9 | end | ||
10 | els:insert(pandoc.RawBlock("html", "<div class=\"l-container l-container--narrow u-ml-0\">")) | ||
11 | |||
12 | return els | ||
13 | end | ||
14 | |||
15 | function dump(o) | ||
16 | if type(o) == 'table' then | ||
17 | local s = '{ ' | ||
18 | for k, v in pairs(o) do | ||
19 | if type(k) ~= 'number' then k = '"' .. k .. '"' end | ||
20 | s = s .. '[' .. k .. '] = ' .. dump(v) .. ',' | ||
21 | end | ||
22 | return s .. '} ' | ||
23 | else | ||
24 | return tostring(o) | ||
25 | end | ||
26 | end | ||
27 | |||
28 | return { | ||
29 | wide = wide | ||
30 | } | ||