Variables in a filter

77 views
Skip to first unread message

AdamS

unread,
Jan 3, 2019, 6:59:16 AM1/3/19
to TiddlyWiki
Hi all,

I'm trying to do some drag n' drop nonsense and I'd like to be able to drag a list item and put it at the very end of the list. This is the macro I've got:

\define drop-at-end()
<$action-listops $tiddler="$:/StoryList" $subfilter="+[remove<actionTiddler>]"/>
<$action-listops $tiddler="$:/StoryList" $subfilter="+[append<actionTiddler>]"/>
\end

This works great if the actionTiddler has no whitespace in it (something like "NewTiddler"). But if it is something like "New Tiddler", then this code will add "New" and "Tiddler" to the end of the list. This seems to be because both remove and append take lists as input.

I've tried to find a way to add [[...]] to the variable, but without success. And I haven't had a whole lot of success understanding the wikitext documentation. Sometimes I see syntax like {{{...}}} or $...$ or "..." or even stranger stuff. But I can't figure out what these kinds of syntax do? Could someone explain these things to me? Or point me to some documentation that will explain them?

Best wishes,

Adam







AdamS

unread,
Jan 3, 2019, 2:37:10 PM1/3/19
to TiddlyWiki
 Now I'm trying:

\define drop-at-end()
<$set name="action" value="[<actionTiddler>]">
<$action-listops $tiddler="$:/StoryList" $subfilter="+[remove<action>]"/>
<$action-listops $tiddler="$:/StoryList" $subfilter="+[append<action>]"/>
</$set>
\end

But for some reason, still not working. Now, regardless of whether the title has whitespace, I get [<actionTiddler>]. Not sure what else to try.
Has anyone done anything like this before who can point me in the right direction?

Best wishes,

Adam

Mark S.

unread,
Jan 3, 2019, 6:00:47 PM1/3/19
to TiddlyWiki
Remove and append both expect a LIST of things. So when you give it a single item with spaces it interprets that as a list.

Try:

\define drop-at-end()
<$action-listops $tiddler="$:/StoryList" $subfilter="-[<actionTiddler>]"/>
<$action-listops $tiddler="$:/StoryList" $subfilter="[<actionTiddler>]"/>
\end

Have fun!
-- Mark

AdamS

unread,
Jan 3, 2019, 6:35:31 PM1/3/19
to TiddlyWiki
Thank you, Mark!

That did it. I knew there would be some simple solution. I just couldn't imagine how simple!
Still coming to grips with the basic syntax, particularly when it comes to filters.
Thanks again for your help.

Best wishes,

Adam
Reply all
Reply to author
Forward
0 new messages