This question about Configuration: Answered

How can I change alphabetical order?

I know that tables and also search results are sorted in alphabetical order. My question is: How can change that alphabetical order? It must be defined somewhere, isn't it?

For example, the standard alphabet is [a, b, c, d, e,...] and I want to sort it like [a, c, b, e,...]

Details

In case you ask why: I am working on a Klingon dictionary database. For user's convenience, Klingon words are also sorted alphabetically. Due to technical restrictions of FosWiki regarding case sentisitivity, I had to replace some letters. Klingon makes a difference between lower case q and upper case Q. So in my wiki, I use k instead of q. Due to that, words starting with q appear between J and L. In addition, as the apostrophe cannot be used in topic names, I replaced that with a hyphen. It works fine, but then all pages starting with a hyphen show up first; In Klingon alphabet they should go at the end.

Another point that bothers in sorting is that case seems to matter: A word like FooZoo is sorted before Fooboo, because of the upper case letter in the center. Example: Foswiki sorts like this, which is not the alphabetical order:
  • BaS-In
  • BaSSIrgh
  • BaSLaSvargh
  • BaStan
  • Bach
This is obviously not the correct alphabetical order.

-- Lieven - 31 Jan 2020

Have a look at FilterPlugin. Both makros FORMATLIST but also MAKEINDEX have got ways to map and transliterate list items.

-- MichaelDaum - 31 Jan 2020

Thanks for the note. This really looks like a possible solution, but unformtunately I cannot make it work correctly. I've tried "replace" which works, but the creates red links. I tried "map" and also "transliterate" but that didn't change anything. Also sort="nocase" did not cahnge anything. I have read the Plugin page intensely, but did not find enough information or examples. Any sugestions?

-- LieVen - 01 Feb 2020

Can you provide a non trivial input sequence with the desired output?

-- MichaelDaum - 01 Feb 2020 Sure, an example is already given above. Anyway, here's another: Let's search for all pages starting with "Da".

The standard result is this:
  • Da, Da-, DaH, DaS, DaSjaj, DaSpu-, Daj, Dak, Dakrab, Dam, Damu-, Dap, DapBom, DaQ, Dargh

I want it sorted alphabetically,
  • a) without paying attention to case
  • b) with K sorted as lower case Q, coming befor upper case Q and
  • c) the hyphen is treated as Z.

Result:
  • Da, DaH, Daj, Dam, Damu-, Dap, DapBom, Dak, Dakrab, DaQ, Dargh, DaS, DaSjaj, DaSpu-, Da-,
.

-- Lieven

How about this:
%FORMATLIST{
   "%FORMATLIST{
      "Da, Da-, DaH, DaS, DaSjaj, DaSpu-, Daj, Dak, Dakrab, Dam, Damu-, Dap, DapBom, DaQ, Dargh"
      sort="on"
      replace="-=Z0,k=q1,Q=q2"
   }%"
   replace="Z0=-,q1=k,q2=Q"
}%

-- MichaelDaum - 02 Feb 2020

Wow - this is exactly what I had been searching for. I just didn't think about replacing the changes back to original. Now that I found out how it works, it's wonderful. Thanks a lot.

-- Lieven - 03 Feb 2020

One additional question: This has all worked fine so far, but I've encountered a new problem. I would like to get the results in a table. It partially works, but I cannot change the split separator into a way that it lets me create line breaks into the table. I've followed the given example, and my guess is really that it's related to the separator. It now says split="\n" and it creates a comma between the generated table lines. How can I fix that? I have tried all possible combinations I could find, even removing it.

If you like to see how it works (incorrectly), go to the bottom of the page of http://klingonwiki.net/Word/WI-

Thanks.

-- LieVen - 04 Feb 2020

split is used when converting a string into a list, separator is used when converting a list back into a string ... defaulting to a comma.

-- MichaelDaum - 05 Feb 2020
 

QuestionForm edit

Subject Configuration
Extension
Version Foswiki 1.1.9
Status Answered
Related Topics
Topic revision: r9 - 05 Feb 2020, MichaelDaum
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy