Skip to content

Partials and Trailing Newlines #61

@pvande

Description

@pvande

Example:

{{! template.mustache }}
{{> partial }}
>> {{> partial }}
[ {{> partial }} ]

---
{{> special }}
>> {{> special }}
[ {{> special }} ]
{{! partial.mustache }}
{{! File ends with newline (common standard) }}
{{#things}}{{.}}, {{/things}}
{{! special.mustache }}
{{! File DOES NOT end with newline }}
{{#things}}{{.}}, {{/things}}

Currently specified output:

a, b, c, d, e, 
>> a, b, c, d, e, 

[ a, b, c, d, e, 
 ]

---
a, b, c, d, e, >> a, b, c, d, e, 
[ a, b, c, d, e,  ]

Proposed change:

Standalone partial tags should always interpolate a trailing newline.
Non-standalone partial tags should always chomp one trailing newline character before rendering.

Resulting output:

a, b, c, d, e, 
>> a, b, c, d, e, 
[ a, b, c, d, e,  ]

---
a, b, c, d, e, 
>> a, b, c, d, e, 
[ a, b, c, d, e,  ]

Metadata

Metadata

Assignees

No one assigned

    Labels

    breaking changeproposal would change already specified behaviordebatechoice that involves preference

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions