easygen icon indicating copy to clipboard operation
easygen copied to clipboard

Wiki: Indenting multi-line template / values

Open suntong opened this issue 3 years ago • 0 comments

Q:

Given:

{{define A}}
D
  E
    F
{{end}}

Or multi-line variables just like that, let's say I have the template setup like below:

A
  B
   C
     {{template A}} 

How do I make "template A" stay properly indented on rendering?

A:

Option 1:

A
  B
   C
     {{template A | indent 5 }} 

Option 2:

A
  B
   C
{{template A | pindent 5 }} 

Ref:

https://github.com/go-easygen/easygen/blob/e7798da22db7bcb8ce0e00caadb6de255fbba877/t_strings_test.go#L186-L201

PS. I like "Option 1" more because it is more intuitive.

suntong avatar Jul 10 '22 18:07 suntong