2014-12-30 09:09:40 +00:00
caption: Transclusion
2013-12-05 16:21:10 +00:00
created: 20131205160146648
2022-01-23 09:44:01 +00:00
modified: 20220122193352028
2014-09-11 08:15:58 +00:00
tags: WikiText
2013-12-05 16:21:10 +00:00
title: Transclusion in WikiText
type: text/vnd.tiddlywiki
2014-12-30 09:09:40 +00:00
! Introduction
2013-12-05 16:21:10 +00:00
2014-12-10 17:08:59 +00:00
You can incorporate the content of one tiddler within another using the [[Transclusion]] notation:
2013-12-05 16:21:10 +00:00
* `{{MyTiddler}}` transcludes a single tiddler
2014-01-07 11:57:42 +00:00
* `{{MyTiddler||TemplateTitle}}` displays the tiddler through a specified [[TemplateTiddler|TemplateTiddlers]]
2015-02-24 16:41:16 +00:00
* `{{||TemplateTitle}}` displays the specified template tiddler without altering the [[current tiddler|Current Tiddler]]
2014-03-17 21:44:10 +00:00
2014-12-30 09:09:40 +00:00
!! Transcluding Text References
2014-03-17 21:44:10 +00:00
You can also use a TextReference instead of a tiddler title:
* `{{MyTiddler!!field}}` transcludes a specified field of a tiddler
* `{{!!field}}` transcludes a specified field of the current tiddler
* `{{MyTiddler##index}}` transcludes a specified indexed property of a [[DataTiddler|DataTiddlers]]
* `{{##index}}` transcludes a specified indexed property of the current [[DataTiddler|DataTiddlers]]
2013-12-05 16:21:10 +00:00
2014-12-30 09:09:40 +00:00
!! Filtered Transclusion
2014-09-10 22:42:13 +00:00
A similar syntax can be used to transclude a list of tiddlers matching a specified [[filter|Filters]]:
2013-12-05 16:21:10 +00:00
```
{{{ [tag[mechanism]] }}}
{{{ [tag[mechanism]] ||TemplateTitle}}}
```
2014-10-20 15:12:24 +00:00
2014-12-30 09:09:40 +00:00
! Generated Widgets
The WikiText transclusion syntax generates a TiddlerWidget wrapped around a TranscludeWidget. For example, `{{MyTiddler||MyTemplate!!myField}}` generates the following pair of widgets:
```
<$tiddler tiddler="MyTiddler">
<$transclude tiddler="MyTemplate" field="myField"/>
</$tiddler>
```
2014-10-20 15:12:24 +00:00
See also:
2014-12-10 17:08:59 +00:00
* [[Transclusion Basic Usage]]
* [[Transclusion with Templates]]
* TemplateTiddlers
* TranscludeWidget
2015-05-05 20:48:48 +00:00
* [[Transclusion and Substitution]]
2022-01-23 09:44:01 +00:00
* [[WikiText parser mode: transclusion examples]]