diff options
Diffstat (limited to 'filters/lib')
| -rw-r--r-- | filters/lib/common.lua | 26 |
1 files changed, 1 insertions, 25 deletions
diff --git a/filters/lib/common.lua b/filters/lib/common.lua index 4d44ff3..d6f92e0 100644 --- a/filters/lib/common.lua +++ b/filters/lib/common.lua | |||
| @@ -12,30 +12,6 @@ function wide(el) | |||
| 12 | return els | 12 | return els |
| 13 | end | 13 | end |
| 14 | 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 | function string.split(str, sep) | ||
| 29 | sep = sep or '%s' | ||
| 30 | |||
| 31 | local parts = pandoc.List() | ||
| 32 | |||
| 33 | for field, s in str:gmatch("([^" .. sep .. "]*)(" .. sep .. "?)") do | ||
| 34 | parts:insert(field) | ||
| 35 | if s == "" then return parts end | ||
| 36 | end | ||
| 37 | end | ||
| 38 | |||
| 39 | return { | 15 | return { |
| 40 | wide = wide, dump = dump | 16 | wide = wide |
| 41 | } | 17 | } |
