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

Whitespace control isn't supported #37

Open
yorickpeterse opened this issue Jan 7, 2021 · 2 comments
Open

Whitespace control isn't supported #37

yorickpeterse opened this issue Jan 7, 2021 · 2 comments

Comments

@yorickpeterse
Copy link

yorickpeterse commented Jan 7, 2021

Handlebars allows you to control the whitespace as described in https://handlebarsjs.com/guide/expressions.html#whitespace-control. This however isn't supported by this Gem. For example, this template:

{{#each numbers as |number| ~}}
Number: {{number}}
{{/each}}

Will produce an error along the lines of:

Traceback (most recent call last):
        4: from /tmp/bench.rb:24:in `<main>'
        3: from /home/yorickpeterse/.gem/ruby/2.7.2/gems/ruby-handlebars-0.4.0/lib/ruby-handlebars.rb:22:in `compile'
        2: from /home/yorickpeterse/.gem/ruby/2.7.2/gems/ruby-handlebars-0.4.0/lib/ruby-handlebars.rb:63:in `template_to_ast'
        1: from /home/yorickpeterse/.gem/ruby/2.7.2/gems/parslet-1.8.2/lib/parslet/atoms/base.rb:49:in `parse'
/home/yorickpeterse/.gem/ruby/2.7.2/gems/parslet-1.8.2/lib/parslet/cause.rb:70:in `raise': Extra input after last repetition at line 1 char 1. (Parslet::ParseFailed)
@yorickpeterse
Copy link
Author

@vincent-psarga @mloewinger74 Not sure who the right people to ping are. At GitLab we're looking into using Handlebars for generating user changelogs (see https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50063#note_480180915 and the discussion that follows). But for this we need whitespace control as we're outputting Markdown, not e.g. HTML.

I took a brief look, but I'm not sure how to implement this myself. Would it be possible to add support for controlling whitespace? Thanks! 😄

@joegaudet
Copy link

+1 would love support on this.

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

No branches or pull requests

2 participants