I put in a pull request to update the variables in wikitext tiddler that 
adds examples of when $(name)$ <<name>> and <name> are used. 

>From what I understand you use $(var)$ when you set a variable outside of a 
macro and then use that variable in the macro and <<var>> is for setting a 
variable and using it outside a macro. In both of these cases adding quotes 
returns the variable value surrounded by quotes. so 

<$set name='var' value='someValue'>
<<var>> "<<var>>"
</$set>

gives: someValue "someValue". <<var>> acts the same inside a macro as 
outside, and if the value is set as a filter it can be used as a filter.

<var> in wikitext it parsed as an html tag from what I can tell, so it 
breaks things and doesn't display as anything. Adding quotes ("<var>") is 
the same as putting quotes around any tag where it displays quotes.

Variable names called by $var$ and "$var$" are just strings so they are 
displayed like any other string without any substitution, inside or outside 
a macro.

In [[<var>]], <var> is treated as a string, so that would create a link to 
a tiddler with the title <var>

The times when <var> DOES work is in a situation like this:

<$set name='var' value='someTag'>
<$list filter='[tag<var>]'/>
</$set>

which lists tiddlers tagged with someTag. This should work inside or 
outside a macro. Using '[tag[$(var)$]]' as a filter anywhere gives the 
tiddlers that are tagged with $(var)$ without any substitution.

As for parameters passed to a macro the only options you have that are not 
treated as strings (so no substitution, and [[<param>]] links to the 
tiddler with title <param>) are $param$ and "$param$" in both cases the 
input is substituted for $param$ without any weirdness.
So

\define macroThing(param)
[[$param$]]
\end

<<macroThing HelloThere>>

displays a link to the tiddler HelloThere.

I think that a significant amount of weirdness comes in when you have 
things like this: 
<$set name='someVar' value={{!!title}}>

Where "<<someVar>>" gives "HelloThere" if you are in the HelloThere 
tiddler, but calling a macro with <<macroName "<<someVar>>">> gets parsed 
as calling macroName with the input "<<someVar treated as a string. This is 
why you use $(someVar)$ inside the macro to reference the variable.
Passing something like {{!!title}} as the input to a macro can be strange 
because in that case it isn't evaluated, it is straight text substitution.

So this code:

\define someMacro(input)
<$list filter='[tag[$input$]]'/>
\end

<<someMacro {{!!title}}>>

returns a list of tiddlers tagged {{!!title}} with no substitution, but if 
you use this

\define someMacro()
<$list filter='[tag[$(input)$]]'/>
\end

<$set name='input' value={{!!title}}>
<<someMacro>>
</$set>

 you get a list of all tiddlers tagged with the current tiddler.

I am not sure if any of that made sense, but I am pretty sure it is all 
correct.

On Tuesday, November 18, 2014 12:32:02 PM UTC-7, Tobias Beer wrote:
>
> Is there any way on how to achieve something like this...
>
> <$link to="*$:/language/Docs/Fields/{{!!title}}*">{{!!title}}</$link>
>
> ?
>
> 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 http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to