1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-10-02 17:00:45 +00:00
TiddlyWiki5/editions/tw5.com/tiddlers/concepts/TransclusionBasicUsage.tid
2014-12-09 14:44:28 +00:00

45 lines
2.0 KiB
Plaintext

created: 20141129201509859
creator: Erwan
modified: 20141130194810119
modifier: Erwan
tags: Transclusion
title: TransclusionBasicUsage
! Simple transclusion
To include some content from ~TiddlerA into ~TiddlerB, edit the latter and write:
```
This is the content of TiddlerA: {{TiddlerA}}
```
As a result, the content of the field ``text`` (i.e. the main content) of ~TiddlerA is rendered in ~TiddlerB.
! Usage
The notation ``{{TiddlerA}}`` is actually a shortcut for ``{{TiddlerA!!text}}``. This is because by default the transcluded field is ``text``, but any other [[field|TiddlerFields]] can be used explicitly. For example, you can print the last time ~TiddlerA was modified using:
```
TiddlerA was modified on {{TiddlerA!!modified}}
```
The ``{{...!!...}}`` notation is also used to display the content of a field from the current tiddler, for example:
```
The current tiddler was modified on {{!!modified}}
```
This is because displaying a field is also a form of transclusion. In this case, the notation ``{{!!modified}}`` used in ~TiddlerB is equivalent to ``{{TiddlerB!!modified}}``. In other words, the default value for the part before ``!!`` is the title of the current tiddler.
! Recursion errors
Notice that using ``{{!!text}}`` or ``{{}}`` causes an error (//Recursive transclusion error in transclude widget//), because it does not make sense to include the content of the current tiddler into the content of the current tiddler (that is, into itself). Whenever you encouter this error message, it means that you are trying to include something into itself, directly or not (for example if tiddler A transcludes tiddler B which transcludes tiddler C which, in turn, transcludes tiddler A).
! Going further
In TiddlyWiki, transclusions are not limited to including raw content like the above. To learn about a more advanced kind of transclusion, see TransclusionAsTemplateUsage.
See also: TransclusionAsTemplateUsage, [[Transclusion in WikiText]], TextReference, and TiddlerFields.