On Thursday, June 4, 2020 at 11:35:01 AM UTC-7, Faber wrote:
>
> I'm searching for a smart way to obtain multiple link ready to click, 
> based on tiddler current title, like this example:
> https://www.google.com?q=tiddler title+other+string
> https://www.google.com?q=tiddler title+another+term
> https://www.google.com?q=tiddler title+term3
> https://www.google.com?q=tiddler title+term4
>

This might help get you in the right direction:
\define google(term)
<a href={{{ [[https://www.google.com?q=$(currentTiddler)$+$term$]split[ 
]join[+]] }}} target="_blank">$term$</a>
\end

How it works:
* To create the "href" value of the link, an "inline filter" is used to 
combine bits of static text with TW macro replacement syntax.
* Within a macro, the $(...)$ syntax is replaced by the value of the 
*variable* referenced between the parentheses.
* The variable has to be defined OUTSIDE the macro, in the calling 
context.  Fortunately, the "currentTiddler" variable is automatically 
defined by the TWCore and is always set to the title of the tiddler in 
which the macro output is being rendered.
* Within a macro, the $...$ syntax is replaced by the value of the *macro 
parameter* referenced between the dollar signs.
* The parameter is passed as quoted text when the macro is called.
* Note that a link to a google search term requires that all spaces have to 
be replaced with "+" characters.

To use it:
* Place the above code into a tiddler, and tag that tiddler with 
"$:/tags/Macro".  This will make the macro "global" so it can be used in 
other tiddlers.
* Then, in any tiddler (e.g., "Some Tiddler"), write something like this:
<<google "find this text">>
* The macro output will be an HTML link like this:
<a href="https://www.google.com?q=Some+Tiddler+find+this+text"; target=
"_blank">find this text</a>

Let me know how it goes...

enjoy,
-e

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/f21aa602-37b1-4cbc-8e30-011b26d34726o%40googlegroups.com.

Reply via email to