Skip to content

Commit 8dbf2ca

Browse files
committed
Only trip leading from first and trailing from last elements
1 parent c25992a commit 8dbf2ca

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

fluent/resource.lua

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,16 +129,17 @@ node_types.Pattern = class({
129129
if len >= 1 then
130130
value = string.gsub(value, strippref, "\n\n")
131131
end
132-
value = string.gsub(value, "^[\n ]+", "")
133-
value = string.gsub(value, "[\n ]+$", "")
132+
-- local function next_is_text
133+
value = key == 1 and string.gsub(value, "^[\n ]+", "") or value
134+
value = key == #self.elements and string.gsub(value, "[\n ]+$", "") or value
134135
self.elements[key].value = value
135136
end
136137
end
137138
tablex.foreachi(self.elements, strip, striplen)
138139
end,
139140
format = function (self, parameters)
140141
local function evaluate (node) return node:format(parameters) end
141-
local value = table.concat(tablex.map(evaluate, self.elements), " ")
142+
local value = table.concat(tablex.map(evaluate, self.elements))
142143
return value, parameters
143144
end
144145
})

0 commit comments

Comments
 (0)