From 3d5885f5a5ef8a395ba15285e68c19a8db115e6b Mon Sep 17 00:00:00 2001 From: Jermolene Date: Thu, 23 Jun 2016 16:28:59 +0100 Subject: [PATCH] Extend view widget with `plainwikified` format --- core/modules/widgets/view.js | 7 +++++++ .../tw5.com/tiddlers/widgets/ViewWidget.tid | 17 +++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/core/modules/widgets/view.js b/core/modules/widgets/view.js index 5e1fa9a01..bbe9106be 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 "plainwikified": + this.text = this.getValueAsPlainWikified(); + break; case "htmlencodedplainwikified": this.text = this.getValueAsHtmlEncodedPlainWikified(); break; @@ -135,6 +138,10 @@ ViewWidget.prototype.getValueAsHtmlWikified = function() { return this.wiki.renderText("text/html","text/vnd.tiddlywiki",this.getValueAsText(),{parentWidget: this}); }; +ViewWidget.prototype.getValueAsPlainWikified = function() { + return this.wiki.renderText("text/plain","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})); }; diff --git a/editions/tw5.com/tiddlers/widgets/ViewWidget.tid b/editions/tw5.com/tiddlers/widgets/ViewWidget.tid index db32db4c1..66d415795 100644 --- a/editions/tw5.com/tiddlers/widgets/ViewWidget.tid +++ b/editions/tw5.com/tiddlers/widgets/ViewWidget.tid @@ -1,8 +1,9 @@ -title: ViewWidget -created: 201310241419 -modified: 20150220161335000 -tags: Widgets caption: view +created: 20131024141900000 +modified: 20160623152830060 +tags: Widgets +title: ViewWidget +type: text/vnd.tiddlywiki ! Introduction @@ -26,8 +27,12 @@ The following formats can be specified in the `format` attribute: |!Format |!Description | |''text'' |Plain text | -|''htmlwikified'' |The field is wikified and the resulting HTML returned as plain text | -|''htmlencoded'' |The field is displayed with HTML encoding issues | +|''htmlencoded'' |The field is displayed with HTML encoding | +|''urlencoded'' |The field is displayed with URL encoding | +|''doubleurlencoded'' |The field is displayed with double URL encoding | +|''htmlwikified'' |The field is wikified and the resulting HTML returned as plain text (ie HTML elements will appear in plain text) | +|''plainwikified'' |The field is wikified and the text content of the resulting HTML returned as plain text (ie HTML elements will be removed) | +|''htmlencodedplainwikified'' |The field is wikified and the text content of the resulting HTML returned as HTML encoded plain text (ie HTML elements will be removed) | |''date'' |The field is interpreted as a UTC date and displayed according to the DateFormat specified in the `template` attribute | |''relativedate'' |The field is interpreted as a UTC date and displayed as the interval from the present instant | |''stripcomments'' |The field is interpreted as JavaScript source code and any lines beginning `\\#` are stripped |