mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Fixes #84 - Allow XML escaping for tag to be disabled as part of tag def
This commit is contained in:
parent
3845da31a1
commit
0e34a7a570
@ -364,6 +364,11 @@ TagHandlers.prototype = {
|
||||
nestedTag.name = nestedTagName;
|
||||
tag.addNestedTag(nestedTag);
|
||||
});
|
||||
},
|
||||
escapeXmlBody: function(value) {
|
||||
if (value === false) {
|
||||
this.tag.escapeXmlBody = false;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -273,6 +273,10 @@ module.exports = function transform(node, compiler, template) {
|
||||
node.setPreserveWhitespace(true);
|
||||
}
|
||||
|
||||
if (tag.escapeXmlBody === false) {
|
||||
node.setEscapeXmlBodyText(false);
|
||||
}
|
||||
|
||||
if (tag.renderer || tag.isNestedTag) {
|
||||
shouldRemoveAttr = false;
|
||||
|
||||
|
||||
@ -24,7 +24,8 @@
|
||||
"transformer": "./html-tag-transformer"
|
||||
},
|
||||
"html-comment": {
|
||||
"renderer": "./CommentTag"
|
||||
"renderer": "./CommentTag",
|
||||
"escape-xml-body": false
|
||||
}
|
||||
}
|
||||
}
|
||||
1
test/fixtures/templates/cdata-comment/expected.html
vendored
Normal file
1
test/fixtures/templates/cdata-comment/expected.html
vendored
Normal file
@ -0,0 +1 @@
|
||||
<!--[if lt IE 9]><div><![endif]-->
|
||||
1
test/fixtures/templates/cdata-comment/template.marko
vendored
Normal file
1
test/fixtures/templates/cdata-comment/template.marko
vendored
Normal file
@ -0,0 +1 @@
|
||||
<html-comment><![CDATA[[if lt IE 9]><div><![endif]]]></html-comment>
|
||||
3
test/fixtures/templates/cdata-comment/test.js
vendored
Normal file
3
test/fixtures/templates/cdata-comment/test.js
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
exports.templateData = {
|
||||
"name": "World"
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user