Skip to content

Fix #611#657

Merged
sunng87 merged 3 commits into
sunng87:masterfrom
cmrschwarz:fix_611
Jul 14, 2024
Merged

Fix #611#657
sunng87 merged 3 commits into
sunng87:masterfrom
cmrschwarz:fix_611

Conversation

@cmrschwarz

Copy link
Copy Markdown
Contributor

This resolves #611, as promised.

The issue seems to be that handlebars-js behaves differently for inline partials and full templates.
For full templates they treat a closing tag as standalone even if there is no trailing newline, but for inline partials they don't.
Handlebars-rs on the other hand was consistent, and always behaved the same for both cases (no trailing newline assumed).

For reference, if we wrap the example from #611 in an empty partial, both our and their output become identical, and consistent with our current version without the partial ( demo ).

This PR changes our behavior to be in line with handlebars-js, at the cost of introducing a difference between partials
and full templates.

@coveralls

Copy link
Copy Markdown

Coverage Status

coverage: 81.389% (-0.07%) from 81.457%
when pulling cc6ad7e on cmrschwarz:fix_611
into 95a53a8 on sunng87:master.

@sunng87

sunng87 commented Jul 14, 2024

Copy link
Copy Markdown
Owner

Thank you very much @cmrschwarz !

@sunng87 sunng87 merged commit 5db326a into sunng87:master Jul 14, 2024
@sunng87

sunng87 commented Jul 14, 2024

Copy link
Copy Markdown
Owner

I added another case to ensure the behaviour aligned with javascript version 913784b

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extra whitespace added to each when the /each isn't followed by \n

3 participants