diff options
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 | } | ||