From 04ec0136740c85d3c5271cd0faef8e82c7d2509d Mon Sep 17 00:00:00 2001 From: Avital Oliver Date: Sun, 19 Jan 2014 23:54:04 -0800 Subject: [PATCH] Allow including templates within {{#markdown}} The docs app now works. Fixes #1736. --- packages/htmljs/tohtml.js | 12 ++++++++++++ packages/spacebars-tests/template_tests.html | 2 +- packages/spacebars-tests/template_tests.js | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/htmljs/tohtml.js b/packages/htmljs/tohtml.js index 28fc0a9e3c..b238994d9d 100644 --- a/packages/htmljs/tohtml.js +++ b/packages/htmljs/tohtml.js @@ -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; diff --git a/packages/spacebars-tests/template_tests.html b/packages/spacebars-tests/template_tests.html index e412ec0d38..a13b336e4d 100644 --- a/packages/spacebars-tests/template_tests.html +++ b/packages/spacebars-tests/template_tests.html @@ -391,7 +391,7 @@ some paragraph to fix showdown's four space parsing below.