diff --git a/compiler/taglibs/taglib-loader/loader-tag.js b/compiler/taglibs/taglib-loader/loader-tag.js index ab988b08e..36996be20 100644 --- a/compiler/taglibs/taglib-loader/loader-tag.js +++ b/compiler/taglibs/taglib-loader/loader-tag.js @@ -364,6 +364,11 @@ TagHandlers.prototype = { nestedTag.name = nestedTagName; tag.addNestedTag(nestedTag); }); + }, + escapeXmlBody: function(value) { + if (value === false) { + this.tag.escapeXmlBody = false; + } } }; diff --git a/taglibs/core/core-tag-transformer.js b/taglibs/core/core-tag-transformer.js index d084a676f..cf52e34bc 100644 --- a/taglibs/core/core-tag-transformer.js +++ b/taglibs/core/core-tag-transformer.js @@ -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; diff --git a/taglibs/html/marko-taglib.json b/taglibs/html/marko-taglib.json index 5cf943f10..18c4b08b9 100644 --- a/taglibs/html/marko-taglib.json +++ b/taglibs/html/marko-taglib.json @@ -24,7 +24,8 @@ "transformer": "./html-tag-transformer" }, "html-comment": { - "renderer": "./CommentTag" + "renderer": "./CommentTag", + "escape-xml-body": false } } } \ No newline at end of file diff --git a/test/fixtures/templates/cdata-comment/expected.html b/test/fixtures/templates/cdata-comment/expected.html new file mode 100644 index 000000000..6bd67f32a --- /dev/null +++ b/test/fixtures/templates/cdata-comment/expected.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/test/fixtures/templates/cdata-comment/template.marko b/test/fixtures/templates/cdata-comment/template.marko new file mode 100644 index 000000000..ab8080b53 --- /dev/null +++ b/test/fixtures/templates/cdata-comment/template.marko @@ -0,0 +1 @@ +
\ No newline at end of file diff --git a/test/fixtures/templates/cdata-comment/test.js b/test/fixtures/templates/cdata-comment/test.js new file mode 100644 index 000000000..27e834445 --- /dev/null +++ b/test/fixtures/templates/cdata-comment/test.js @@ -0,0 +1,3 @@ +exports.templateData = { + "name": "World" +};