Closes #80. Add HTML Embedded Ruby (ERB) support.

This commit is contained in:
Glavin Wiechert 2014-09-08 18:50:54 -03:00
parent d595ea7479
commit 6652e7f703
5 changed files with 37 additions and 3 deletions

View File

@ -20,8 +20,10 @@ Or Settings/Preferences ➔ Packages ➔ Search for `atom-beautify`
- [x] JavaScript and JSON
- [x] HTML, including
- [Handlebars](http://handlebarsjs.com/)
- XML
- [x] [Handlebars](http://handlebarsjs.com/)
- [x] [Embedded Ruby (ERB)](https://github.com/Glavin001/atom-beautify/issues/80)
- Requires [htmlbeautifier](https://github.com/threedaymonk/htmlbeautifier)
- [x] XML
- [x] CSS, including
- [Sass](http://sass-lang.com/)
- [LESS](http://lesscss.org/)

View File

@ -0,0 +1,18 @@
<DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://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>

View File

@ -0,0 +1,9 @@
###
Requires https://github.com/hhatto/autopep8
###
"use strict"
cliBeautify = require("./cli-beautify")
getCmd = (inputPath, outputPath, options) ->
# Use command available in $PATH
"htmlbeautifier < \"" + inputPath + "\" > \"" + outputPath + "\""
module.exports = cliBeautify(getCmd)

View File

@ -16,6 +16,7 @@ beautifyRuby = null
beautifyLESS = null
beautifyCoffeeScript = null
uncrustifyBeautifier = null
beautifyHTMLERB = null
# Misc
Analytics = require("analytics-node")
@ -149,6 +150,9 @@ module.exports =
beautifyHTML ?= require("js-beautify").html
text = beautifyHTML(text, self.getOptions("html", allOptions))
beautifyCompleted text
when "HTML (Ruby - ERB)"
beautifyHTMLERB ?= require("./langs/html-erb-beautify")
beautifyHTMLERB text, self.getOptions("html", allOptions), beautifyCompleted
when "CSS"
beautifyCSS ?= require("js-beautify").css
text = beautifyCSS(text, self.getOptions("css", allOptions))

View File

@ -72,7 +72,8 @@
"java",
"pawn",
"vala",
"d"
"d",
"erb"
],
"engines": {
"atom": ">0.50.0"