A widget is a kind of super power html tag. So #1 won't work because you 
can't embed an html tag inside of an html tag.

#2 ... sorta kinda ought to work. But I avoid using <<>> macro notation 
with a parameter because so often it doesn't. I think it's because it wants 
and expects an actual string as the parameter, not an object to be rendered.

Transclusions and (plain) macros do get rendered inside of widgets before 
being used by the widget.

So, I think this variation should work:

\define atomfeed(burl)<a href="""$burl$""">[img[MY_IMG]]</a>
          <$macrocall $name=atomfeed burl={{dt##baseurl}} />

Good luck!
-- Mark

On Monday, August 6, 2018 at 1:25:31 PM UTC-7, R Zhao wrote:
>
> Hi guys,
>
> I'm a little new to tiddlywiki, and find some functionalities don't work 
> as I thought, including macro call and transclusion.
>
> The background is that I have a DataTiddler, which stores the baseurl of 
> the site (when published); let's call this `dt##baseurl`. I have a feed 
> plugin installed to generate atom feed, under `/atom.xml`, relative to the 
> baseurl. (Some may suspect I intend to make this site like a blog, and you 
> are right.)
>
> When I need to concatenate these two pieces of text together, as mentioned 
> elsewhere (e.g. official site), I need to use a helper macro to establish 
> the real concatenation of transclusion and string literal. (But I still 
> don't know why... Is this because of the processing engine's execution 
> order / lifecycle?)
> I succeeded to do this when using text as the visible content, through 
> `[[$text$|$baseurl$/atom.xml]]`.
>
> However, when I want to create a image which links to the atom feed, I 
> find no solution.
> I have to use `<a href=... >[img[MY_IMG]]</a>` for this to work 
> (LinkWidget will link to tiddler only; `[[]]` syntax only works on text). 
> But if I apply the previous trick, neither of the follow methods work.
>
> Method 1:
>
> ```
>   \define atomfeed(burl) $burl$/atom.xml
>   <a href=<$macrocall $name=atomfeed burl={{dt##baseurl}} 
> />>[img[MY_IMG]]</a>
> ```
>
> The $macrocall widget won't really work, and the resulting line is broken. 
> I guess this is because of the `/>`.
>
> Method 2:
>
> ```
>   \define atomfeed(burl) $burl$/atom.xml
>   <a href=<<atomfeed {{dt##baseurl}}>>>[img[MY_IMG]]</a>
> ```
>
> The macro will be evaluated, but the transclusion won't, resulting in a 
> link to "{{dt##baseurl}}/atom.xml".
>
> Method 3:
>
> ```
>   \define atomfeed(burl) $burl$/atom.xml
>   \define wrapatomfeed() <$macrocall $name=atomfeed burl={{dt##baseurl}} />
>   <a href=<<wrapatomfeed>>>[img[MY_IMG]]</a>
> ```
>
> The macro will be evaluated once, but the second macrocall won't be 
> evaluated at all.
>
>
> I also tried a few other combinations of these methods (e.g. replace the 
> 3rd method's wrap macro content to `<< >>`), but none of them worked.
> Anyone has any ideas?
>

-- 
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/55018533-ac80-40a0-9f16-adb0b3ed159f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to