Hi Tony

We could extend the transclude widget so that it sets a 
“currentTransclusionTitle” variable with the name of the tiddler that it is 
transcluding. We’d actually also need to set variables 
currentTransclusionField, currentTransclusionIndex and 
currentTransclusionSubtiddler to capture all the attributes of the transclusion.

Then, in your example below, the tiddler “Second” would be able to obtain the 
name of the tiddler from which it was transcluded.

A potential limitation is that each successive transclusion would overwrite the 
values of those variables. We could work around that by making the value of 
each variable be a list, and append the new values at each transclusion.

Does that make sense, and would it do what your after?

Finally, a small point, but you’ve got this construction:

<$set name="callingTiddler" value={{{ [<currentTiddler>] }}} >

It could be written more concisely as:

<$set name="callingTiddler" value=<<currentTiddler>>>

Best wishes

Jeremy

> On 2 Nov 2019, at 06:17, TonyM <anthony.mus...@gmail.com> wrote:
> 
> Folks,
> 
> A solution was found for this specific use case, before posting, but the 
> Question still could do with an answer
> Use the <<storyTiddler>> variable to find the "DisplayTiddler" regardless of 
> the number of transclusions.
> 
> A reoccurring confusion of mine occurs trying to implement the following with 
> a define rather than a set, is it possible?
> <$set name="callingTiddler" value={{{ [<currentTiddler>] }}} >
> 1st: <br>
> {{tiddlername||Second}}
> </$set>
> The value <<callingTiddler>> will be available in all nested transclusions.
> 
> The problem with this is you always need to close the set widget. This means 
> every time you edit or add something to the tiddler you have to make sure 
> changes that need it are inside the set.
> 
> Is there a way to 
> \define callingTiddler() something
> to achieve the same result?
> 
> The problem is whatever you place in a macro definition gets evaluated when 
> its displayed not before 
> 
> Of course I can use;
> \define callingTiddler() actual tiddlername
> With a literal tiddler name but then each tiddler needs a unique setting and 
> you can't "import variables", make it global or any other method I can think 
> of
> 
> Why?
> I really want an answer to support a range of methods
> You can see in the above the use of `{{tiddlername||Second}}`! here I can 
> transclude Second with tiddlername acting as a parameter for "Second" to use, 
> but I still want access to the callingTiddler in that transclusion and other 
> nested in "Second"
> I would love global a method to capture for subsequent use in transclusions 
> the current "Display Tiddler"/callingTiddler - ie the one on the screen 
> before transclusion, but as many of you know the currentTiddler changes 
> according to context so it can't be used.
> 
> Note: I went looking in the tiddler $:/config/ui/ViewTemplate to see how I 
> may set a displayTiddler value only to find the variable storyTiddler which 
> is functionally what I need. Though it does nothing to help me define a 
> variable that will store the current tiddler indefinitely.
> 
> Regards
> Tony
> 
> 
> -- 
> 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 tiddlywiki+unsubscr...@googlegroups.com 
> <mailto:tiddlywiki+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/79a27e56-918e-4431-9c12-f7cc83ff3e1c%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/79a27e56-918e-4431-9c12-f7cc83ff3e1c%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 tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/9D835C58-4D09-4E56-B199-7A9C8CB67690%40gmail.com.

Reply via email to