Permalink
Browse files

fixing styling

  • Loading branch information...
1 parent 852990a commit 674b82b6e76d7e7273821dd21e61cfaf955fa0ac @tj tj committed Jul 13, 2011
Showing with 30 additions and 23 deletions.
  1. +11 −4 lib/compiler.js
  2. +19 −19 lib/inline-tags.js
View
@@ -216,8 +216,10 @@ Compiler.prototype = {
this.hasCompiledTag = true;
}
- if(this.pp && inlineTags.indexOf(name) == -1)
- this.buffer('\\n' + new Array(this.indentDepth).join(' '));
+ // pretty print
+ if (this.pp && inlineTags.indexOf(name) == -1) {
+ this.buffer('\\n' + Array(this.indentDepth).join(' '));
+ }
if (~selfClosing.indexOf(name) && !this.xml) {
this.buffer('<' + name);
@@ -238,7 +240,12 @@ Compiler.prototype = {
if (tag.text) this.buffer(utils.text(tag.text.nodes[0].trimLeft()));
this.escape = 'pre' == tag.name;
this.visit(tag.block);
- if (this.pp && inlineTags.indexOf(name) == -1 && tag.textOnly == 0) this.buffer('\\n' + new Array(this.indentDepth).join(' '));
+
+ // pretty print
+ if (this.pp && !~inlineTags.indexOf(name) && !tag.textOnly) {
+ this.buffer('\\n' + Array(this.indentDepth).join(' '));
+ }
+
this.buffer('</' + name + '>');
}
this.indentDepth--;
@@ -293,7 +300,7 @@ Compiler.prototype = {
visitComment: function(comment){
if (!comment.buffer) return;
- if (this.pp) this.buffer('\\n' + new Array(this.indentDepth + 1).join(' '));
+ if (this.pp) this.buffer('\\n' + Array(this.indentDepth + 1).join(' '));
this.buffer('<!--' + utils.escape(comment.val) + '-->');
},
View
@@ -6,23 +6,23 @@
*/
module.exports = [
- 'a',
- 'abbr',
- 'acronym',
- 'b',
- 'br',
- 'code',
- 'em',
- 'font',
- 'i',
- 'img',
- 'ins',
- 'kbd',
- 'map',
- 'samp',
- 'small',
- 'span',
- 'strong',
- 'sub',
- 'sup'
+ 'a'
+ , 'abbr'
+ , 'acronym'
+ , 'b'
+ , 'br'
+ , 'code'
+ , 'em'
+ , 'font'
+ , 'i'
+ , 'img'
+ , 'ins'
+ , 'kbd'
+ , 'map'
+ , 'samp'
+ , 'small'
+ , 'span'
+ , 'strong'
+ , 'sub'
+ , 'sup'
];

0 comments on commit 674b82b

Please sign in to comment.