what my code want to achieve is: 1) starting from a reference like H18 2) deducing the core of the reference (H for H18) 3) deducing the directory corresponding to that code (html for H) in a dictionnary 4) build an URL from a base url, that directory and that reference: base/directory/reference 5) build a a html tag with that URL and the reference (I have it not as a html tag in my source given here for being easy while writing the code)
Le mercredi 30 septembre 2020 à 01:24:31 UTC+2, Jean-Pierre Rivière a écrit : > > I've nearly done the job I wanted. > > in my macro tiddler I wrote: > > \whitespace trim > > \define wcagDir() <$transclude tiddler="$:/user/dict/wcag/ref/cat" > index="$(codeFam)$"/> > > \define wcag(ref) > <$set name="base" value="https://www.w3.org/WAI/WCAG21/Techniques"> > <$set name="codeFam" filter="$ref$ +[splitregexp[\d+]] +[join[]]"> > ref: $ref$ > base: <<base>> > codeFam: <<codeFam>> > dir: <<wcagDir>> > <$set name="url" filter="[<base>] [<wcagDir>] $ref$ +[join[/]]"> > a href=<<url>> target="w3.org/WAI/" LABEL $ref$ > </$set> > </$set> > </$set> > \end.png > > and in my user tiddler I wrote: > > * H18 in wcag: <<wcag H18>> > > and thisproduces that: > > H18 in wcag: ref: H18 base: https://www.w3.org/WAI/WCAG21/Techniques > codeFam: H dir: html a > href=https://www.w3.org/WAI/WCAG21/Techniques/<$transclude > tiddler="$:/user/dict/wcag/ref/cat" index="H"/>/H18 target="w3.org/WAI/" > LABEL H18 > > Why the difference for the wcagDir macro calls? I tried playing with the > wikify widget but it does not what I wanted (I thought that I need the > output of wcagDir be interpreted as wiki text). If I put > [{/user/dict/wcag/ref/cat##H}] instead of the transclude widget, it is OK, > but I must use a variable and not H, and this I cannot do, and so I thought > that the transclude widget would save me. > > [image: wcag-macro.png] > Le mardi 29 septembre 2020 à 11:07:18 UTC+2, Jean-Pierre Rivière a écrit : > >> Thank you vet much ineed Eric! I already read that abbreviated form >> stuff, but it did not got me right on this. Actually, I think the shorter >> syntax is really difficult into apprehending the filters. For me anyway. >> >> When you read in the schema that a run should obey "one [, then neither [ >> nor ] then ]" it's a bit difficult to see that a run can be [[helloThere]] >> because it is the abbreviated form of [title[helloThere]]. I mean, when >> you'rte out of idea of what was wrong, the documentation is a mixed >> blessing as it currently is. This form is not bad in itself but it is hard >> on the newbye. I'd like to have a try at providing further help for the >> newbye, but I just cannot yet, because I'm just struiggling to get things >> done. >> >> Abot getting things done, the error message I get most often is "Missing >> [ in filter expression" which is not very helpful. This is the case, for >> instance, in the following macro definition: >> >> <$set name="codeFamily" filter="[[title[$ref$]] +join[]]"> >> >> There are the same numbers of [ and ] and each [ do precede its >> corresponfing ]]. Is there an helper tool available to check syntax >> problems and report them in a more useful way? (and I don't see the syntax >> problem in my example, although this is just an example, as the code I >> wanted was filter=[[$refs$]+join[]]" but it is not working as expected >> either but I'm working on it and it's not my question here). >> >> >> Le lundi 28 septembre 2020 à 19:03:22 UTC+2, Eric Shulman a écrit : >> >>> On Monday, September 28, 2020 at 9:48:20 AM UTC-7, Jean-Pierre Rivière >>> wrote: >>>> >>>> @Eric >>>> I don't understand the [[/$tref$]] construct inside a filter. From the >>>> doc, I see that [...] is a filter run. A filter run is made of step and >>>> each step is essentially a parameter eventually preceded by ! and/or an >>>> operator (with eventual : suffixes). No suare breacket within a step. I >>>> heve not read that a run can directly contain a run. So I cannot >>>> understand >>>> how [[/$ref]] may occur within a filter. I4m also finding strange a step >>>> without operator but with an operand (parameter) and the text seems to be >>>> ofg the same advice but as far as I read the railroad schema, this may >>>> very >>>> well happen (no idea of an example for me). >>>> >>>> I don't say you're wrong, I'm just saying I don't see how I could have >>>> understood that from the official documentation. >>>> >>> >>> This is explained in https://tiddlywiki.com/#Filter%20Step >>> >>> The step's operator is drawn from a list of predefined keywords >>>> <https://tiddlywiki.com/#Filter%20Operators>, which can be extended by >>>> plugins. >>>> Any unrecognised operator is treated as if it was the suffix to the >>>> field <https://tiddlywiki.com/#field%20Operator> operator. >>>> If a step's operator is omitted altogether, it defaults to title. >>> >>> >>> Thus, [[text here]] *is* a filter run containing one filter step that is >>> equivalent to [title[text here]]. >>> Note that you can also specify a filter run that defines literal text >>> values by using quotes, >>> as described in https://tiddlywiki.com/#Filter%20Run >>> >>> The lower three options in the diagram match syntax like HelloThere, >>>> "HelloThere", 'HelloThere' and "Filter Operators". >>>> >>> They are short for [title[...]]. >>>> >>>> The quoted options exist to support titles that contain square >>>> brackets, as in "An [[[[Unusual]]]] Tiddler". >>>> >>> >>> -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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/d9bcecea-1fd1-4eb6-8213-73cd9cf9cf3fn%40googlegroups.com.

