diff --git a/editions/tw5.com/tiddlers/thisTiddler Variable (Examples).tid b/editions/tw5.com/tiddlers/thisTiddler Variable (Examples).tid deleted file mode 100644 index d0adc6167..000000000 --- a/editions/tw5.com/tiddlers/thisTiddler Variable (Examples).tid +++ /dev/null @@ -1,13 +0,0 @@ -created: 20230304123606350 -modified: 20230304124149055 -tags: [[currentTiddler Variable]] [[Variable Examples]] -title: thisTiddler Variable (Examples) -type: text/vnd.tiddlywiki - - - -<$macrocall $name=".example" n="1" eg="""<$text text=<>/>"""/> - -<$macrocall $name=".example" n="2" eg="""\define example() <$text text=<>/> -<> -"""/> diff --git a/editions/tw5.com/tiddlers/thisTiddler Variable.tid b/editions/tw5.com/tiddlers/thisTiddler Variable.tid deleted file mode 100644 index 95b6b901c..000000000 --- a/editions/tw5.com/tiddlers/thisTiddler Variable.tid +++ /dev/null @@ -1,12 +0,0 @@ -caption: currentTiddler -created: 20230304122810114 -modified: 20230304123557862 -tags: Variables [[Core Variables]] -title: thisTiddler Variable -type: text/vnd.tiddlywiki - -<<.from-version "5.3.0">> The <<.def thisTiddler>> [[variable|Variables]] is set by the <<.wlink TranscludeWidget>> widget to contain the title of the tiddler that was transcluded. This means that within a tiddler <<.def thisTiddler>> will contain the title of that tiddler. It is not affected by macros, which means that within a macro <<.def thisTiddler>> will contain the title of the tiddler from which the macro was invoked. Intermediate, nested macro calls are ignored. - -Compare <<.vlink storyTiddler>> and <<.vlink currentTiddler>>. - -<<.variable-examples "thisTiddler">> diff --git a/editions/tw5.com/tiddlers/variables/SampleTemplate.tid b/editions/tw5.com/tiddlers/variables/SampleTemplate.tid new file mode 100644 index 000000000..e7306504e --- /dev/null +++ b/editions/tw5.com/tiddlers/variables/SampleTemplate.tid @@ -0,0 +1,10 @@ +created: 20230506165016526 +description: I'm a demonstration template +modified: 20230506170529579 +tags: Demonstrations thisTiddler +title: SampleTemplate +type: text/vnd.tiddlywiki + +''thisTiddler'': <$text text=<> /> + +''currentTiddler'': <$text text=<> /> \ No newline at end of file diff --git a/editions/tw5.com/tiddlers/variables/thisTiddler Variable (Examples).tid b/editions/tw5.com/tiddlers/variables/thisTiddler Variable (Examples).tid new file mode 100644 index 000000000..8ce3f8008 --- /dev/null +++ b/editions/tw5.com/tiddlers/variables/thisTiddler Variable (Examples).tid @@ -0,0 +1,18 @@ +created: 20230304123606350 +modified: 20230304124149055 +tags: [[thisTiddler Variable]] [[Variable Examples]] +title: thisTiddler Variable (Examples) +type: text/vnd.tiddlywiki + +The first example shows how <<.def thisTiddler>> works whithin transcluded template. Here the [[SampleTemplate]] is a template for demonstration. + +<$macrocall $name=".example" n="1" eg="""{{||SampleTemplate}}"""/> + +The second example shows <<.def thisTiddler>> in the body of tiddler and inside a macro. + +<$macrocall $name=".example" n="1" eg="""<$text text=<>/>"""/> + +<$macrocall $name=".example" n="2" eg="""\define example() <$text text=<>/> +<> +"""/> + diff --git a/editions/tw5.com/tiddlers/variables/thisTiddler Variable.tid b/editions/tw5.com/tiddlers/variables/thisTiddler Variable.tid new file mode 100644 index 000000000..e01b089e7 --- /dev/null +++ b/editions/tw5.com/tiddlers/variables/thisTiddler Variable.tid @@ -0,0 +1,17 @@ +caption: currentTiddler +created: 20230304122810114 +modified: 20230505200086200 +tags: Variables [[Core Variables]] +title: thisTiddler Variable +type: text/vnd.tiddlywiki + +<<.from-version "5.3.0">> The <<.def thisTiddler>> [[variable|Variables]] is set by the <<.wlink TranscludeWidget>> widget to contain the title of the tiddler that was transcluded. This means that within transclusions <<.def thisTiddler>> will contain the title of the transcluded tiddler. It is not affected by macros, which means that within a macro <<.def thisTiddler>> will contain the title of the tiddler from which the macro was invoked. Intermediate, nested macro calls are ignored. + +There are two key usages for <<.def thisTiddler>>: + +* Within a transcluded template, <<.def thisTiddler>> points to the template itself, making it possible for the template to access data stored in other fields of the template +* Within a macro, <<.def thisTiddler>> points to the template that invoked the macro. If the macro was invoked by another macro, the template that invoked that macro is returned, and so on + +Compare <<.vlink storyTiddler>> and <<.vlink currentTiddler>>. + +<<.variable-examples "thisTiddler">>