File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -252,20 +252,20 @@ var Funcs = template.FuncMap{
252252 // ```
253253 "preline" : Chain (stringFunc ("preline" , noError (preline ))),
254254
255- // @api(Strings/blockspace ) adds a newline after a string if it is not empty.
255+ // @api(Strings/postline ) adds a newline after a string if it is not empty and does not end with a newline .
256256 //
257257 // Example:
258258 // ```tmpl
259- // {{blockspace "hello"}}
260- // {{blockspace ""}}
259+ // {{postline "hello"}}
260+ // {{postline ""}}
261261 // ```
262262 //
263263 // Output:
264264 // ```
265265 // hello
266266 //
267267 // ```
268- "blockspace " : Chain (stringFunc ("blockspace " , noError (blockspace ))),
268+ "postline " : Chain (stringFunc ("postline " , noError (postline ))),
269269
270270 // @api(Strings/quote) returns a double-quoted string.
271271 //
@@ -1278,8 +1278,8 @@ func preline(s string) string {
12781278 return "\n " + s
12791279}
12801280
1281- func blockspace (s string ) string {
1282- if s == "" {
1281+ func postline (s string ) string {
1282+ if s == "" || s [ len ( s ) - 1 ] == '\n' {
12831283 return s
12841284 }
12851285 return s + "\n "
You can’t perform that action at this time.
0 commit comments