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

Handlebars support #660

Open
spruce opened this issue Mar 26, 2015 · 9 comments
Open

Handlebars support #660

spruce opened this issue Mar 26, 2015 · 9 comments

Comments

@spruce
Copy link

spruce commented Mar 26, 2015

Hey,
I'm using your library in the sublime extension and was beginning to think whether there exists the possibility to add some custom parser for Handlebars? Because there are some specialities to using Handlebars (and in some time HTMLBars).

One example would be:

{{em-input label="Some Labe" property="amt" type="text" placeholder=""}} {{em-input label="Type*" property="type" type="text" placeholder="(LTD)"}} {{em-input label="Place*" property="place" type="text" placeholder=""}} 

Should be formatted like this:

{{em-input label="Some Labe" property="amt" type="text" placeholder=""}}
{{em-input label="Type*" property="type" type="text" placeholder="(LTD)"}}
{{em-input label="Place*" property="place" type="text" placeholder=""}} 

but the html-parser doesn't understand that syntax. That is understandable but I like that to change :)

@spruce
Copy link
Author

spruce commented Mar 26, 2015

Some current Handlebars-issues: #576 #566 #577 #623 #1040 #1173 #1199

@louwers
Copy link

louwers commented Feb 17, 2016

My thread seems to be a duplicate: #801

@basbebe
Copy link

basbebe commented Feb 20, 2016

+1

@lnmunhoz
Copy link

+1 @rafaelcorreiapoli

@rafaelcorreiapoli
Copy link

+1 !!

@cancerberoSgx
Copy link

Can I use js-beautify to format handlebars templates ?

@simaks
Copy link

simaks commented Mar 2, 2018

+1

@Alonski
Copy link
Contributor

Alonski commented May 1, 2018

Is it possible to get some guidance in moving this along? Where should I look in the code to possibly start fixing some of these problems and get a PR working?

@bitwiseman
Copy link
Member

It's a little hard to nail down because the html beautifier doesn't parse the tags into tokens before formatting.

This is the main loop. There are some special treatment of some handlebars tags but most of them are treated like regular tags. Not great.
https://github.com/beautify-web/js-beautify/blob/master/js/src/html/beautifier.js#L882

If you do a search for indent_handlebars you'll find a bunch of other places with special cases for handlebars.

The best thing to do would be to get the html beautifier to parse all input separate from formatting, but that is a bigger effort.

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

No branches or pull requests

9 participants