\define getMeTiddlerName(a_suffix) $(currentTiddler)$$a_suffix$
In the macro definition above, $(currentTiddler)$ *substitutes the value
from the currentTiddler variable* and then adds the specified $a_suffix$
parameter value.
When you wrote this:
<$list filter="whateveFilterHere">
<$transclude tiddler=<<getMeTiddlerName "_EN">> /> <br/> <!-- DOESN'T
WORK -->
</$list>
The surrounding $list widget *sets the value of the currentTiddler variable*
to "whateveFilterHere".
Thus, the macro output was "whateveFilterHere_EN", which almost certainly
didn't exist in your file, so no transclusion happened.
Then, when you wrote this:
<<getMeTiddlerName "_EN">>
to "print to screen the macro output", the macro wasn't contained inside a
$list widget,
so the value of currentTiddler was the actual containing tiddler's title,
and you got the results you expected.
and, when you wrote:
<$transclude tiddler={{{ [<currentTiddler>addsuffix[_EN]]}}} />
you used "filtered transclusion" (sometimes referred to as an "inline
filter") to directly add the "_EN" suffix to the currentTiddler value,
which was then used as *the value for the "tiddler=..." widget attribute*...
so you got the results you expected.
Note that, *within the filter syntax, variable references are enclosed in
angle brackets*, like this:
<currentTiddler>
However, when used *outside a filter -- in normal wikitext -- variable
references use *doubled* angle brackets*, like this:
<<currentTiddler>>
This is necessary so that *the variable reference isn't mistaken for
conventional HTML syntax*, which uses the single angle brackets, e.g.,
<div>some text here</div>
Hopefully, the above explanations have provided some useful clues :-)
enjoy,
-e
Eric Shulman
TiddlyTools.com: "Small Tools for Big Ideas!"
On Sunday, August 8, 2021 at 10:41:30 AM UTC-7 CarloGgi wrote:
> Charlie, your solution worked fine!
>
> <$transclude tiddler={{{ [<currentTiddler>addsuffix[_EN]]}}} />
>
> Still I wonder why the macro way doesn't yield the expected result, but
> anyway thanksalot for the hint. I will duly commit myself to studying its
> syntax, quite obscure to me.
>
> Regards,
> CG
>
> On Sun, Aug 8, 2021 at 8:14 PM Charlie Veniot <[email protected]> wrote:
>
>> I'm thinking most folk prefer the macro route, and that makes sense to me.
>>
>> The way I'm wired, I usually go with transclusions unless I really don't
>> have a choice. Can't explain it.
>>
>> *For the "variety is the spice of life" giggles*:
>>
>> <$list filter="whateveFilterHere">
>> <$transclude tiddler={{{ [<currentTiddler>addsuffix[_EN]]}}} /> <br/>
>> </$list>
>>
>> But that would be a pain in the caboose if spread all over the place.
>>
>> So sticking with my transclusion mentality...
>>
>> <$list filter="whateveFilterHere">
>> {{||EN_Maker}} <br/>
>> </$list>
>>
>> The tiddler "En_Maker" is a transclusion template tiddler with the
>> following content:
>>
>> <$transclude tiddler={{{ [<currentTiddler>addsuffix[_EN]]}}} />
>>
>> Yeah, I'm quirky that way ...
>>
>> On Sunday, August 8, 2021 at 1:08:29 PM UTC-3 CarloGgi wrote:
>>
>>>
>>> Hallo,
>>> quite new to TW and I love it, though it is dramatically underdocumented
>>> and the whole docs are an almost unusable mess.
>>>
>>> To my biggest astonishment, when I try to dynamically build the name of
>>> a tiddler from inisde a macro, that macro output cannot be used from within
>>> a transclude widget.
>>>
>>> \define getMeTiddlerName(a_suffix) <<currentTiddler>>$a_suffix$
>>>
>>> <$list filter="whateveFilterHere">
>>> <$transclude tiddler=<<getMeTiddlerName "_EN">> /> <br/>
>>> </$list>
>>>
>>> In the example above, I obtain the tiddler's name by adding suffix 'EN'
>>> to current tiddler, which the macro DOES, but then its output
>>> <<getMeTiddlerName "EN">> doesn't make transclude widget behave as expected.
>>>
>>> I also tried many combinations of single/double quotes, as for instance
>>> in:
>>>
>>> <$transclude tiddler="<<getMeTiddlerName '_EN'>>" /> <br/>
>>>
>>> but no result at all: the transclude widget DOESN'T transclude the
>>> dynamically-built tiddler SOMETIDDLERNAME_EN
>>>
>>> Not even the simpler version with hard-coded suffix works:
>>>
>>> \define getMeTiddlerName() <<currentTiddler>>_EN
>>>
>>> <$list filter="whateveFilterHere">
>>> <$transclude tiddler=<<getMeTiddlerName>> /> <br/>
>>> </$list>
>>>
>>> Nor does it using double quotes for 'tiddler' parameter inside
>>> transclude widget:
>>>
>>> \define getMeTiddlerName() <<currentTiddler>>_EN
>>>
>>> <$list filter="whateveFilterHere">
>>> <$transclude tiddler="<<getMeTiddlerName>>" /> <br/>
>>> </$list>
>>>
>>> Thanks for helping, soooo frustrated!
>>>
>>> CG
>>>
>> --
>>
> You received this message because you are subscribed to a topic in the
>> Google Groups "TiddlyWiki" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/tiddlywiki/hbSf3WtfLvM/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> [email protected].
>>
> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/tiddlywiki/38033f26-43ce-495b-aede-bd4958445e21n%40googlegroups.com
>>
>> <https://groups.google.com/d/msgid/tiddlywiki/38033f26-43ce-495b-aede-bd4958445e21n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
--
You received this message because you are subscribed to the Google Groups
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/c4095624-cf11-4e2b-8c63-b17fa26f76f4n%40googlegroups.com.