<$set name="last" filter="[{!!title}removeprefix[jingle ]]" 
select="0"><<last>></$set>  

When assigning the value of a set widget via a filter, it is important to 
note that the value is a title list and not a title.
In a title list, tiddler titles with spaces are enclosed in double brackets.

https://tiddlywiki.com/#SetWidget
Please see the section Filtered List Variable Assignment

Filtered List Variable Assignment

This form of the set variable widget evaluates the filter and assigns the 
result to the variable as a space-separated list (using double square 
brackets for titles containing spaces).
<$set name="myVariable" filter="[tag[HelloThere]]"> <$text 
text=<<myVariable>>/> </$set>Filtered Item Variable Assignment

 NEW IN: 5.1.14 This form of the set variable widget evaluates the filter 
and assigns the specified result to the variable as a single item (ie, not 
using double square brackets for titles containing spaces).
<$set name="myVariable" filter="[tag[HelloThere]]" select="0"> <$text 
text=<<myVariable>>/> </$set>  

and https://tiddlywiki.com/#Title%20List

On Wednesday, December 2, 2020 at 12:23:40 PM UTC+1 [email protected] 
wrote:

> Further investigating: the difference lies in the title and what you 
> finally get. If you're left with a single word, then you get a simple text. 
> If you have any space, then it's a link.
>
> thus the following code 
>
> <$set name="last" filter="[{!!title}removeprefix[jingle ]]"><<last>></$set>
>
> will produce a "bells" simple text in the "jingle bells" tiddler BUT a 
> "bells song" link in a "jingle bells song" tiddler.
>
> Le mercredi 2 décembre 2020 à 12:14:19 UTC+1, Jean-Pierre Rivière a écrit :
>
>> a typo in my code : theme3=<<<theme3>> instead of theme3=<<theme3>>
>> with that fix, I can see theme3 as a simple text, "thème 5" in the result 
>> line beginning by bag=
>>
>> as for the code with removeprefix, it works OK in an other tiddler. But 
>> here, it keeps being dizzy. the tiddler types are all set to tw5. any idea 
>> to spot the cause of this?
>>
>> Le mercredi 2 décembre 2020 à 11:36:18 UTC+1, Jean-Pierre Rivière a 
>> écrit :
>>
>>> @Eric. Tahnk you! It does the trick but... not so much as I wanted. see 
>>> the output I get:
>>>
>>> [image: unwanted-link.png]
>>>
>>> "thème 5" is indeed the tittle of an existing tiddler.
>>>
>>> What I am looking for is only the text "thème 5", not the link to "thème 
>>> 5".
>>>
>>> Now, I know how to use $wikify to acieve that goal with the current 
>>> linking result. But what I don't understand is why I got this linking in 
>>> the first place!
>>>
>>> my code (same as yours):
>>>
>>> \define itemlist2(tag:"thème", field:"theme", excluding)
>>> <$set name="rejecting" 
>>> filter="[[$excluding$]!match[]then[$excluding$]else[$tag$]]">
>>> tag=$tag$, field=$field$, excluding=$excluding$, rejecting=<<rejecting>>.
>>> </$set>
>>> \end
>>>
>>> and my using that code (to get the picture above) in tiddler "choix des 
>>> critères du thème 5"
>>>
>>> <$set name=beg value="choix des critères du ">
>>> <$set name=theme2 filter="[{!!title}removeprefix<beg>]">
>>> <$wikify name=theme3 text="<<theme2>>">
>>> <$wikify name="theme-label" text="""<$transclude tiddler=<<theme3>> 
>>> field=theme/>""">
>>> beg=<<beg>> theme2=<<theme2>> theme3=<<<theme3>> 
>>> theme-label=<<theme-label>><br>
>>> <$macrocall $name=itemlist2 tag=<<theme-label>> field=criterion 
>>> excluding=<<theme3>>/>
>>> </$wikify></$wikify>
>>> </$set></$set>
>>>
>>> And I get also this line:
>>>
>>> [image: unwanted-link2.png]
>>>
>>> (where I neither understand why theme2 is a link and theme3 is void)
>>>
>>>
>>> Le mardi 1 décembre 2020 à 21:24:39 UTC+1, Eric Shulman a écrit :
>>>
>>>> On Tuesday, December 1, 2020 at 12:09:38 PM UTC-8 [email protected] 
>>>> wrote:
>>>>
>>>>> I am writing a macro with three parameters. If omitted, the third 
>>>>> shall be equal to the first one. This cannot be hardwired of course! So I 
>>>>> need to code it. With a filter.
>>>>
>>>> \define itemlist2(tag:"thème", field:"theme", excluding)
>>>>> <$set name="rejecting" filter="[$excluding$]+[regexp[^.]then[YES 
>>>>> $excluding$]else[NO $tag$]]">
>>>>> tag=$tag$, field=$field$, excluding=$excluding$, 
>>>>> rejecting=<<rejecting>>.<br>
>>>>> </$set>
>>>>> \end
>>>>>
>>>>
>>>> Try using the !match[...] filter, like this:
>>>> \define itemlist2(tag:"thème", field:"theme", excluding)
>>>> <$set name="rejecting" filter="[[$excluding$]!match[]then[$excluding
>>>> $]else[$tag$]]">
>>>> tag=$tag$, field=$field$, excluding=$excluding$, 
>>>> rejecting=<<rejecting>>.<br>
>>>> </$set>
>>>> \end
>>>>
>>>> -e
>>>>
>>>

-- 
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/1c9f11ea-18fe-4c79-9ba5-f21b6edad429n%40googlegroups.com.

Reply via email to