On Friday, April 15, 2016 at 6:18:19 AM UTC-7, Martian wrote:
>
> Hello!
> I am trying just to generate link as [[LinkText|some text+{{!!code}}]]
> and nothing of following doesn't work
>
Try this:
\define makelink(text,prefix,link)
[[$text$|$prefix$$link$]]
\end
<$macrocall $name="makelink" text="LinkText" prefix="prefix" link={{!!code}}
/>
Some feedback on your attempts:
\define getfoo(title=<<current>>)
> {{foo1!!code}}
> \end
>
* <<current>> is not a pre-defined variable, so it has no assigned value.
The TWCore sets <<currentTiddler>> to title of the current tiddler.
Perhaps that is the variable you were thinking of
* The syntax for defaults for macro params is paramname:value (not
paramname=value) and only accepts literal values surrounded by delimiters
using single-quotes ('foo'), double-quotes ("foo"), doubled square brackets
([[foo]]), or tripled double quotes ("""foo"""). You can't use a reference
to another variable (or a transcluded field value).
* You declare the 'title' param, but never *use* it in the macro
definition, so it's not clear what you intend to use it for.
test <<getfoo>>
>
* invoking <<getfoo>> here returns "{{foo1!!code}}", which is then rendered
as a transclusion, displaying the value in the specified field
[[{{foo1!!code}}]]
> [[<<getfoo>>]]
>
* you can't use transclusion or variable/macro invocation *within* the link
syntax.
> <$link to=<<getfoo>> >Link Text</$link>
>
* the macro returns "{{foo1!!code}}" and is not recursively re-parsed to
retrieve the value contained in that field. Thus, you are linking to a
tiddler whose title is literally "{{foo1!!code}}".. which, is very likely
NOT what you intended.
<$link to={{foo1!!code}}>Link Text</$link>
>
* This will work... but only links a tiddler whose title is the value in
the field, without adding your desired title prefix (e.g., "sometext-"
<$link to=<$transclude field="code/> >Link Text</$link>
>
>
* You cannot invoke a widget to assign a value to a macro param. Widgets
generate/render output. They do not return values.
Hope this helps,
enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios
--
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/904ca001-c750-434a-a25f-0c51d7ce2ef1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.