1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-18 15:54:50 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/widgets/ViewWidget.tid
jeremy@jermolene.com dbfd45814d Search and replace "v5.1.24" to "v5.2.0"
As discussed in #5708
2021-07-14 09:21:37 +01:00

57 lines
2.9 KiB
Plaintext

caption: view
created: 20131024141900000
modified: 20210402093330113
tags: Widgets
title: ViewWidget
type: text/vnd.tiddlywiki
! Introduction
The view widget displays the contents of a tiddler field in a specified format.
! Content and Attributes
The content of the `<$view>` widget is displayed if the field or property is missing or empty.
|!Attribute |!Description |
|tiddler |The title of the tiddler (defaults to the [[current tiddler|Current Tiddler]]) |
|field |The name of the field to view (defaults to "text") |
|index |The name of the index to view |
|format |The format for displaying the field (see below) |
|template |Optional template string used when the `format` attribute is set to "date" |
|subtiddler |Optional SubTiddler title when the target tiddler is a [[plugin|Plugins]] (see below) |
|mode |<<.from-version "5.1.15">> Optional transclusion parsing mode for wikified formats. May be "inline" or "block" (the default) |
!! Formats
The following formats can be specified in the `format` attribute:
|!Format |!Description |
|''text'' |Plain text (default) |
|''htmlencoded'' |The field is displayed with HTML encoding |
|''htmltextencoded'' |<<.from-version "5.2.0">> 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. |
|''urlencoded'' |The field is displayed with URL encoding |
|''doubleurlencoded'' |The field is displayed with double URL encoding |
|''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) |
|''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 |
!! "WikiText format"
To display the field content as regular WikiText, for example with working links, use the [[TranscludeWidget]] instead.
! 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"/>
'>>