[pmwiki-devel] Wiki links with title/alt text attribute

Petko Yotov 5ko at 5ko.fr
Mon May 2 02:36:29 CDT 2011

On Monday 02 May 2011 02:57:58, John Rankin wrote :
> I am assessing the following link markup as a local customisation:
> # [[A Maori Village"A Maori Village ¶ The Tapu on Crops ¶
> Maori Art" |A Ramble Ashore]]
> # [[Victorious Warriors"Victorious Warriors ¶ Treatment of
> Prisoners ¶ Baked Heads"|+]]
> # [[Kororareka"Kororareka ¶ A Mixed Community ¶ Shulitea
> (King George)"]]
> This is part of a book production system and addresses the case where
> entries in the table of contents are different from the chapter titles.
> In the above examples, the alt text becomes the contents entry, the link
> text becomes the chapter title.

Is it possible to use the link text in the contents, and the page (:title:) as 
title of the chapter? Something like:

# [[A Maori Village|A Maori Village ¶ Maori Art]] 
  The page AMaoriVilage has (:title A Ramble Ashore:)
# [[Victorious Warriors|Victorious Warriors ¶ Baked Heads]]
  The page VictoriousWarriors has (:title Victorious Warriors:)
# [[Kororareka|+]] 
  This one uses the page title as link text in the contents.
* etc.

This would work exactly as someone would expect - in the wiki "contents" page 
you actually see the links like in the book table of contents, and when you go 
to the wiki page, you see the same title, like you would see the title of the 
chapter in the book.

> The MakeLink function treats the quoted text as alt text, so it was a
> simple matter to use this in a local link page exists variable. The
> problem is that the MakePageName function (e.g. used in ReadTrail)
> produces inappropriate page names.
>  From recent experience, the markup works well under a range of page
> naming conditions [1] and it seems consistent with alt text on images
> and external links. I have temporarily patched trails.php to get
> something working, but am planning to redefine $PageNamePatterns.
> Is there another or better way to do this? Are there any traps into
> which this might fall? TIA

Modifying core scripts is not recommended, something may break in future 
upgrades -- and I don't know yet if and how the [[internal link "with 
quotes"]] should or shouldn't be changed in the core.

Modifying $PageNamePatterns might cause some existing links on that wiki to 
stop working. 


More information about the pmwiki-devel mailing list