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

Add support for Underscore templating #94

Closed
ericrange opened this issue Sep 15, 2014 · 16 comments · May be fixed by cooljl31/atom-beautify#16
Closed

Add support for Underscore templating #94

ericrange opened this issue Sep 15, 2014 · 16 comments · May be fixed by cooljl31/atom-beautify#16
Assignees

Comments

@ericrange
Copy link

i need underscore support :(

@Glavin001
Copy link
Owner

Could you please elaborate.

@Glavin001
Copy link
Owner

@ericrange please explain in enough detail for someone to actually be able to help you.

@ericrange
Copy link
Author

dont you know underscore templating? http://underscorejs.org/
this <% ... %> thing

when i beautify it, it throws an error "mustache not supported"

@Glavin001 Glavin001 removed the invalid label Sep 16, 2014
@Glavin001
Copy link
Owner

I know of Underscore templating, I believe Grunt uses it. I also know that Underscore is a JavaScript library that provides a whole mess of useful functional programming helpers without extending any built-in objects and so much more than templating, which is where my confusion came from your lack of information provided.

Please provide an example file including

  • Contents (your Underscore templating file that is not working)
  • File Extension (this is part of how Atom and Atom Beautify recognizes the grammar)

We can look into adding support for Underscore templating.

@Glavin001 Glavin001 changed the title Underscore? :'( Add support for Underscore templating Sep 16, 2014
@Glavin001 Glavin001 self-assigned this Sep 16, 2014
@Glavin001 Glavin001 reopened this Sep 16, 2014
@Glavin001
Copy link
Owner

@ericrange, could you provide an example file and what you would expect it to look after beautified?

@ericrange
Copy link
Author

@Glavin001
Copy link
Owner

That syntax looks similar to HTML with Embedded Ruby. We have recently added support for ERB: #80

@ericrange
Copy link
Author

yeah but if i do ctrl + alt + b... the error "Unsupported language for grammar 'HTML (Mustache)'." appears

@Glavin001
Copy link
Owner

Try control + shift + L and select "HTML (ERB)" to change the grammar to ERB. This will trick Atom and Atom Beautify 😉. If it works from there, then I can add your "HTML (Mustache)" grammar to ERB support.

Edit: As previously asked, what is the file extension?

@ericrange
Copy link
Author

extension is .hbs because its a nodejs template for handlebars BUT contains underscore templates for the frontend.

i choose grammar to HTML EBR but this throws following error:

Command failed: cmd.exe /s /c "htmlbeautifier < "c:\Users\Eric\AppData\Local\Temp\input114818-6432-mfhwyp" > "c:\Users\Eric\AppData\Local\Temp\114818-6432-lhds3r"" Der Befehl "htmlbeautifier" ist entweder falsch geschrieben oder
konnte nicht gefunden werden.

i updated the package and restart atom...

if you cant understand german, it means "command htmlbea... not found or spelled incoretly"

@Glavin001
Copy link
Owner

For ERB support it required installation of htmlbeautifer. See https://rubygems.org/gems/htmlbeautifier

From your description is sounds like you may be using multiple syntax es, Handlebars templating and Underscores (similar to ERB) is this accurate?

I won't have time until Sunday at the earliest to look into this but hopefully we can figure something out that works for you.

@ericrange
Copy link
Author

yes i use multiple sytaxes... handlebars(server), underscore(client), html and some inline javascript ❗ :D

take as much time as you need :D i dont even expect that you will deal with it :D

@Glavin001
Copy link
Owner

I think #27 will resolve this :). Allow you to select code and run certain beautifiers on your selection.

@Glavin001
Copy link
Owner

Just added HTML (Mustache) support with v0.15.0 (see #123). HTML (ERB) support has been previously added for Issue #80. If you select/highlight specific areas of code, you could change the current grammar in Atom and run beautify and then repeat for different areas of selected code with different grammars.

Hope this helps. Thanks for using atom Beautify!

@Glavin001
Copy link
Owner

Marked as duplicate, because of HTML (ERB) ( #80 ) and HTML (Mustache) ( #123 ).

@Glavin001
Copy link
Owner

Also see prettydiff/prettydiff#35

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

Successfully merging a pull request may close this issue.

2 participants