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/54647b35-c63a-4b7a-8907-598e2d25217eo%40googlegroups.com.

Reply via email to