mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-27 03:57:21 +00:00
add WidgetVariable documentation
This commit is contained in:
parent
459133cc57
commit
d9ccac21d0
@ -1,5 +1,6 @@
|
||||
caption: fields
|
||||
created: 20140924115616653
|
||||
modified: 20140924115627781
|
||||
modified: 20141002150019737
|
||||
tags: Filters
|
||||
title: FilterOperator: fields
|
||||
type: text/vnd.tiddlywiki
|
||||
|
13
editions/tw5.com/tiddlers/variables/Variables.tid
Normal file
13
editions/tw5.com/tiddlers/variables/Variables.tid
Normal file
@ -0,0 +1,13 @@
|
||||
created: 20141002133113496
|
||||
modified: 20141002142932824
|
||||
tags: Reference
|
||||
title: Variables
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
Variables together with [[Widgets]] and [[Macros]] are essential for dynamic WikiText.
|
||||
|
||||
You can define your own [[Variables in WikiText]] or use built-in variables.
|
||||
|
||||
More detailed information of built-in variables could be found in below:
|
||||
|
||||
<<list-links "[tag[Variables]]">>
|
@ -0,0 +1,20 @@
|
||||
caption: currentTiddler
|
||||
created: 20141001232824187
|
||||
modified: 20141002133837818
|
||||
tags: Variables
|
||||
title: WidgetVariable: currentTiddler
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
<<<
|
||||
The ''currentTiddler'' variable containes the title of the current tiddler.
|
||||
|
||||
The ListWidget assigns the list result to the ''currentTiddler'' variable, unless the `variable` attribute is specified.
|
||||
|
||||
A couple of [[Widgets]] and [[Macros]] by default apply to the tiddler according to the ''currentTiddler'' variable.
|
||||
|
||||
The TranscludeWidget (or WikiText `{{||TemplateTitle}}`) transcludes a tiddler without changing the ''currentTiddler'' variable.
|
||||
<<<
|
||||
|
||||
These mechanisms together allow you to write references like `<$view field="title" format="link"/>` in TemplateTiddlers or inside the ListWidget hierarchy without explicitly specifying the tiddler that it applies to.
|
||||
|
||||
See also [[WidgetVariable: storyTiddler]]
|
@ -0,0 +1,10 @@
|
||||
caption: storyTiddler
|
||||
created: 20141001232753952
|
||||
modified: 20141002133957245
|
||||
tags: Variables
|
||||
title: WidgetVariable: storyTiddler
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The ''storyTiddler'' variable is set by the [[default viewtemplate|$:/core/ui/ViewTemplate]] to the name of the current tiddler within tiddlers in the story river, and is not defined within the sidebar.
|
||||
|
||||
See also [[WidgetVariable: currentTiddler]]
|
@ -0,0 +1,35 @@
|
||||
caption: transclusion
|
||||
created: 20141002004621385
|
||||
modified: 20141002133923307
|
||||
tags: Variables
|
||||
title: WidgetVariable: transclusion
|
||||
type: text/vnd.tiddlywiki
|
||||
|
||||
The ''transclusion'' variable is set automatically by the transclude widget to contain a string that identifies the position of the current node within the widget tree. In the sidebar it is set to `{|$:/core/ui/PageTemplate/sidebar|||}` and within the tiddler "HelloThere" in the story river it is set to `{HelloThere|HelloThere|||}`. Each nested level of transclusion appends another curly bracketed list of symbols.
|
||||
|
||||
The QualifyMacro uses the ''transclusion'' variable to identify the stack of transcluded tiddlers.
|
||||
|
||||
! Example:
|
||||
|
||||
```
|
||||
\define mymacro()
|
||||
Hello from mymacro
|
||||
<$list filter="[<transclusion>prefix[{|$:/core/ui/PageTemplate/sidebar|||}]]" emptyMessage="in a tiddler">
|
||||
in the sidebar
|
||||
</$list>
|
||||
\end
|
||||
|
||||
<<mymacro>>
|
||||
```
|
||||
|
||||
Result in story tiddler
|
||||
|
||||
```
|
||||
Hello from mymacro in a tiddler
|
||||
```
|
||||
|
||||
Result in the sidebar
|
||||
|
||||
```
|
||||
Hello from mymacro in the sidebar
|
||||
```
|
27
editions/tw5.com/tiddlers/wikitext/Variables in WikiText.tid
Normal file
27
editions/tw5.com/tiddlers/wikitext/Variables in WikiText.tid
Normal file
@ -0,0 +1,27 @@
|
||||
created: 20141002141231992
|
||||
modified: 20141002144153170
|
||||
tags: WikiText
|
||||
title: Variables in WikiText
|
||||
type: text/vnd.tiddlywiki
|
||||
caption: Hard Linebreaks
|
||||
! Defining Variables
|
||||
|
||||
Variables contains values defined by [[Widgets]].
|
||||
Variables are available within the widget that defines them, and the child widgets in the widget tree.
|
||||
|
||||
Variables are defined by:
|
||||
|
||||
* TiddlyWiki core and viewtemplate
|
||||
* SetWidget
|
||||
* ListWidget
|
||||
* [[Macro definition|Macros in WikiText]]
|
||||
|
||||
! Using Variables
|
||||
|
||||
Variables are used with:
|
||||
|
||||
* Variable substitution `$(name)$`
|
||||
* Concise shortcut `<<name>>`
|
||||
* [[Filter expression|Introduction to Filters]] `[operator<variable-operand>]`
|
||||
|
||||
Built-in [[variables|Variables]] are useful for dynamic WikiText.
|
Loading…
Reference in New Issue
Block a user