As explained in official docs, one can use core variables to modify the generated href
by wikilink.
For example see the nice toolbar button to add a Google calendar event by @vilc here
Button to create Google Calendar event based on the current tiddler - Tips & Tricks - Talk TW (tiddlywiki.org)
The code contains an <a>
inside a button.
<$button tooltip={{$:/wilk/buttons/add-to-calendar!!description}} class=<<tv-config-toolbar-class>> actions=<<.addToCalendarActions>> >
<a href={{{
[[https://calendar.google.com/calendar/r/eventedit]]
=[[?text=]]
=[<currentTiddler>encodeuricomponent[]]
=[[&details=]]
=[{$:/info/url/full}append[#]encodeuricomponent[]]
=[<currentTiddler>encodeuricomponent[]encodeuricomponent[]]
=[[&dates=]append<now YYYY0MM0DD>append[/]append<now YYYY0MM0DD>]
+[join[]]
}}} target="_blank">
<$list filter="[<tv-config-toolbar-icons>match[yes]]">{{$:/core/images/new-journal-button|1em|G}}</$list>
<$list filter="[<tv-config-toolbar-text>match[yes]]"><span class=tc-btn-text>Add to calendar</span></$list>
</a>
</$button>
As explained in doc https://tiddlywiki.com/#tv-wikilink-template%20Variable one can control what is generated for href
using tv-wikilink-template
for example
\define tv-wikilink-template() ../tiddlers/$uri_encoded$.html
So, I thought one can use something like
\whitespace trim
\function uri_encoded()
[[https://calendar.google.com/calendar/r/eventedit]]
=[[?text=]]
=[<currentTiddler>encodeuricomponent[]]
=[[&details=]]
=[{$:/info/url/full}append[#]encodeuricomponent[]]
=[<currentTiddler>encodeuricomponent[]encodeuricomponent[]]
=[[&dates=]append<now YYYY0MM0DD>append[/]append<now YYYY0MM0DD>]
+[join[]]
\end
\define tv-wikilink-template() $uri_encoded$
\procedure addToCalendarActions()
<$fieldmangler>
<$action-sendmessage $message="tm-add-tag" $param="In calendar"/>
</$fieldmangler>
\end
<$button tooltip={{!!description}} class=<<tv-config-toolbar-class>> actions=<<addToCalendarActions>> to=<<currentTiddler>> >
<$list filter="[<tv-config-toolbar-icons>match[yes]]">{{images/google-calendar}}</$list>
<$list filter="[<tv-config-toolbar-text>match[yes]]"><span class=tc-btn-text>Add to calendar</span></$list>
</$button>
Here I have used the button to=<<currentTiddler>>
and overwritten the uri_encoded
.
This does not work. I am not sure the function definition is not allowed or the $uri_encoded$
refer to something else.
Question How to use tv-wikilink-template
to generate the href like above (where it opens Google Calender, or Gmail) to be used for wikilink by to=
button attribute?
NOTE: Why not directly use the anchor link? Because toolbar uses buttons, and I want to have active button for processing current tiddler content and send to external webpage like Google Gmail, Google Calendar, …