summaryrefslogtreecommitdiffstats
path: root/filters/vars.lua
diff options
context:
space:
mode:
Diffstat (limited to 'filters/vars.lua')
-rw-r--r--filters/vars.lua15
1 files changed, 3 insertions, 12 deletions
diff --git a/filters/vars.lua b/filters/vars.lua
index e60019e..b0fa66c 100644
--- a/filters/vars.lua
+++ b/filters/vars.lua
@@ -1,20 +1,11 @@
1local vars = {} 1local common = require 'filters.lib.common'
2
3function string.split(str, sep)
4 sep = sep or '%s'
5
6 local parts = pandoc.List()
7 2
8 for field, s in str:gmatch("([^" .. sep .. "]*)(" .. sep .. "?)") do 3local vars = {}
9 parts:insert(field)
10 if s == "" then return parts end
11 end
12end
13 4
14function meta(meta) vars = meta end 5function meta(meta) vars = meta end
15 6
16function str(el) 7function str(el)
17 local prefix, varref, suffix = el.text:match('^(.*)%%(.*)%%(.*)$') 8 local prefix, varref, suffix = el.text:match('^(.*)%%([^ ]+)%%(.*)$')
18 9
19 if varref then 10 if varref then
20 local parts = varref:split(".") 11 local parts = varref:split(".")