template: allow aliasing escape funcs
This commit is contained in:
parent
39b5177dcd
commit
0a98dfec80
14
template.lua
14
template.lua
|
@ -294,14 +294,22 @@ local make_stream = function(str)
|
|||
end
|
||||
end
|
||||
|
||||
local esc_def = function(str)
|
||||
return str
|
||||
end
|
||||
|
||||
local escapes = {
|
||||
["default"] = function(str)
|
||||
return str
|
||||
end
|
||||
["default"] = esc_def
|
||||
}
|
||||
|
||||
M.set_escape = function(style, func)
|
||||
local old = escapes[style]
|
||||
if type(func) == "string" then
|
||||
func = escapes[func]
|
||||
end
|
||||
if not func then
|
||||
func = esc_def
|
||||
end
|
||||
escapes[style] = func
|
||||
return old
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue