Tiddlywiki is really twisting my brain again. I'm trying to make a one-click image exporter. At first I tried to do it by decoding the base64 tiddlers myself, using a javascript macro - I seemed to get something that was almost, but not quite, the right encoding... as I was reading for possible fixes, I hit on the idea of just using an HTML <a> element with the download attribute set to the title of the tiddler and the href set with the datauri macro.
This didn't work. As far as I can tell the crux of the problem is that content inside html tags is not wikified, so for example;
\define MyMacro(text)
this is hurting my $text$
<$set name="test" value="yo">
<<test>>
</$set>
\end
<a href=<<MyMacro "Brain">>><<MyMacro "Brain">></a>
The content of the a tag is set correctly ("this is hurting my brain yo") but the target of the link isn't wikified in the same way.
I think this is because the macro itself only performs variable substitution and relies on being returned into a context where wikification occurs. So, I can do this;
\define MyMacro(text)
this is hurting my $text$ $(test)$
\end
<$set name="test" value="yo">
<a href=<<MyMacro "Brain">>><<MyMacro "Brain">></a>
</$set>
And it works fine.
But when I try to "assign" the output of the datauri macro to a variable, so that I can use it like this, the result is ultimately never wikified
\define thisDataUri()
$(thisDataUri)$
\end
\define MyMacro(text)
<a href=<<thisDataUri>>>yo</a>
\end
\define MyOtherMacro()
{{!!title}}
\end
<$set name="thisDataUri" value=<<datauri [[Introduction Video Thumbnail.jpg]]>>>
<$set name="test" value="yo">
<<MyMacro>>
<<thisDataUri>>
</$set>
</$set>
I have tried lots of different ways to solve this problem and now I'm spinning in circles a bit. It seemed that I should be able to use the macrocall widget to get around it but this can't be used as a parameter to another widget or macro, can it?
I'm left feeling like there is some core concept I'm still not understanding - can anybody offer any advice?
Regards,
Richard