-
Notifications
You must be signed in to change notification settings - Fork 453
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
Support HTML (Ruby - ERB) #80
Comments
Absolutely! Thanks for letting me know. Here is the afflicting line of code: https://github.com/Glavin001/atom-beautify/blob/master/lib/language-options.coffee#L148 Change when "HTML (Liquid)", "HTML", "XML" to when "HTML (Liquid)", "HTML", "XML", "HTML (Ruby - ERB)" And it will also handle that grammar for I will try and publish a patch after work tonight. |
@Aselox could post a sample Also it may be worth while to switch from js-beautify to https://github.com/threedaymonk/htmlbeautifier for HTML beautification support. |
beautifier/js-beautify#398 would suggest that It may be best to add ERB support and use https://github.com/threedaymonk/htmlbeautifier just for it. |
@Glavin001 I renamed the file I'm working on removing the .erb part and I noticed the same bug described in that report. It seems to break ruby code by adding spaces between @ or models. |
Could you try |
Ok @Glavin001, I tried |
Excellent! Then I should be able to add support for ERB HTML later. I'll see if I can tonight, if not soon after. Thanks for testing! |
I took the example from: https://www.stuartellis.eu/articles/erb/ <DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Shopping List for <%= @date.strftime('%A, %d %B %Y') %></title>
</head>
<body>
<h1>Shopping List for <%= @date.strftime('%A, %d %B %Y') %></h1>
<p>You need to buy:</p>
<ul>
<% for @item in @items %>
<li><%= h(@item) %></li>
<% end %>
</ul>
</body>
</html> <DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"https://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="https://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Shopping List for
<%= @date.strftime('%A, %d %B %Y') %></title>
</head>
<body>
<h1>Shopping List for
<%= @date.strftime('%A, %d %B %Y') %></h1>
<p>You need to buy:</p>
<ul>
<% for @item in @items %>
<li><%= h(@item) %></li>
<% end %>
</ul>
</body>
</html> Will be publishing soon now that I have it working and tested 👍. |
Published to v0.8.0 |
When I try to beautify an html.erb file, atom returns the "Unsupported language for grammar 'HTML (Ruby - ERB)'." error. Since html.erb is just a simple html file with embed ruby, could it be possibile to support it?
The text was updated successfully, but these errors were encountered: