1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-28 00:59:31 +00:00

Text litteral: strip leading and closing space if present

This commit is contained in:
Étienne Fildadut 2023-12-29 19:19:15 +01:00
parent 5dd971ff8f
commit d42b900388
91 changed files with 428 additions and 424 deletions

View file

@ -25,7 +25,7 @@ return Runtime(AutoCall, Event) {
for _, e in ipairs(self.list) do
table.insert(t, ("%s%s"):format(e[2]:format(...), e[1]:format(...)))
end
return ("| %s|"):format(table.concat(t, " "))
return ("| %s |"):format(table.concat(t, " "))
end,
-- Text comes from TextInterpolation which already evals the contents

View file

@ -31,7 +31,7 @@ local TextInterpolation = ast.abstract.Node {
table.insert(l, ("{%s}"):format(e:format(...)))
end
end
return ("| %s|"):format(table.concat(l))
return ("| %s |"):format(table.concat(l))
end,
_eval = function(self, state)

View file

@ -20,6 +20,10 @@ return string {
source:increment(-1)
end
-- remove terminal space
local last = interpolation.list[#interpolation.list]
if ast.String:is(last) then last.string = last.string:gsub("%s$", "") end
return Translatable:new(interpolation):set_source(start_source), rem
end
}