On Saturday, March 18, 2017 at 9:38:21 PM UTC-7, Dave wrote:
>
> I would like to have a macro like this
> \define notes(side)
> <$edit-text tiddler="notesInFields" field="<<currentTiddler>>.$side$" >
> \end
> that refers to a fieldname that combines the current tiddlers title with a
> variable provided by the macro where its called
> So in this case I could have <<notes left>> in a tiddler named "Foo" and
> it would keep the text that's written in the text box in a field called
> "Foo.left"
> As its written, however, the actual field name is
> "<<currentTiddler>>.left".
> I tried without quotes, and using variations with the wikify widget, and
> also using {{brackets}} but am not having success.
>
Try this:
<$edit-text tiddler="notesInFields" field="$(currentTiddler)$.$side$" >
Within a macro definition, all instances of $var$ are replaced with the
corresponding values *passed into the macro as parameters*. Similiarly,
all instances of $(var)$ are replaced with corresponding values of
*variables that are already defined outside the macro*.
Thus, in the above line, the $(currentTiddler)$ value is replaced with the
actual name of the tiddler (e.g., "Foo"), and the $side$ param is replaced
by whatever is passed in. After the text substitutions are done, the full
syntax is then "returned" for parsing. Thus, the syntax
... field="$(currentTiddler)$.$side$"
is actually turned into
... field="Foo.left"
before other processing is performed, giving you the results you want.
enjoy,
-e
Eric Shulman
TiddlyTools: "Small Tools for Big Ideas" (tm)
InsideTiddlyWiki: The Missing Manuals
--
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/79113698-c19d-447d-82f5-3806032adbf1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.