Went jogging this morning and came back with another nice idea.

Now, as of version 0.5.7 
<https://github.com/tobibeer/tw5-setvars/releases/tag/0.5.7> of 
tobibeer/setvars <http://tobibeer.github.io/tw5-plugins/#setvars>,
you can refer to variables previously declared in the same setvars widget 
instance.

Get the update from the usual place:

http://tobibeer.github.io/tw5-plugins/#setvars

Here's a macro that shows how that works:

*This macro routes a link to tiddlywiki.com should there not be a local 
tiddler by that name while also allowing you to use a pretty title:*


\define route(title,pretty)
<$setvars
_exists="[[$title$]is[tiddler]]"
_not="[[$title$]!is[tiddler]]"
title="if( \$pretty$\ ? \$pretty$\ ) || \$title$\"
link="
if( [exists] ? \[[\title\|$title$]]\ ) ||
if( [not] ? \[ext[\title\|http://tiddlywiki.com#$title$]]\ )">
<<link>>
</$setvars>
\end


*Note: *Notice how the link variable refers to the title variable declared 
before it!

<<route TextReferences "text-reference">>

text-reference <http://tiddlywiki.com/#TextReferences>

Best wishes,

Tobias.

-- 
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/85d4b6a3-5b96-4920-aae5-d30840efcb95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to