stackbuilders / stache

Mustache templates for Haskell
MIT License
28 stars 10 forks source link

Partials with list sections do not inherit indentation #72

Open tvandinther opened 1 year ago

tvandinther commented 1 year ago

stache version: stache-2.3.3@sha256:277a4d71f3612a72f314275c7ff3c872637de2b0e2ac7c9eca5bd83ee7aeea2f,4487 from this stackage nightly GHC version: 9.2.4


Issue: Rendering an indented partial containing a list section indents only the first iteration of the list section correctly. Subsequent iterations do not have the first line indented.

Example:

Main template:

Subnets:
  {{> myPartial}}

Partial:

{{#subnets}}
- {{ . }}
"Test string"
{{/subnets}}

Rendered output:

Subnets:
  - subnet-0a0a0a0a
  "Test string"
- subnet-0b0b0b0b
  "Test string"
- subnet-0c0c0c0c
  "Test string"

The spec mentions that partials should inherit indentation here: https://github.com/mustache/spec/blob/master/specs/partials.yml#L13-L15

It appears that the spec is trying to be honoured, but there is a bug for the first line of subsequent iterations.