In my French-Acadian Dictionary “Redo” TiddlyWiki project, I have a “Pronunciation List” tiddler that displays a sorted list of word pronunciations (hopefully to make it possible to find words based on their sounds).
The sorting of the list was off because the pronunciation of words includes periods to separate the syllables, and includes letters wrapped in single back ticks (my way of creating a phonetic alphabet that does not have weird symbols).
The regular sort[]
needed to be replaced with a sortsub[]
to sort the pronunciations via the result of an expression for each pronunciation.
Here is a comparison of outputs (sort vs sortsub):
Here is the related code:
<$let e="[éèê]"
baseSortHow="[search-replace:g[.],[]search-replace:g[`],[]search-replace:g:regexp<e>,[e]]" >
!! Sort
<$macrocall $name="colList"
fv="m"
f="[tag[m]get[🔊⭐]!is[blank]] [tag[m]get[🔊🇫🇷]!is[blank]] +[sort[]]"
cw=10
i="<<m>>" />
<hr>
!! Sortsub
<$macrocall $name="colList"
fv="m"
f="[tag[m]get[🔊⭐]!is[blank]] [tag[m]get[🔊🇫🇷]!is[blank]] +[sortsub<baseSortHow>]"
cw=10
i="<<m>>" />
</$let>
BTW:
- “Word” tiddlers are tagged with “m”
- A word will have a common French-Acadian pronunciation (from the field “
”) and, quite often, a “standard French” (or “standard French” in Canada) pronunciation (from the field “
”)
- TODO: add code to the sortsub to handle the other accented characters
- TODO: setup the list items (I.e. the word pronunciations) as links to open the related words
The “colList” macro:
\define colList(fv f cw i)
<!-- 📒 fv=filter variable; f=filter; cw=column width; i=line item content -->
@@display:block;-moz-column-count:auto;-webkit-column-count:auto;-moz-column-width:$cw$em;-webkit-column-width:$cw$em;-moz-column-gap:0.5em;-webkit-column-gap:0.5em;-moz-column-break-inside: avoid;-webkit-column-break-inside: avoid;page-break-inside: avoid;break-inside: avoid-column;
<ul style="list-style-type:none; padding:0; margin:0;">
<$list variable="$fv$" filter="$f$">
<li style="border-left:1px solid lightgray;">$i$</li>
</$list>
</ul>
@@
\end