Hi, I know that TW syntax can be overwhelming. Let's cut this back to its simplest form.
Macros are used primarily for Text Replacement. That is, then the macro is "called" the wiki-text parser tries to complete all text replacement in the macro-body using the inputs, and _then_ it parses the resulting text AS wikitext as per normal. So the simplest implementation would be (note the use of the "ext" modifier for the link quick-syntax, this forces an external link): ``` \define wcagTechUrl(ref) [ext[$ref$|https://www.w3.org/WAI/WCAG21/Techniques/$ref$]] \end <<wcagTechUrl H96>> ``` While it is now easy to write these macro-links via plaintext, you would not want to use this form inside a $list or other widget construction. Use the below pattern instead. I have "unpacked" the macro-call quick-syntax. This allows us to pass other variables or tranclusions to the input of the macro. In this case the tiddler title of any tiddler tagged "wcagTechUrl" in a $list construction (using the default "currentTiddler" variable by omitting the "variable" parameter of the $list): ``` \define wcagTechUrl(ref) [ext[$ref$|https://www.w3.org/WAI/WCAG21/Techniques/$ref$]] \end <$list filter="[tag[wcagTechUrl]]"> <$macrocall $name=wcagTechUrl ref=<<currentTiddler>> /> </$list> ``` Best, Joshua Fontany On Sunday, September 20, 2020 at 3:30:48 PM UTC-7 [email protected] 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. > > At first, I tried > > \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[]]"> > [[$ref$|<<url>>]] link to <<url>> > </$set></$set></$set> > \end > > and this gives me that kind of things : bug-01.jpeg > * there is a G8 link but it links to #<<url>> > * the link outside of the "a" tag is treated as a link but only until > "Techniques/" corresponding to the URL I added during the join operation. > > I trie the following new code: > > \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[]]"> > <$wikify name="urlw" type="text" text=<<url>> > > <<urlw>> > </$wikify> > </$set></$set></$set> > \end > \define wcagTech(ref) [[$ref$|<<wcagTechUrl $ref$>>]] vers <<wcagTechUrl > $ref$>> > > which I use thus: <<wcagTech G8>> and I get bug-02.jpeg > * the macrocall widget is no better that the simple macro calling, same > result > * but the printed url is shown as a complete URL, that which I want, and > redirect to that URL. > > So, I'm really confused. the URL in the [[ | ]] link syntax is always raw, > I can't use a macro or a variable to speicy it, which ruins my second > attempts and similar tries. And my first try was also very strange. > > Could a guru explain me waht's going on or how to do it properly please? > Many thanks in advance!!! > > > > but the result is that one > > -- 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 view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/e841d746-d7a2-4fe7-8db1-20bb96b8c1c2n%40googlegroups.com.

