summaryrefslogtreecommitdiffstats
path: root/scripts/lib
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2022-08-23 14:07:20 +0200
committerVolpeon <git@volpeon.ink>2022-08-23 14:07:20 +0200
commit7c655a95058aa753355251eb78b83d31d44972ab (patch)
tree9024a3d991727d1f10f99d62497bdd5228e01640 /scripts/lib
parentUpdate (diff)
downloadvolpeon.ink-7c655a95058aa753355251eb78b83d31d44972ab.tar.gz
volpeon.ink-7c655a95058aa753355251eb78b83d31d44972ab.tar.bz2
volpeon.ink-7c655a95058aa753355251eb78b83d31d44972ab.zip
Better navigation of related content
Diffstat (limited to 'scripts/lib')
-rw-r--r--scripts/lib/common.lua34
1 files changed, 21 insertions, 13 deletions
diff --git a/scripts/lib/common.lua b/scripts/lib/common.lua
index ee7c6aa..d3c6c44 100644
--- a/scripts/lib/common.lua
+++ b/scripts/lib/common.lua
@@ -1,15 +1,4 @@
1function dump(o) 1local utils = require 'pandoc.utils'
2 if type(o) == 'table' then
3 local s = '{ '
4 for k, v in pairs(o) do
5 if type(k) ~= 'number' then k = '"' .. k .. '"' end
6 s = s .. '[' .. k .. '] = ' .. dump(v) .. ','
7 end
8 return s .. '} '
9 else
10 return tostring(o)
11 end
12end
13 2
14function string.split(str, sep) 3function string.split(str, sep)
15 sep = sep or '%s' 4 sep = sep or '%s'
@@ -82,6 +71,25 @@ function pandoc.List:shuffle()
82 return self 71 return self
83end 72end
84 73
74function dump(o)
75 if type(o) == 'table' then
76 local s = '{ '
77 for k, v in pairs(o) do
78 if type(k) ~= 'number' then k = '"' .. k .. '"' end
79 s = s .. '[' .. k .. '] = ' .. dump(v) .. ','
80 end
81 return s .. '} '
82 else
83 return tostring(o)
84 end
85end
86
87function prep_layout(layout)
88 layout = utils.stringify(layout)
89 return { id = layout, ["is_" .. layout] = true }
90end
91
85return { 92return {
86 dump = dump 93 dump = dump,
94 prep_layout = prep_layout
87} 95}