summaryrefslogtreecommitdiffstats
path: root/scripts/lib/common.lua
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/lib/common.lua')
-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}