@Joshua: Thank you for your answer. I had tries with <$macrocall> but it 
was not the gotcha. What I had wrong was really, in retrospect, the art of 
puting [, ( and < right within my filters. I am still dumbfounded by what 
the way-that-works vs the way-that-I-would-thought-would-work.

I'm now looking at the subfilter filter. It seems to be the map operator I 
was asking for. But here again, I have two problems: 1) writing my filter 
and 2) using subfilter!

But those problems do not belong to this thread.

Regards,

Le lundi 21 septembre 2020 à 01:52:12 UTC+2, [email protected] a écrit :

> 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/7c2a2b63-ee28-46c5-a159-cd422d714f0dn%40googlegroups.com.

Reply via email to