File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -119,17 +119,20 @@ node_types.Pattern = class({
119119 return tablex .reduce (math.min , indents ) or 0
120120 end
121121 local striplen = tablex .reduce (math.min , tablex .imap (mindent , self .elements )) or 0
122- local i , strippref = 0 , " \n "
123- while i < striplen do
122+ local i , strippref = 1 , " \n \n"
123+ while i <= striplen do
124124 strippref = strippref .. " "
125125 i = i + 1
126126 end
127127 local strip = function (node , key , len )
128128 if type (node .value ) == " string" then
129129 local value = string.gsub (node .value , " \r\n " , " \n " )
130130 if len >= 1 then
131- self . elements [ key ]. value = string.gsub (value , strippref , " \n " )
131+ value = string.gsub (value , strippref , " \n " )
132132 end
133+ value = string.gsub (value , " ^[\n ]+" , " " )
134+ value = string.gsub (value , " [\n ]+$" , " " )
135+ self .elements [key ].value = value
133136 end
134137 end
135138 tablex .foreachi (self .elements , strip , striplen )
You can’t perform that action at this time.
0 commit comments