On Sun, 8 Jun 2008, Joey Hess wrote:

Jaldhar H. Vyas wrote:
Hello, the enclosed patch allows the map plugin to use fields from the
meta plugin instead of the page name as the list item text.  By default,
the meta title will be used but a different field can be used by
specifying the key parameter.  E.g.

[[map pages="*" key="description"]]

and

[[meta title="Serious article" description="PANCAKES!"]]

would render PANCAKES! as the link text.

AFAICS, that would only work if 'description' were a defined metadata field,
which it is not.


For example look at http://www.mimamsa.org/

On e.g. /sources/index.html I use:

[[map pages="sources/* and !sources/index and !*/Discussion" key="description"]]

/sources/mp.html contains:

[[meta title="[MP]" description="\"Mimamsa Paribhasha of Krsna Yajvan\" translated 
by Swami Madhavananda"]]

exactly the way I mentioned above and it seems to work ok.

/authors/index.html, /terms/index.html, and works/index.html use the title.

If the description or other meta field was not defined, my patch falls back to the old map behavior of displaying the page name which is ok as a default I should think.

The only dodgy bit you might want to reject is the line where I use
HTML::Entities::decode.  The problem is that the meta plugin already
encodes fields that contain unicode characters.  So when I try and use
Devanagari text as the link text I get e.g.

जैमिनि

instead of:

??????????????????

HTML::Entities::decode works for me but I don't know if it is the best
approach.  What do you think?

It's a bit of a mess, since meta title is encoded numerically, but the
other metadata stored in pagestate by meta is not html-encoded at all.

I also don't quite understand why you need to decode entities..
The generated html would be:
<a href="foo">&#x91C;&#x948;&#x92E;&#x93F;&#x928;&#x93F;</a>
Which seems perfectly valid to me; renders in epiphany as:
जैमिनि
That's the correct rendering isn't it?


Yes. Maybe this is a konqueror problem then? Hmm I just backed out that change and rebuilt the wiki and it seems to be ok even with konqueror. Never mind then.


And if you decode the title, and it contained encoded < and >, that
would be a problem..


That's why I wasn't sure if it was a good idea.


More generally, the values stored in pagestate by meta don't have any
consistency of intended use. The license and copyright can
include arbitrary html markup such as hyperlinks; the title cannot. So
using key="license" or something like that could cause it to generate a
link inside a link (ie, invalid html).

I doubt you'd want to use key=license,copyright, or author anyway; it
seems unlikely to be useful.


I'm leaning toward using [[map pages="*" show=title]], and special case
each possible value of "show". Starting probably, with just supporting
show=title.


For my purposes title, description, and perhaps later on date would be sufficient.


--
Jaldhar H. Vyas <[EMAIL PROTECTED]>
La Salle Debain - http://www.braincells.com/debian/

Reply via email to