Mark/Mario,

Thanks for your demonstration of a method to pass a field/string into the 
template with the use of a delimiter. I like it, but perhaps not to use in 
this case. The reason? I wanted to know if there were an intrinsic way to 
do it, I could have used the fact to simplify what I was working on, so 
your method achieves the the detail but not the spirit. I realise now I 
should have added to my first post *I was wondering if there were a simple 
way to do this.*

In fact in someways I am trying to subvert the mechanism.

I did discover the Transclusion Variable 
<https://tiddlywiki.com/#transclusion%20Variable> `<<transclusion>> ` 

Which promises a possible method by parsing it in the transcluded tiddler

*For those interested in hacking*

I am looking at getting tricky here, if in a button I specify 
actions={{tiddlername||tiddlertemplate}} then in tiddlertemplate I am 
automatically constructing a tag name of $:/tags/tiddlername I can then 
transclude all tiddlers tagged with $:/tags/tiddlername. 

So if I wanted custom actions assigned to the close button I can add to the 
$:/core/ui/Buttons/close 
actions={{$:/core/ui/Buttons/close||$:/tags}}


   - This works, I am quite happy with it
   - I have added the tiddler $:/tags and this handles the "request" with 
   wikitext/macros (ie its the template)
   - The actions transcluded are the tiddlers tagged $:/tags/$:/core/ui/
   Buttons/close
   - Note: I need to provide the tiddler name $:/core/ui/Buttons/close because 
   it is different to the current tiddler in buttons


The original question in this thread "Field or text reference in template"
was to see if I could improve this to make the solution even more generic, 
perhaps using field name as a parameter to handle via transclusions;

   - Actions/transclude code
   - Transclude content
   - List tiddler titles
   - Provide key=value pairs and more

Mario

in regards to you approach

It is already possible to use {{anyname||templatename}} and make use of 
anyname in the logic within the template. This can in effect be a virtual 
tiddler title. However in this use case I must have access to the code 
tiddler title $:/core/ui/Buttons/close so I can determine the tagged 
tiddlers and transclude them. This I am forced to use the anyname to pass 
the button tiddler.

I am trying to avoid additional code in the button tiddler but I could set 
codeTiddler=$:/core/ui/Buttons/close and transclude with {{||$:/tags}} as 
you suggest, even {{parameter||$:/tags}} I think however perhaps 
\define codeTiddler() $:/core/ui/Buttons/close
would be better?

The reason I was asking about the field  was to see of I could do something 
like this {{$:/core/ui/Buttons/close!!parameter||$:/tags}} where parameter 
can be interrogated in the template.

Regards
Tony

On Tuesday, October 22, 2019 at 2:48:46 AM UTC+11, Mark S. wrote:
>
> Hi Tony,
>
> I think you would have to hack the parser if you wanted the field and 
> tiddler name to be available.
>
> But you can fake it now, if you're willing to forego !!
>
> Make a tiddler called "test" (must be called test or recursion error will 
> occur). Paste in:
>
> <$list filter="[<currentTiddler>] -[[test]] -[[Draft of 'test']]">
> <$set name=mytid filter="[<currentTiddler>split[--]]" select=0 >
> <$set name=myfield filter="[<currentTiddler>split[--]]" select=1 >
> <$tiddler tiddler=<<mytid>>>
> <$set name=test field=<<myfield>> tiddler=<<mytid>> >
> I see <<test>>.
> </$set>
> </$tiddler>
> </$set>
> </$set>
> </$list>
>
> Now you can use syntax like {{mytiddler--myfield||test}}
>
> -- was used because !! is already grabbed by the parser.
>
> Of course, at this point you might as well use a macro.
>
>
>
> On Monday, October 21, 2019 at 4:58:19 AM UTC-7, TonyM wrote:
>>
>> Mario
>>
>> thanks for the feedback. I am actually working on the button actions 
>> hackability we have discussed elsewhere. There seems a Great way to combine 
>> both our ideas.
>>
>> With your answer above Does that mean I must know the fieldname and set 
>> it to a variable, so that I can access the variable inside the template?
>>
>> I was wondering if template was transcluded by a random transclusion e.g. 
>> {{name!!field||template}} if we can extract the "field". Or will it only 
>> transclude name!!field?
>>
>> I ask because if I used {{name||template}}, inside the template the 
>> currentTiddler=name, so I can get the name, I am wondering about getting 
>> the "field".
>>
>> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a685d7da-edb9-4849-82b7-6ca41a742944%40googlegroups.com.

Reply via email to