File tree Expand file tree Collapse file tree 1 file changed +5
-27
lines changed Expand file tree Collapse file tree 1 file changed +5
-27
lines changed Original file line number Diff line number Diff line change @@ -237,35 +237,20 @@ var Funcs = template.FuncMap{
237237
238238 // String functions
239239
240- // @api(Strings/preline ) adds a newline before a string if it is not empty and does not start with a newline.
240+ // @api(Strings/linespace ) adds a newline after a string if it is not empty and does not end with a newline.
241241 //
242242 // Example:
243243 // ```tmpl
244- // {{preline "hello"}}
245- // {{preline ""}}
244+ // {{linespace "hello"}}
245+ // {{linespace ""}}
246246 // ```
247247 //
248248 // Output:
249249 // ```
250- //
251250 // hello
252- // ```
253- "preline" : Chain (stringFunc ("preline" , noError (preline ))),
254-
255- // @api(Strings/postline) adds a newline after a string if it is not empty and does not end with a newline.
256- //
257- // Example:
258- // ```tmpl
259- // {{postline "hello"}}
260- // {{postline ""}}
261- // ```
262251 //
263- // Output:
264252 // ```
265- // hello
266- //
267- // ```
268- "postline" : Chain (stringFunc ("postline" , noError (postline ))),
253+ "linespace" : Chain (stringFunc ("linespace" , noError (linespace ))),
269254
270255 // @api(Strings/quote) returns a double-quoted string.
271256 //
@@ -1271,14 +1256,7 @@ var Funcs = template.FuncMap{
12711256
12721257// String functions
12731258
1274- func preline (s string ) string {
1275- if s == "" || s [0 ] == '\n' || s [0 ] == '\r' {
1276- return s
1277- }
1278- return "\n " + s
1279- }
1280-
1281- func postline (s string ) string {
1259+ func linespace (s string ) string {
12821260 if s == "" || s [len (s )- 1 ] == '\n' {
12831261 return s
12841262 }
You can’t perform that action at this time.
0 commit comments