Skip to content

Commit

Permalink
Don't use "content" in the attribs object, it clobbers meta tags "con…
Browse files Browse the repository at this point in the history
…tent" attribute.
  • Loading branch information
creationix committed Apr 10, 2010
1 parent 8ea2df3 commit 7588d92
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/haml.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var Haml;
function render_attribs(attribs) {
var key, value, result = [];
for (key in attribs) {
if (key !== 'content' && attribs.hasOwnProperty(key)) {
if (key !== '_content' && attribs.hasOwnProperty(key)) {
switch (attribs[key]) {
case 'undefined':
case 'false':
Expand Down Expand Up @@ -59,7 +59,7 @@ var Haml;

if (!(l > 0 && (line.charAt(0) === '{' || line.charAt(0) === '('))) {
return {
content: line[0] === ' ' ? line.substr(1, l) : line
_content: line[0] === ' ' ? line.substr(1, l) : line
};
}
open = line.charAt(0);
Expand Down Expand Up @@ -127,7 +127,7 @@ var Haml;
}
}
}
attributes.content = line.substr(i, line.length);
attributes._content = line.substr(i, line.length);
return attributes;
}

Expand Down Expand Up @@ -183,9 +183,9 @@ var Haml;
attribs = this.matches[3];
if (attribs) {
attribs = parse_attribs(attribs);
if (attribs.content) {
this.contents.unshift(attribs.content.trim());
delete(attribs.content);
if (attribs._content) {
this.contents.unshift(attribs._content.trim());
delete(attribs._content);
}
} else {
attribs = {};
Expand Down
1 change: 1 addition & 0 deletions test/meta.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
%meta(http-equiv="content-type" content="text/html; charset=UTF-8")
1 change: 1 addition & 0 deletions test/meta.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />

0 comments on commit 7588d92

Please sign in to comment.