Hi Mat, 

I know this is an old thread but I just wanted to add my solution.

If you only want to concatenate variables, macros and literals (but no 
transclusions), you can use the following technique, which allows you to 
dynamically concatenate strings without having to specifiy the 
concatination in the concat macro itself:

\define concat(str) $str$

<<concat "Hi my name is $(currentTiddler)$ I like TW $(version)$.">>

This technique makes use of TW's ability to parameterize variable calls.

*The trick is to inject the whole macro body as string.*

So we refer to variables and macros via

$(…)$ 

notation and embedd everything in a single string that is then passed to 
the concat macro as param. This has a huge advantage over hardcoding the 
macro body.

<$set name="url" value=<<concat "http://foo.com/# <http://foo.com/#>
:$(currentTiddler)$">>>
<$set name="url" value=<<concat "http://foo.com/# 
<http://foo.com/#>:$(currentTiddler)$ 
Hello world $(version)$">>>

You see the advantage? you can use the same single concat macro for several 
dynamic concatination tasks

-Felix

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/e0b361fc-8949-418e-9eb5-63b7d500d25b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to