local vars = {}
local additionalChars = {".", ",", "!", ":", ";"}
local function getVars(meta)
for k, v in pairs(meta) do
if v.t == 'MetaInlines' then
local var_key = "$" .. k .. "$"
local var_value = table.unpack(v)["c"]
vars[var_key] = var_value
for _, char in pairs(additionalChars) do
vars[var_key .. char] = var_value .. char
vars[char .. var_key] = char .. var_value
end
return meta
return {
{
Meta = getVars
},
Str = function (el)
if vars[el.text] then
return pandoc.Span(vars[el.text])
else
return el
}