OK. Thanks to you, I got these macros to get my job done. Note the padding 
on the ul tag to get an alignment not excessively deported to the right. 

\define wcag(ref)
\whitespace trim
<$set name="base" value="https://www.w3.org/WAI/WCAG21/Techniques";>
<$set name="codeFam" filter="$ref$ +[splitregexp[\d+]] +[join[]]">
<$wikify name="wcagDir"
text="""<$transclude tiddler="$:/user/dict/wcag/ref/cat" index=<<codeFam>> 
/>""" >
<$vars url={{{ [<base>] [<wcagDir>] $ref$ +[join[/]] }}} >
<a href=<<url>> target="w3.org/WAI/">$ref$</a>
</$vars>
</$wikify>
</$set>
</$set>
\end

\define wcagList()
<ul style="padding-left: 0;">
<$list filter="[enlist{!!wcag21tech}]" variable=link-code>
  <li><$macrocall $name="wcag" ref=<<link-code>> /></li>
</$list>
</ul>
\end

Note also the call to the wcag macro using the macrocall widget. I would 
have tought that I could have instead written this:

<li><<wcag $(link-code)$>></li>

Le samedi 3 octobre 2020 à 02:07:03 UTC+2, TW Tones a écrit :

> Jean-Pierre,
>
> When we use the content of the list widget as the template to display each 
> item, there is a different behaviour if the first line is blank or not. No 
> line makes it inline, one blank line makes it a block, so line based wiki 
> text is processed.
>
> ;List from [[tiddler|links-tiddler]]
> <$list filter="[enlist{links-tiddler}]" variable=link-code>
>
> * <<hyper-links>>
> </$list>
>
> However if you look at the html output the 
> <ul>
> is started again for every item, so there is a larger gap between items.
>
> Keep in mind to a great extent wikitext mark-up is about shorthand, when 
> using widgets such as the list widget it not so critical to use only 
> mark-up, so your html solution is fine.
>
> Tones
>
> On Saturday, 3 October 2020 08:21:55 UTC+10, Jean-Pierre Rivière wrote:
>>
>> Thank you Tones. I need to adapt it to my very need, but something I have 
>> not been able to do quickly tonight is to get a list (the ul/li or ol/li 
>> kind of list) with that. for instance, in list from field, having "* 
>> <<links>>" instead of "<<links>>" doesn't do the tricks. I confess I don't 
>> understand why.
>>
>> Note that I can get my list if I add the html tags correctly:
>>
>> ;List from field
>> <ul>
>> <$list filter="[enlist{!!links-field}]" variable=link-code>
>>   <li><<links>></li>
>> </$list>
>> </ul>
>>
>> But I would prefer using a wiki syntax. A use case for wikify widget 
>> maybe, I haven't tested it yet.
>>
>> Regards, 
>>
>> (BTW how do you insert specific portion of code in your post? I'm unable 
>> to do this.)
>> Le vendredi 2 octobre 2020 à 15:23:04 UTC+2, TW Tones a écrit :
>>
>>> Jean-Pierre,
>>>
>>> Paste this into a tiddler and review how it works.
>>>
>>> \define link-prefix() https://www.w3.org/WAI/WCAG21/Techniques/
>>> \define link-codes-macro() general/G10 general/G135 general/G136 
>>> failures/F15
>>> \define links() [[$(link-code)$|$(link-prefix)$/$(link-code)$]]
>>> \define hyper-links() <a href="$(link-prefix)$$(link-code)$" target=W3.
>>> org><$text text={{{ [[$(link-code)$]split[/]last[]] }}}/></a>
>>>
>>> ;List from macro
>>> <$list filter="[enlist<link-codes-macro>]" variable=link-code>
>>>   <<links>>
>>> </$list>
>>>
>>> ;List from field
>>> <$list filter="[enlist{!!links-field}]" variable=link-code>
>>>   <<links>>
>>> </$list>
>>>
>>> ;List from [[tiddler|links-tiddler]]
>>> <$list filter="[enlist{links-tiddler}]" variable=link-code>
>>>   <<hyper-links>><br>
>>> </$list>
>>>
>>> links-field contains
>>> failures/F15 failures/F19 failures/F20
>>>
>>> links-tiddler contains
>>> aria/ARIA4 aria/ARIA5 aria/ARIA18
>>>
>>> Notes;
>>>
>>>    - The three list demonstrate different methods
>>>    - All make use of $(varname)$ substitutions to 
>>>    assemble/concatenate the links 
>>>    - I recommend the last that uses the href because it sets a single 
>>>    target name and all links open and replace the last one in the widow/tab
>>>       - You can always use crtl-click to open each in an 
>>>       independent tab.
>>>       - This also demonstrates how to build HTML but that is most often 
>>>       unnecessary.
>>>    - You can see it's only in the last list that I discovered the 2nd 
>>>    last part is needed to make the link unique.
>>>       - Only the link-prefix is the same for all links.
>>>    - The macro can be made global too.
>>>
>>> Regards
>>> Tones
>>>
>>>
>>>
>>> On Friday, 2 October 2020 20:04:43 UTC+10, Jean-Pierre Rivière wrote:
>>>>
>>>> Here is a sample of what I had written by hand:
>>>>
>>>>
>>>> * [[G10|https://www.w3.org/WAI/WCAG21/Techniques/general/G10]].
>>>> * [[G135|https://www.w3.org/WAI/WCAG21/Techniques/general/G135]].
>>>> * [[G136|https://www.w3.org/WAI/WCAG21/Techniques/general/G136]]
>>>> * [[F15|https://www.w3.org/WAI/WCAG21/Techniques/failures/F15]].
>>>> * [[F19|https://www.w3.org/WAI/WCAG21/Techniques/failures/F19]].
>>>> * [[F20|https://www.w3.org/WAI/WCAG21/Techniques/failures/F20]].
>>>> * [[F42|https://www.w3.org/WAI/WCAG21/Techniques/failures/F42]],
>>>> * [[F59|https://www.w3.org/WAI/WCAG21/Techniques/failures/F59]].
>>>> * [[F79|https://www.w3.org/WAI/WCAG21/Techniques/failures/F79]],
>>>> * [[ARIA4|https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA4]],
>>>> * [[ARIA5|https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA5]],
>>>> * [[ARIA18|https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA18]],
>>>> * [[ARIA19|https://www.w3.org/WAI/WCAG21/Techniques/aria/ARIA19]],
>>>> * [[SCR21|
>>>> https://www.w3.org/WAI/WCAG21/Techniques/client-side-script/SCR21]].
>>>>
>>>> With my wcag macro, I can now write something like
>>>>
>>>> * <<wcag G10>>,
>>>> * <<wcag G135>>,
>>>> etc...
>>>>
>>>> What I want to achieve;
>>>> - I have a field called "wcag21tech" which would hold something like 
>>>> "G10 G135 G136 F15 .... ARIA19 SCR21]]
>>>> - I want to be able to either write the code with macro I currently 
>>>> have and have it interpreted as wiki text or if that would be impossible, 
>>>> directly write final html and display it.
>>>>
>>>> I have found I can render html easily via transclusion from a field. 
>>>> I'd be keen to know what you know, because sooner or later it might save 
>>>> my 
>>>> day.
>>>>
>>>> At first, I thought I could do something a bit like
>>>>
>>>> <<list-links filter:"[subfilter{!!wcag21tech}addsuffix[?]]">>
>>>>
>>>> but it does not do what I want because list-links is only intended for 
>>>> internal links and it would try to internalize my external links.
>>>>
>>>> Regards,
>>>> Le vendredi 2 octobre 2020 à 01:41:54 UTC+2, TW Tones a écrit :
>>>>
>>>>> Jean-Pierre Rivière
>>>>>
>>>>> I am not sure what you are trying to achieve in the end. 
>>>>>
>>>>>    - Is this to be in the aforementioned static tiddler template?
>>>>>    - Are you trying to generate HTML? (I have some great tips if you 
>>>>>    are)
>>>>>
>>>>>
>>>>> Most of Html works in its own right in tiddlers, so if you use the 
>>>>> wikitext to create a link 
>>>>> https://tiddlywiki.com/#Linking%20in%20WikiText
>>>>>  it is rendered to html on your screen.
>>>>>
>>>>> It seems to me your attempt at storing html in fields is unnecessary, 
>>>>> I cant imagine a case where this is necessary.
>>>>>
>>>>> Regards
>>>>> Tones
>>>>>
>>>>>
>>>>> On Friday, 2 October 2020 01:39:59 UTC+10, Jean-Pierre Rivière wrote:
>>>>>>
>>>>>> My aim is to build al ist of external links from the value stored 
>>>>>> within a field of the current tiddler. This value is something like "C14 
>>>>>> H1665 SM1113".
>>>>>>
>>>>>> Thanks to a lot of help from this forum, I have been avle to build a 
>>>>>> macro which translate each of those word into an external link.
>>>>>>
>>>>>> But I am unable to go any further.
>>>>>>
>>>>>> The macros and filters of tiddlywiki are provided to cater for 
>>>>>> tiddler titles, like the list-links widget. I can produce the complete 
>>>>>> html 
>>>>>> that would achieve my goal with filters thanks to subfilter. But I have 
>>>>>> discovered I cannot display that html. Some mocked attemps are below:
>>>>>>
>>>>>> !!! text
>>>>>> <$text text="""<ul><li>un</li><li><a 
>>>>>> href="#147">deux</a></li></ul>"""/>
>>>>>>
>>>>>> !!! wikify sur html
>>>>>> <$wikify name="toto" text="""<ul><li>un</li><li><a 
>>>>>> href="#147">deux</a></li></ul>""">
>>>>>> <<toto>>
>>>>>> </$wikify>
>>>>>>
>>>>>> !!! wikify sur html + wiki
>>>>>> <$wikify name="toto" text="""\n\n* un\n* <a href="#147">deux</a>""">
>>>>>> <<toto>>
>>>>>> </$wikify>
>>>>>>
>>>>>> As you can see, even wikify seems unable to make a list.
>>>>>>
>>>>>> What is the way of displaying puere html or a mix of tw5 + html?
>>>>>>
>>>>>> There is a possibility with inclusion of a field. But my field cannot 
>>>>>> be included as raw. So I could process it and create an other field with 
>>>>>> the terget html. But how can I create this filed automatically? I have 
>>>>>> seen 
>>>>>> the action-setfiled widget, but I've been unable to trigger it when not 
>>>>>> associated with a button (and there is no button). My code for this 
>>>>>> attempt:
>>>>>>
>>>>>> <$action-setfield field="jack" value="""<h2>html</h2> <ul> 
>>>>>> <li>un</li> <li><a href="https://meddurenos.free.fr";>deux</a></li> 
>>>>>> <li>trois</li> </ul>"""/>
>>>>>> <$transclude field="jack" mode="inline"/>
>>>>>>
>>>>>> Could I use some clever javascript to trigger the action-setfield 
>>>>>> gagdet, with eventually an hidden button if need be?
>>>>>>
>>>>>> Abandoning that track, should I go for a macro instead? Should/could 
>>>>>> it be a macro that would take as input a listed filter (use of the 
>>>>>> filter 
>>>>>> operator within a filter) -- which I don't know how to do yet? Should I 
>>>>>> write a javascript macro or filter to help me?
>>>>>>
>>>>>

-- 
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/52641c8f-10ed-4474-9702-eb5f255c5074n%40googlegroups.com.

Reply via email to