Skip to content

Commit

Permalink
Hand-written parser
Browse files Browse the repository at this point in the history
  • Loading branch information
bterlson committed May 1, 2015
1 parent 397fd24 commit fdb9f60
Show file tree
Hide file tree
Showing 14 changed files with 386 additions and 268 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8
indent_style = space
indent_size = 4
indent_size = 2

# Input/output is 2-space indent
[test/cases/*]
Expand Down
3 changes: 2 additions & 1 deletion .jscsrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@
"preset": "crockford",
"requireMultipleVarDecl": null,
"requireCamelCaseOrUpperCaseIdentifiers": "ignoreProperties",
"disallowDanglingUnderscores": null
"disallowDanglingUnderscores": null,
"validateIndentation": 2
}
147 changes: 0 additions & 147 deletions lib/actions.js

This file was deleted.

20 changes: 10 additions & 10 deletions lib/beautify.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ var beautifyWithBugs = require('js-beautify').html;
var inlineElements = require('inline-elements');

module.exports = function beautify(html) {
var originalOutput = beautifyWithBugs(html, {
indent_size: 2,
wrap_line_length: 0,
unformatted: ['emu-const', 'emu-val', 'emu-nt'].concat(inlineElements)
});
var originalOutput = beautifyWithBugs(html, {
indent_size: 2,
wrap_line_length: 0,
unformatted: ['emu-const', 'emu-val', 'emu-nt'].concat(inlineElements)
});

// https://github.com/beautify-web/js-beautify/issues/524#issuecomment-82791022
var fixNewlines = originalOutput.replace(/(<\/emu-[^>]+>)\n *<\/li>/g, '$1</li>');
// https://github.com/beautify-web/js-beautify/issues/524#issuecomment-82791022
var fixNewlines = originalOutput.replace(/(<\/emu-[^>]+>)\n *<\/li>/g, '$1</li>');

// Remove empty =""s
var withSimplifiedAttributes = fixNewlines.replace(/=""/g, '');
// Remove empty =""s
var withSimplifiedAttributes = fixNewlines.replace(/=""/g, '');

return withSimplifiedAttributes;
return withSimplifiedAttributes;
};
Loading

0 comments on commit fdb9f60

Please sign in to comment.