[moin-user] ListPages macro doesn't work

Volker Wysk post at volker-wysk.de
Sun Sep 3 14:50:27 EDT 2017


Am Sonntag, 3. September 2017, 14:33:45 CEST schrieb Lars Kruse:
> > BUT: It's broken nonetheless. The search order doesn't treat German
> > umlauts adequately. They all go to the top. And it treats upper/lower case
> > specially.
> > First all the page titles beginning with upper case letters appear,
> > then at the bottom the lower case ones appear.
> 
> "broken" is quite a heavy word.
> Maybe you meant "not suitable for my purpose"?

I've investigated a little about sorting order, and found the following. There 
are quite a few possibilities:

https://de.wikipedia.org/wiki/Alphabetische_Sortierung#Deutsche_Sprache

I was expecting something like the ordering described in RFC5051, which I know 
from a Haskell-library. (here: http://hackage.haskell.org/package/rfc5051)

> Regarding the locale-aware sorting: this should probably depend on the
> configured locale of the user requesting the page. 

True...

> I am not sure, if
> this information is available in the context of a macro exection.
> Anyone knows better?

> upper/lower case: you seem to expect a case-insensitive sort order.

Yes.

> This can be accomplished by changing both "sort" calls from ".sort()" to
> ".sort(key=str.lower)".

I've tried this, but it doesn't quite work. I get:

<<ListPages: Ausführung fehlgeschlagen [descriptor 'lower' requires a 'str' 
object but received a 'unicode'] (siehe auch die Log-Datei)>> 

("Ausführung fehlgeschlagen" means "execution failed")


> Please upload this changed version of the macro, if you think that this is a
> reasonable expectation for most users of this macro.

Yes, I think it is.

> 
> > I'm wondering how this could pass unnoticed, before publishing ListPages
> > in
> > the macro market.
> 
> The macro market is organized like a wiki: contributors are free to improve
> and upload useful code without a formal review procedure.

To me, it looked like there is no alphabetical sorting at all, but just 
sorting by the unicode codes as numbers.


Bye
Volker



More information about the moin-user mailing list