On Wednesday, July 22, 2015 at 7:35:10 AM UTC-7, Mat wrote:
>
> How does one concatenate a string and a calculated value (e.g a macro or a 
> transclusion)?
>
> For example this doesn't work:
>
> <$set name="url" value="http://foo.com/#:";<<currentTiddler>>>
>
> <$set name="url" value=http://foo.com/#:<<currentTiddler>>>
>
> <$set name="url" value="http://foo.com/#:<<currentTiddler>>">
>
>
> Doc on the setwidget <http://tiddlywiki.com/#SetWidget>doesn't make this 
> clear. Nor does other places (ex 
> <http://tobibeer.github.io/tb5/#Variables%20vs.%20Parameters>). The issue 
> is of course not specific for the setwidget but it is a bit ironic 
> specifically for the setwidget as this, from what I understand, is used for 
> avoiding these difficulties.
>

The $set widget only *stores* the value specified, it doesn't know how to 
assemble values from individual parts.  That's what macros are for: 
assembling and returning compound text strings.

To accomplish your goal, you can define a macro to concatenate the current 
tiddler title to the end of the string, and then assign the result using 
the $set widget.

Something like this:
\define makeurl(u) $u$$currentTiddler$
<$set name="url" value=<<makeurl "http://foo.com/#:";>>>
...
</$set>

-e

-- 
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 tiddlywiki+unsubscr...@googlegroups.com.
To post to this group, send email to tiddlywiki@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/a7be2558-acaf-407c-a447-81bf4dc34af6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to