[pmwiki-users] pagelist sorting question

Patrick R. Michaud pmichaud at pobox.com
Thu Oct 5 14:00:03 CDT 2006


On Thu, Oct 05, 2006 at 05:40:25PM +0200, Jan Erik Moström wrote:
> I wanted to create a number of pages that contains information 
> about people. My idea was to name the pages like this:
> 
> A page about Donald Duck would get the name "DuckDonald" and 
> then on the page I would you the title tag to generate the title 
> "Donald Duck", this way I could easily get a list sorted after 
> the surname using the pagelist command. But, there is always a 
> but, the people I was thinking of have names like "Åsa 
> Österberg" which becomes a problem if try to save a page named 
> "ÖsterbergÅsa" (I'm running this locally on a Mac, and if I 
> remember thing correctly this a Mac problem).

I don't think it's a problem if you're using utf-8.  But yes,
in general Macs don't seem to support filenames that aren't
utf-8.

> My current "fallback idea" is to let the page name be 
> 'OsterbergAsa' and set the page title be "(:title Österberg, 
> Åsa:)" and let pagelist sort by page title ... this would mean 
> that I lose the first-name-last-name title on the pages (not 
> very important).

How many of these are there?  You might be able to use
custom page variables and/or page text variables to get what
you want.

In the simple case (no non-ASCII chars), you could have a page
named 'DuckDonald' and use a (:title Donald Duck:), as you described
above.

For names with non-ASCII chars, use 'OsterbergAsa' along with
(:title Åsa Österberg:) and (:sortname:ÖsterbergÅsa:) .

Then, create a custom page variable called '$SortName'
that uses $:sortname if it exists and $Name if it doesn't:

    $FmtPV['$SortName'] = '($x=PageTextVar($pn, "sortname")) ? $x : $name';

Your pagelist sort then becomes:

    (:pagelist order=$SortName:)

This will use the value of (:sortname:...:) if it exists, otherwise
it uses the page's name.

Or, you could just give every page *both* a (:title:) and a 
(:sortname:...:), and then you don't need the custom page variable,
and it doesn't matter what a page is named:

    (:pagelist order=$:sortname:)

You might like this better, because then your pages
could be named "DonaldDuck" and "AsaOsterberg" and you'd
still have the capability to sort on last name.

Hope this helps,

Pm




More information about the pmwiki-users mailing list