2014-09-10 23:06:19 +00:00
caption: view
2016-06-23 15:28:59 +00:00
created: 20131024141900000
2021-04-02 08:34:27 +00:00
modified: 20210402093330113
2016-06-23 15:28:59 +00:00
tags: Widgets
title: ViewWidget
type: text/vnd.tiddlywiki
2013-10-31 22:03:40 +00:00
! Introduction
The view widget displays the contents of a tiddler field in a specified format.
! Content and Attributes
2013-11-09 17:30:06 +00:00
The content of the `<$view>` widget is displayed if the field or property is missing or empty.
2013-10-31 22:03:40 +00:00
|!Attribute |!Description |
2015-02-24 16:41:16 +00:00
|tiddler |The title of the tiddler (defaults to the [[current tiddler|Current Tiddler]]) |
2013-10-31 22:03:40 +00:00
|field |The name of the field to view (defaults to "text") |
2014-02-22 08:53:58 +00:00
|index |The name of the index to view |
2013-10-31 22:03:40 +00:00
|format |The format for displaying the field (see below) |
2018-07-30 20:19:59 +00:00
|template |Optional template string used when the `format` attribute is set to "date" |
2014-10-22 13:12:49 +00:00
|subtiddler |Optional SubTiddler title when the target tiddler is a [[plugin|Plugins]] (see below) |
2017-08-24 19:58:08 +00:00
|mode |<<.from-version "5.1.15">> Optional transclusion parsing mode for wikified formats. May be "inline" or "block" (the default) |
2013-10-31 22:03:40 +00:00
!! Formats
The following formats can be specified in the `format` attribute:
|!Format |!Description |
2020-02-01 13:41:43 +00:00
|''text'' |Plain text (default) |
2016-06-23 15:28:59 +00:00
|''htmlencoded'' |The field is displayed with HTML encoding |
2021-04-02 08:34:27 +00:00
|''htmltextencoded'' |<<.from-version "5.1.24">> The field is displayed with HTML encoding, only double quotes (") are not escaped. This creates a more compact htmlencoding appropriate for html text content, but //not// for attributes. |
2016-06-23 15:28:59 +00:00
|''urlencoded'' |The field is displayed with URL encoding |
|''doubleurlencoded'' |The field is displayed with double URL encoding |
2017-08-24 19:58:08 +00:00
|''htmlwikified'' |The field is wikified according to the mode attribute and the resulting HTML returned as plain text (ie HTML elements will appear in plain text) |
|''plainwikified'' |The field is wikified according to the mode attribute and the text content of the resulting HTML returned as plain text (ie HTML elements will be removed) |
|''htmlencodedplainwikified'' |The field is wikified according to the mode attribute and the text content of the resulting HTML returned as HTML encoded plain text (ie HTML elements will be removed) |
2013-10-31 22:03:40 +00:00
|''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 |
|''jsencoded'' |The field is displayed as a JavaScript encoded string |
2014-10-22 13:12:49 +00:00
2020-04-14 16:16:07 +00:00
!! "WikiText format"
To display the field content as regular WikiText, for example with working links, use the [[TranscludeWidget]] instead.
2014-10-22 13:12:49 +00:00
! SubTiddler Access
The view widget allows access to the individual tiddlers stored within a [[plugin|Plugins]].
The following example will view the core version of the tiddler [[$:/DefaultTiddlers]] even if it has been overridden:
<<wikitext-example-without-html '
<$view tiddler="$:/core" subtiddler="$:/DefaultTiddlers"/>
'>>