The first response is: Do you have to use comma separated lists for the
input instead of using the native tiddlywiki list format? Because if you
use the native format than you can just use normal filter operators.
The actual answer to your question is to put this in a tiddler with the tag
$:/tags/Macro then you can use the macro SplitCommaList:
\define InnerSplitCommaList()
<$list filter="""[<CurrentList>splitbefore[,]removesuffix[,]]"""
variable=CurrentItem emptyMessage="""<$link
to=<<CurrentList>>><<currentList>></$link>""">
<$link to=<<CurrentItem>>><<CurrentItem>></$link>
<$set name=CurrentList
filter='[<CurrentList>removeprefix<CurrentItem>removeprefix[,]]'
emptyValue=<<CurrentList>>>
<<InnerSplitCommaList>>
</$set>
</$list>
\end
\define SplitCommaList(list)
<$set name=CurrentList value="""$list$""">
<$set name=CurrentList filter='[<CurrentList>addsuffix[,]]'>
<<InnerSplitCommaList>>
</$set>
</$set>
\end
Usage:
Directly give the list:
`<<SplitCommaList """a,b,c""">>`
<<SplitCommaList """a,b,c""">>
Using a text reference:
`<<SplitCommaList {{!!field_with_comma_list}}>>`
<<SplitCommaList {{!!field_with_comma_list}}>>
the second set widget adds a comma to the end of the list because checking
to see if you are on the last item and there is no trailing comma is a pain
otherwise. This works with lists with and without trailing commas.
--
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tiddlywiki/8179a850-9024-4125-a6d7-96eeddf17a3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.