From 939596bd476d38945c166bc4ff0b1adcd8af1eb9 Mon Sep 17 00:00:00 2001 From: Jermolene Date: Fri, 11 Sep 2015 13:33:20 +0100 Subject: [PATCH] Add new "htmlencodedplainwikified" format to view widget Triggered by the text-slicer plugin, but general purpose. The clunky implementation shows the shortcomings of the view widget. It was one of the first widgets to be implemented; subsequently, the implementation of macros gives us a potentially more flexible way of implementing these kinds of text transformations. --- core/modules/widgets/view.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/core/modules/widgets/view.js b/core/modules/widgets/view.js index 13dc0fdb0..5e1fa9a01 100755 --- a/core/modules/widgets/view.js +++ b/core/modules/widgets/view.js @@ -55,6 +55,9 @@ ViewWidget.prototype.execute = function() { case "htmlwikified": this.text = this.getValueAsHtmlWikified(); break; + case "htmlencodedplainwikified": + this.text = this.getValueAsHtmlEncodedPlainWikified(); + break; case "htmlencoded": this.text = this.getValueAsHtmlEncoded(); break; @@ -132,6 +135,10 @@ ViewWidget.prototype.getValueAsHtmlWikified = function() { return this.wiki.renderText("text/html","text/vnd.tiddlywiki",this.getValueAsText(),{parentWidget: this}); }; +ViewWidget.prototype.getValueAsHtmlEncodedPlainWikified = function() { + return $tw.utils.htmlEncode(this.wiki.renderText("text/plain","text/vnd.tiddlywiki",this.getValueAsText(),{parentWidget: this})); +}; + ViewWidget.prototype.getValueAsHtmlEncoded = function() { return $tw.utils.htmlEncode(this.getValueAsText()); };