On Sunday, September 20, 2020 at 3:30:48 PM UTC-7, Jean-Pierre Rivière wrote: > > I want to generate URL. The aim would be to generate something like that: > [[G8|https://www.w3.org/WAI/WCAG21/Techniques/general/G8]] > [[H96|https://www.w3.org/WAI/WCAG21/Techniques/html/H96]] > with G8 or H96 a input. >
Here's one way to make your code work: \define wcagTechUrl(ref) <$set name="place01" filter="[[$ref$]prefix[G]then[general]]"> <$set name="place02" filter="[[$ref$]prefix[H]then[html]]"> <$set name="url" filter="[[https://www.w3.org/WAI/WCAG21/Techniques/]] [<place01>] [<place02>] [[/$ref$]] +[join[]]"> <<wcagTechUrl_makelink "$ref$">> </$set></$set></$set> \end \define wcagTechUrl_makelink(ref) [[$ref$|$(url)$]] which can be invoked like this: <<wcagTechUrl G8>> Note the brackets used in the filter expressions: [[...]] surrounds literal text, and [<...>] surrounds variables. Note also the makelink() helper macro to construct the "pretty link" wikitext output. You could also write the filter using "addsuffix[...]" operators instead of using "join[]", like this: <$set name="url" filter="[[https://www.w3.org/WAI/WCAG21/Techniques/]addsuffix<place01> addsuffix<place02>addsuffix[/$ref$]]"> Another alternative (and perhaps the simplest) is to skip the filter syntax entirely and use macro substitution handling in the makelink() helper macro to construct the URL and wikitext link syntax in one go, like this: \define wcagTechUrl(ref) <$set name="place01" filter="[[$ref$]prefix[G]then[general]]"> <$set name="place02" filter="[[$ref$]prefix[H]then[html]]"> <<wcagTechUrl_makelink "$ref$">> </$set> </$set> \end \define wcagTechUrl_makelink(ref) [[$ref$|https: //www.w3.org/WAI/WCAG21/Techniques/$(place01)$$(place02)$/$ref$]] 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/a871a76b-9b6e-45b1-aed2-dea5c5d7430do%40googlegroups.com.