Man, I wish I could edit that last post: "...and I keep expressions *and
words separate*.
On Sunday, June 6, 2021 at 11:25:00 PM UTC-3 Charlie Veniot wrote:
> Arg. I had posted the code for that macro, and had forgotten to set it up
> to get only those tiddlers tagged "mot" (i.e. word), because many tiddlers
> are tagged "expressions", and I keep expressions. And then there are other
> tiddlers that are neither a word nor an expression.
>
> And because I'm a continuous tweaker of things, I also had to change the
> variable name in the macro.
>
> Also, worth highlighting that the macro shows how I've gone about handling
> *dynamically
> generated filters*.
>
> Anyways, for anybody and all interested, the new version of the macro:
>
> \define GetWords(FirstLetterOptions)
> <$vars *thisFilter*={{{
> [[$FirstLetterOptions$]split[]addprefix<lb>addprefix[prefix]addsuffix<rb>addprefix<lb>addsuffix<rb>join[
>
> ]*addsuffix[
> +]addsuffix<lb>addsuffix[tag]addsuffix<lb>addsuffix[mot]addsuffix<rb>addsuffix<rb>*addsuffix[
>
> +]addsuffix<lb>addsuffix[sort]addsuffix<lb>addsuffix<rb>addsuffix<rb>] }}}>
> @@.multicol
> <$list variable="thisTiddler" filter=<<*thisFilter*>>>
> <$link to=<<thisTiddler>>/><br>
> </$list>
> @@
> </$vars>
> \end
>
> *Example generated dynamic filter*: <<GetWords "aâà">>
>
> thisFilter has the value [prefix[a]] [prefix[â]] [prefix[à]] +[tag[mot]]
> +[sort[]]
> On Saturday, June 5, 2021 at 10:37:11 PM UTC-3 Charlie Veniot wrote:
>
>> G'day,
>>
>> *In the code further below, I use what I know and/or what I'm comfortable
>> with. Please, if you have code for alternative approaches, please share!
>> This post is just about sharing code for studying.*
>>
>> Working again on my French-Acadian dictionary
>> <https://leptitaurele.neocities.org/>, I am redesigning the way of
>> retrieving matching words per words tiddler (organized by letter of the
>> alphabet, so a tiddler for words starting with letter "a", a tiddler for
>> words starting with letter "b", etc. etc.
>>
>> I decided that I needed a global macro to do the job of getting all
>> relevant words for each list of words tiddler, so that I can code <<GetWords
>> a>> to get all of the words starting with "a", <<GetWords b>> to get all
>> of the words starting with "b", etc. etc.
>>
>> Should be easy enough with a filter that takes the macro parameter and
>> yields results of things like [prefix[a]], [prefix[b]], etc.
>>
>> But [prefix[a]] won't catch words starting with accented a's ( â or à ).
>>
>> [sort[]] has the smarts to treat accented a's as equal to "a", so sorting
>> works A-1.
>>
>> So for your perusal, the code I've come up with that works quite sweetly
>> with the macro call <<GetWords "àâa">> :
>>
>> \define lb() [
>>
>> \define rb() ]
>>
>> \define GetWords(FirstLetterOptions)
>> <$vars letterList={{{
>> [[$FirstLetterOptions$]split[]addprefix<lb>addprefix[prefix]addsuffix<rb>addprefix<lb>addsuffix<rb>join[
>>
>> ]addsuffix[
>> +]addsuffix<lb>addsuffix[sort]addsuffix<lb>addsuffix<rb>addsuffix<rb>] }}}>
>> @@.multicol
>> <$list variable="thisTiddler" filter=<<letterList>>>
>> <$link to=<<thisTiddler>>/><br>
>> </$list>
>> @@
>> </$vars>
>> \end
>>
>> And the CSS for multicol :
>>
>> /* MULTI COLUMN MODE */
>> .multicol {
>> display:block;
>> -moz-column-count:4;
>> -moz-column-gap:1em;
>> -webkit-column-count: 4;
>> -webkit-column-gap:1em;
>> }
>>
>
--
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/6ea32209-35d8-4f76-a727-841558788f02n%40googlegroups.com.