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

EJS Beautification support #136

Closed
karloluis opened this issue Nov 5, 2014 · 14 comments
Closed

EJS Beautification support #136

karloluis opened this issue Nov 5, 2014 · 14 comments

Comments

@karloluis
Copy link

It might be hard to deal with given that it will work as a html an html and js thing running over eachother but hey. It'd be awesome and you'd be one of the few if not the most complete out there yet.

@Glavin001 Glavin001 self-assigned this Nov 16, 2014
@karloluis
Copy link
Author

@Glavin001 thanks for jumping into this. If you need any help let me know. Just direct me to the correct folder location where this should be integrated to. I might end up scribbling something.

@Glavin001 Glavin001 changed the title Need some ejs support EJS Beautification support Nov 18, 2014
@Glavin001
Copy link
Owner

If we have a Node.js beautifier for EJS then it could be integrated into https://github.com/Glavin001/atom-beautify/blob/master/lib/language-options.coffee#L153

If not, and there is a CLI tool that could beautify it you'd need to extend https://github.com/Glavin001/atom-beautify/blob/master/lib/langs/cli-beautify.coffee and implement it similar to many other CLI beautifiers found in https://github.com/Glavin001/atom-beautify/tree/master/lib/langs such as https://github.com/Glavin001/atom-beautify/blob/master/lib/langs/python-beautify.coffee or https://github.com/Glavin001/atom-beautify/blob/master/lib/langs/perl-beautify.coffee et cetera.

I hope this helps! I am in the middle of a big sprint at work and right after I have final exams, so I will be likely tied up for next two weeks. I'll try and help any way I can if you're up for the challenge of implementing this feature yourself 😃

@karloluis
Copy link
Author

I'm happy to oblige, I got a lot of reading ahead and I'm a bit tied up as well but I'll surely make my way to it.

@Glavin001
Copy link
Owner

@prettydiff is this on your roadmap?

@prettydiff
Copy link
Collaborator

Yes, assign this issue to me. I believe EJS is:
http://www.embeddedjs.com/

I was looking at something similar this morning, but with different delimiters: {@ and @} instead of <% and %>, but all the logic appears the same. The delimiters not a concern (even the angle braces). The big challenge I am thinking through is:

<% } else { %>

It is challenging because that is a closing and opening of a block consolidated to a single markup token. HTML/XML does not have such a concept, because markup tokens either close or open blocks or neither. I will think through this.

The worst case scenario if I cannot find an answer is that children of such blocks do not receive an additional level of indentation.

prettydiff/prettydiff#59

@Glavin001
Copy link
Owner

I think everything between <% and %> is JavaScript, so could you have it use two separate beautifiers? HTML for the main code and omit anything inside of the <% %>s and then process those next with JavaScript? I think trying to handle it as one language may become complicated.

@Glavin001
Copy link
Owner

@prettydiff has added support so this is now high priority.

@Glavin001
Copy link
Owner

@karloluis can you please provide an example file that I can use for my tests. Once I have passing tests I will be publishing. Thank you.

@Glavin001
Copy link
Owner

Will be supported, thanks to @prettydiff, when #282 is released.

@Glavin001 Glavin001 modified the milestones: v1.0.0, v1.1.0 May 1, 2015
Glavin001 referenced this issue May 3, 2015
What's new:
- Beautifier options definition supports:
    - boolean - enable/disable
    - string - rename and enable
    - function - transform and enable
    - array - apply complex transformation to multiple options and
      output single option result
- Show "Supported by <beautifiers>" for each language option
    - Beautifiers have a name
    - Beautifier options definition is used to determine if
    language option is supported by a beautifier
- Remove SQL test, since sqlformat is inconsistant
@Glavin001 Glavin001 modified the milestones: v1.0.0, v1.1.0 May 3, 2015
@Glavin001
Copy link
Owner

Published to v0.25.0

This is a very big release with lots of internal changes and (hopefully) no breaking changes. Please let me know if you are experiencing any unusual behaviour / breaking changes after updating. Thank you.

@agnostio
Copy link

agnostio commented Jan 5, 2017

gives me a pinwheel dialogue that doesn't terminate...

@prettydiff
Copy link
Collaborator

@adammeola01 Would you mind creating a new issue for that and following the template with the required information? That way we can triage and diagnose it properly.

@mywarr
Copy link

mywarr commented Jan 8, 2017

@prettydiff
had the same problem these days,
the problem only occurs on js-beautify; pretty diff is all ok.

procedure to reproduce this:

  1. create an empty file
  2. select grammer as HTML (Angular)
  3. ctrl + option + b = endless in progress wheel spinning.

it got me a endless pinwheel even when i run the command "Atom Beautify: Help Debug Editor" .
so i ran debug editor on pretty diff, hope it helps.

https://gist.github.com/mywarr/7c051e94c3a573382a3f2254c1462dae

Glavin001 added a commit that referenced this issue Jan 25, 2017
@Glavin001
Copy link
Owner

Glavin001 commented Jan 25, 2017

@adammeola01 and @mywarr : your issue is a duplicate of #1458.

Published fix of #1458 to v0.29.17! Thank you for your patience!

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

5 participants