Hi Stephan,

thanks for the tip on using a data tiddler for the domains. I tried using 
your code, but it does not output the domain either when I place it in my 
file. The one more level of evaluation is what I was trying to get to by 
using what I described as "macro helper". So I changed the template call 
from {{!!myTemplate}} to {{||myTemplate}}.

Even in the template itself if I add the fields, it only outputs "
https://sampleserver./sample/path.html"; and not "
https://sampleserver.domA.com/sample/path.html 
<https://sampleserver./sample/path.html>"

Can you explain a little more about the $(dom)$ syntax? I only see it in 
the "Getting Started" tiddler of tiddlywiki.com 
(http://tiddlywiki.com/static/GettingStarted.html), but can't see as part 
of the documentation.

Also, I'd like to understand where my thinking is wrong about using 
{{!!domain}}. The documentation says "(...)transcluded content behaves as 
if it were in the context of the transcluding tiddler". So if the 
implementation I attempted works within the tiddler titled "Yet, the 
following works:", and if the template does not alter the context of the 
currnet tiddler, why does it not work when I'm using the template. Or put 
in a different way, when would one want {{!!domain}} to output 
"{{!!domain}}" instead of the transcluded content. Why is the transclusion 
not cascading?

Thanks for anything you can share with me that will bring my comprehension 
to the next level.

Regards,
Robert Naud

On Friday, September 19, 2014 4:07:27 AM UTC-4, Stephan Hradek wrote:
>
> The problem is: You need one more level of evaluation. Additionally I 
> suggest to change your logic a bit.
>
> Why not create a tiddler "MyDomains" (or "$:/MyDomains") as a data tiddlre 
> like so:
>
> domain1:domA.com
> domain2:domB.com
>
> And then in the server tiddler simply name the domain name - don't use 
> transclusion syntax:
>
> title:MySertver
> text:{{!!myTemplate}}
> domain:domain1
> server:sampleserver
>
> and this would be the mytemplate (with local macros for illustration)
>
> \define link(protocol, server, path)
> $protocol$$server$.$(dom)$$path$
> \end
>
> \define build(protocol:"http://";, server, domain, path)
> <$set name="dom" value={{MyDomains##$domain$}}>
> <$macrocall $name="link" protocol="$protocol$" server="$server$" path=
> "$path$"/>
> </$set>
> \end
>
> <$macrocall $name="build" protocol="https://"; domain={{!!domain}} 
> server={{!!server}} path="/sample/path.html"/>
>
>
> In "build" we first have one evaluation, setting the variable "dom" to the 
> value stored in "MyDomains" under the index whose value we take from the 
> field "domain".
>
> In "link" we simply concatenate.
>

-- 
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