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.

As far as I have seen, only the "regexp" filter can be used.

Here is my code. I try to replace "excluding" argument by "rejecting" 
variable in order to get things done. The "NO" and "YES" are juste here to 
help going quick with the results.

\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

In a tiddler named "choix des critères du thème 5" I have the following 
code:

<$set name=beg value="choix des critères du ">
<$set name=theme2 filter="[{!!title}removeprefix<beg>]">
<$wikify name=theme text=<<theme2>>>
<$macrocall $name=itemlist2 tag=<<theme-label>> field=criterion 
excluding=<<theme>>/>
</$wikify></$wikify>
</$set></$set>

and I get 

tag=tableaux, field=criterion, excluding=thème 5, rejecting=NO tableaux.

instead of

tag=tableaux, field=criterion, excluding=thème 5, rejecting=YES thème 5

Note as a side question that I had to use theme2 and theme to get the pure 
text "thème 5" because theme2 would be a link!!! Why so ???

I have tried other regexp in my code, with eventually a negative logic. At 
first, I would have thought that

regexp[^$]

would target only an empty string. but the overall result is the same. In 
fact, my problem is really a problem of filtering empty strings.



-- 
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/5298c754-d633-4c1d-a30b-e3cf6fc8f1abn%40googlegroups.com.

Reply via email to