diff options
Diffstat (limited to 'filters/lib')
-rw-r--r-- | filters/lib/common.lua | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/filters/lib/common.lua b/filters/lib/common.lua index 7654eb9..4d44ff3 100644 --- a/filters/lib/common.lua +++ b/filters/lib/common.lua | |||
@@ -25,6 +25,17 @@ function dump(o) | |||
25 | end | 25 | end |
26 | end | 26 | end |
27 | 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 | |||
28 | return { | 39 | return { |
29 | wide = wide | 40 | wide = wide, dump = dump |
30 | } | 41 | } |