Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #611 #657

Merged
merged 3 commits into from
Jul 14, 2024
Merged

Fix #611 #657

merged 3 commits into from
Jul 14, 2024

Conversation

cmrschwarz
Copy link
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

Coverage Status

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

@sunng87
Copy link
Owner

sunng87 commented Jul 14, 2024

Thank you very much @cmrschwarz !

@sunng87 sunng87 merged commit 5db326a into sunng87:master Jul 14, 2024
9 checks passed
@sunng87
Copy link
Owner

sunng87 commented Jul 14, 2024

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