I'm trying to create a macro that will format links based on an input
string. The label for the link, as well as its target, may or may not be
different from the input string itself.
This is my current attempt at such a macro:
\define current_assign(name, target)
<$list
filter="[tag[info_assignment]name[$name$]sort[begin]last[]get[$target$]]">
<$list filter="[<currentTiddler>listed[redirect]]"
emptyMessage="<<currentTiddler>>" variable="moose">
<$link to=<<moose>> >
<$macrocall $name="get_clean" input=<<currentTiddler>>/>
</$link>
</$list>
</$list>
\end
\define get_clean(input)
{{Dict_Clean!!$input$}}
\end
Works fine if I want to redirect the link and apply a new label, but if I
don't want to do one of those, or neither, this solution doesn't work.
I figured that the redirection problem was due to emptyMessage containing
only <<currentTiddler>>, so I tried changing the second list widget to a
set widget, as follows:
\define current_assign(name, target)
<$list
filter="[tag[info_assignment]name[$name$]sort[begin]last[]get[$target$]]">
<$set name="moose" filter="[<currentTiddler>listed[redirect]]"
emptyValue="<<currentTiddler>>">
<$link to=<<moose>> >
<$macrocall $name="get_clean" input=<<currentTiddler>>/>
</$link>
</$set>
</$list>
\end
Here's what's strange about this. If the tiddler fetched by
listed[redirect] has a space in it, the <$list> widget uses it just fine,
but the <$set> widget adds double square brackets around the title. I've
been unable to find a reliable way to strip the double brackets, and it
makes the process of applying a label to a link impossible.
I've tried using Tobias's setvars widget, same results as the set widget.
If anyone knows of some way to fix this, please let me know!
--
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/ec133d9d-8700-4c54-834b-a46569874265%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.