mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-12-26 10:00:34 +00:00
f793816dfa
Useful to be able to reach into plugins. It will enable us to do things like extract readmes from themes that are not active.
70 lines
2.0 KiB
Plaintext
70 lines
2.0 KiB
Plaintext
created: 20130824142500000
|
|
modified: 20140717175900970
|
|
tags: widget
|
|
title: TranscludeWidget
|
|
type: text/vnd.tiddlywiki
|
|
|
|
! Introduction
|
|
|
|
The TranscludeWidget dynamically imports content from another tiddler.
|
|
|
|
! Attributes
|
|
|
|
|!Attribute |!Description |
|
|
|tiddler |The title of the tiddler to transclude (defaults to the current tiddler) |
|
|
|field |The field name of the current tiddler (defaults to "text"; if present takes precedence over the index attribute) |
|
|
|index |The index of a property in a [[DataTiddler|DataTiddlers]] |
|
|
|subtiddler |Optional SubTiddler title when the target tiddler is a [[plugin|Plugins]] (see below) |
|
|
|mode |Override the default parsing mode for the transcluded text to "block" or "inline" |
|
|
|
|
The TranscludeWidget treats any contained content as a fallback if the target of the transclusion is not defined (ie a missing tiddler or a missing field).
|
|
|
|
! Parsing modes
|
|
|
|
TiddlyWiki parses text in two modes:
|
|
|
|
* ''inline'' mode recognises character formatting such as emphasis, links
|
|
* ''block'' mode recognises all the ''inline'' formatting, and adds block formatting such as tables, headings and lists
|
|
|
|
Usually, the mode is determined by whether the transclude widget itself has been parsed in block or inline mode. This can be overridden with the `mode` attribute.
|
|
|
|
For example, consider tiddler "A" with this content:
|
|
|
|
```
|
|
# Item one
|
|
#<$transclude tiddler="B"/>
|
|
# Item two
|
|
```
|
|
|
|
And a tiddler "B" with this content:
|
|
|
|
```
|
|
# Item one - a
|
|
# Item one - b
|
|
```
|
|
|
|
The result will be something like this:
|
|
|
|
# Item one
|
|
# # Item one - a # Item one - b
|
|
# Item two
|
|
|
|
This can be fixed by amending tiddler "A":
|
|
|
|
```
|
|
# Item one
|
|
#<$transclude tiddler="B" mode="block"/>
|
|
# Item two
|
|
```
|
|
|
|
! SubTiddler Access
|
|
|
|
The transclude widget allows access to the individual tiddlers stored within a [[plugin|Plugins]].
|
|
|
|
The following example will transclude the core version of the tiddler [[$:/DefaultTiddlers]] even if it has been overridden:
|
|
|
|
<<wikitext-example-without-html '
|
|
<$transclude tiddler="$:/core" subtiddler="$:/DefaultTiddlers"/>
|
|
|
|
'>>
|