Hi,

Sorry I overlooked the need to interpret the currentTiddler variable. In
this situation, you need to read your field as a filter rather than a list.
Two main ways of doing that:

   1. Either you put your button code in a macro so that the $(currentTiddler)$
   construct is actually replaced by the title of the current tiddler. Then
   you can use the subfilter operator, as in :
   \define mybutton()
   <$button type="button" class=<<BUTTON-COLOR+SIZE>>>
   <$set name=mytags filter="[subfilter{!!tiddler-tag}]">
   <$action-sendmessage $message="tm-new-tiddler"
   title=<<TIDDLER-TITLE>>
   text=<<TIDDLER-TEMPLATE>>
   tags=<<mytags>>/>
   </$set>
   <span style=<<BUTTON-TEXT-COLOR>>><<BUTTON-NAME>></span>
   </$button>
   \end
   <<mybutton>>
   2. Or you can just replace [[$(currentTiddler)$]] with
   [<currentTiddler>] in your field content.  Like so :
   <$set name=mytags filter="[subfilter{!!tiddler-tag}]">
   <$action-sendmessage $message="tm-new-tiddler"
   title=<<TIDDLER-TITLE>>
   text=<<TIDDLER-TEMPLATE>>
   tags=<<mytags>>/>
   </$set>

Cheers,
-- Xavier


On Sat, Jan 2, 2021 at 6:01 PM [email protected] <[email protected]>
wrote:

> Thank you Xavier,
>
> Can you tell me how to paste this piece of code into the existing code?
> For some reason I am not getting it working.
>
> Op zaterdag 2 januari 2021 om 17:19:56 UTC+1 schreef Xavier:
>
>> Hi,
>>
>> Since the tags field is of the list type, you need to retrieve its
>> content either directly from another list-typed field (that is list or
>> tags), or indirectly by transforming the string content into a list.
>>
>> In your example, you may achieve this by first setting a variable to a
>> filter that converts the content of your tiddler-tag field into a list :
>>
>> <$set name=mytags filter="[enlist{!!tiddler-tag}]">
>> <$action-sendmessage $message="tm-new-tiddler"
>> title=<<TIDDLER-TITLE>>
>> text=<<TIDDLER-TEMPLATE>>
>> tags=<<mytags>>/>
>> </$set>
>>
>> Note the use of the enlist operator to transform a string into a list.
>> 5.1.23 just introduced the enlist-input operator, which is handy in
>> situations where your initial string comes from a previous filter
>> expression.
>>
>> Cheers,
>> -- Xavier
>>
>>
>> On Sat, Jan 2, 2021 at 3:52 PM [email protected] <[email protected]>
>> wrote:
>>
>>> Hello,
>>>
>>> I have a button to create a new tiddler.
>>> With    \define TAGS() [[$(currentTiddler)$]] [[Tag 2]] [[Tag 3]],  I
>>> can tag the new tiddler.
>>>
>>>
>>> \define BUTTON-NAME() Enter >
>>> \define BUTTON-COLOR+SIZE() btn btn-link btn-sm
>>> \define BUTTON-TEXT-COLOR() color:
>>> \define TIDDLER-TITLE() $(currentTiddler)$ ENTER-SPECIFIC-HERE
>>> \define TIDDLER-TAGS() [[$(currentTiddler)$]]
>>> \define TIDDLER-TEMPLATE() {{||$(currentTiddler)$-SPECIFIC-TEMPLATE}}
>>>
>>> <$button type="button" class=<<BUTTON-COLOR+SIZE>>>
>>> <$action-sendmessage $message="tm-new-tiddler"
>>> title=<<TIDDLER-TITLE>>
>>> text=<<TIDDLER-TEMPLATE>>
>>> tags=<<TIDDLER-TAGS>>
>>> />
>>> <span style=<<BUTTON-TEXT-COLOR>>><<BUTTON-NAME>></span>
>>> </$button>
>>>
>>>
>>> What I want is for the button to read the tags from a field;
>>> tags={{!!tiddler-tag}}
>>>
>>> My problem is that [[$(currentTiddler)$]] in a field doesn't work.
>>>
>>> How do I make this work?
>>> Thank you,
>>>
>>> --
>>> 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/b46bc104-7460-4e0a-9463-b7f90ecc6b85n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/tiddlywiki/b46bc104-7460-4e0a-9463-b7f90ecc6b85n%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/d93bb1c3-1fa8-4cd1-8915-3dbe390c730dn%40googlegroups.com
> <https://groups.google.com/d/msgid/tiddlywiki/d93bb1c3-1fa8-4cd1-8915-3dbe390c730dn%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/CADeSwYMRf890otkbk7aAejyVR-ZCuw9M42OmzAD89pGx35AnjQ%40mail.gmail.com.

Reply via email to