summaryrefslogtreecommitdiffstats
path: root/filters
diff options
context:
space:
mode:
Diffstat (limited to 'filters')
-rw-r--r--filters/emojis.lua14
-rw-r--r--filters/vars.lua12
2 files changed, 19 insertions, 7 deletions
diff --git a/filters/emojis.lua b/filters/emojis.lua
index 427d04b..24a9fc3 100644
--- a/filters/emojis.lua
+++ b/filters/emojis.lua
@@ -1,4 +1,14 @@
1function Str(el) 1local common = require 'scripts.lib.common'
2
3local vars = {}
4
5function meta(meta) vars = meta end
6
7function str(el)
8 if vars.build and vars.build.file_out:match(".xml$") then
9 return el
10 end
11
2 local prefix, emojiref, suffix = el.text:match('^(.*):([^ ]+):(.*)$') 12 local prefix, emojiref, suffix = el.text:match('^(.*):([^ ]+):(.*)$')
3 13
4 if emojiref then 14 if emojiref then
@@ -13,3 +23,5 @@ function Str(el)
13 23
14 return el 24 return el
15end 25end
26
27return { { Meta = meta }, { Str = str } }
diff --git a/filters/vars.lua b/filters/vars.lua
index 99cedc4..61803cb 100644
--- a/filters/vars.lua
+++ b/filters/vars.lua
@@ -1,3 +1,4 @@
1local utils = require 'pandoc.utils'
1local common = require 'scripts.lib.common' 2local common = require 'scripts.lib.common'
2 3
3local vars = {} 4local vars = {}
@@ -12,15 +13,14 @@ function str(el)
12 local var = vars 13 local var = vars
13 14
14 for i = 1, #parts do 15 for i = 1, #parts do
15 local part = parts[i] 16 var = var[parts[i]]
16 local v = var[part]
17 17
18 if not v then return el end 18 if not var then
19 19 return el
20 var = v 20 end
21 end 21 end
22 22
23 if var then return pandoc.Str(prefix .. var .. suffix) end 23 return pandoc.Str(prefix .. utils.stringify(var) .. suffix)
24 end 24 end
25 25
26 return el 26 return el