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

Empty line stripping fix #448

Merged
merged 11 commits into from
Jun 30, 2021
Merged

Empty line stripping fix #448

merged 11 commits into from
Jun 30, 2021

Conversation

sunng87
Copy link
Owner

@sunng87 sunng87 commented Jun 20, 2021

Fixes #447

@sunng87
Copy link
Owner Author

sunng87 commented Jun 24, 2021

This cannot easily be fixed from pest parser level. I'm looking into template parser to resolve this.

Rules for whitespace auto elimination is to check if the directive {{# xxx}}`` and ``{{/ xxx}} is holding a whole line, with leading and trailing whitespaces counted, and then remove the trailing NEWLINE and keep the leading one.

@sunng87
Copy link
Owner Author

sunng87 commented Jun 25, 2021

The original JavaScript version: handlebars-lang/handlebars.js#787

@sunng87 sunng87 marked this pull request as ready for review June 27, 2021 12:24
Copy link
Owner Author

@sunng87 sunng87 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

leading whitespace has to be removed too

src/template.rs Outdated Show resolved Hide resolved
@sunng87 sunng87 added this to the 4.1 milestone Jun 28, 2021
src/template.rs Outdated Show resolved Hide resolved
src/template.rs Outdated Show resolved Hide resolved
src/template.rs Outdated Show resolved Hide resolved
@sunng87 sunng87 merged commit 708c773 into master Jun 30, 2021
@sunng87 sunng87 deleted the fix/stripping-newlines-issue branch June 30, 2021 23:40
mkantor added a commit to mkantor/operator that referenced this pull request Jul 14, 2021
The whitespace changes in tests are because of this bugfix:
<sunng87/handlebars-rust#448>.
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.

Unexpected newline removal
1 participant