1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2024-11-09 19:39:57 +00:00
TiddlyWiki5/editions/test/tiddlers/tests/data/transclude/Parameterised-Name-Values.tid
jeremy@jermolene.com 006ae6e759 Refactor $parameters widget
The objective is to add a $depth attribute so that it is possible to reach up to retrieve the parameters of ancestor transclusions. However, doing so requires changing the encoding of parameter names so that it is not possible for a user parameter to clash with an attribute like $depth. So now we have to double up dollars on any attribute names seen by the parameters widget, just like with the transclude widget itself.
2022-05-31 09:03:20 +01:00

34 lines
1.0 KiB
Plaintext

title: Transclude/Parameterised/Name/Values
description: Parameterised transclusion accessing parameters as name/value pairs
type: text/vnd.tiddlywiki-multiple
tags: [[$:/tags/wiki-test-spec]]
title: Output
\whitespace trim
<$transclude $tiddler="TiddlerOne" 0="" 1="" 2=""/>
{{TiddlerOne}}
{{TiddlerOne|Ferret}}
{{TiddlerOne|Butterfly|Moth}}
{{TiddlerOne|Beetle|Scorpion|Snake}}
{{TiddlerOne||TiddlerTwo|Beetle|Scorpion|Snake}}
+
title: TiddlerOne
\whitespace trim
<$parameters zero='Jaguar' $$one='Lizard' two='Mole' $params="@params">
<$list filter="[<@params>jsonindexes[]]">
{<$text text=<<currentTiddler>>/>: <$text text={{{ [<@params>jsonget<currentTiddler>] }}}/>}
</$list>
</$parameters>
+
title: TiddlerTwo
\whitespace trim
\parameters(zero:'Mouse',$one:'Horse',two:'Owl')
(<$transclude $tiddler=<<currentTiddler>> zero=<<zero>> $$one=<<$one>> two=<<two>>/>)
+
title: ExpectedResult
<p>{0:}{1:}{2:}</p><p></p><p>{0:Ferret}</p><p>{0:Butterfly}{1:Moth}</p><p>{0:Beetle}{1:Scorpion}{2:Snake}</p><p>({$one:Scorpion}{two:Snake}{zero:Beetle})</p>