1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-06-18 11:29:55 +00:00

Extend view widget with plainwikified format

This commit is contained in:
Jermolene 2016-06-23 16:28:59 +01:00
parent 28730caf7b
commit 3d5885f5a5
2 changed files with 18 additions and 6 deletions

View File

@ -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}));
};

View File

@ -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 |