Allow including templates within {{#markdown}}

The docs app now works. Fixes #1736.
This commit is contained in:
Avital Oliver
2014-01-19 23:54:04 -08:00
parent ede2e80d48
commit 04ec013674
3 changed files with 14 additions and 2 deletions

View File

@@ -132,6 +132,18 @@ HTML.toText = function (node, textMode, parentComponent) {
};
HTML.Raw.prototype.toText = function () {
return this.value;
};
// used when including templates within {{#markdown}}
HTML.Tag.prototype.toText = function (textMode) {
if (textMode === HTML.TEXTMODE.STRING)
return this.toHTML();
else
throw new Error("Can't insert tags in attributes or TEXTAREA elements");
};
HTML.CharRef.prototype.toText = function (textMode) {
if (textMode === HTML.TEXTMODE.STRING)
return this.str;

View File

@@ -391,7 +391,7 @@ some paragraph to fix showdown's four space parsing below.
</template>
<template name="spacebars_template_test_markdown_inclusion_subtmpl">
Nothing in particular
<span>Nothing in particular</span>
</template>
<template name="spacebars_template_test_markdown_block_helpers">

View File

@@ -1122,7 +1122,7 @@ Tinytest.add('spacebars - templates - #markdown - each', function (test) {
Tinytest.add('spacebars - templates - #markdown - inclusion', function (test) {
var tmpl = Template.spacebars_template_test_markdown_inclusion;
var div = renderToDiv(tmpl);
test.equal(divContentForMarkdown(div), "<p>Nothing in particular</p>");
test.equal(divContentForMarkdown(div), "<p><span>Nothing in particular</span></p>");
});
Tinytest.add('spacebars - templates - #markdown - block helpers', function (test) {