> > 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.
This may be a feasible approach which I will investigate further. One reason I chose to use the text of a title attribute is that the alternate toc entry text is also an attribute, so cannot contain tags. Using the approach suggested, it would be possible for somebody to include wiki markup that then causes the book transformation to fail. Similarly, using the link text as the chapter title text means a chapter title can contain markup, which (:title:) does not allow. But you are right that from a user point of view, there is a nice correspondence between the trail page and the contents page, and a wiki page and a chapter. ... >> >> 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. Agreed -- it would be much better not to modify trails.php. I tested an alternative: $MakePageNameFunction = 'LocalMakePageName'; function LocalMakePageName($basepage, $str) { global $MakePageNameFunction; $MakePageNameFunction = ''; $n = MakePageName($basepage, preg_replace('/".*?"/', '', $str)); $MakePageNameFunction = 'LocalMakePageName'; return $n; } This works in almost all cases. Unfortunately, the following example breaks trail navigation: # [[Kororareka"Kororareka ¶ A Mixed Community ¶ Shulitea (King George)"|+]] We have to use ( and ) instead of ( ... ) because MakeLink removes ( ) before setting the alt text. But trails.php strips #.+ before calling MakePageName, so everything after the first #40 gets removed and LocalMakepageName fails to match. > > Modifying $PageNamePatterns might cause some existing links on that wiki > to > stop working. Yes there is a problem for links like this (the dot in Mr. Hobbs gets treated as a group name separator): # [[Hokianga River"Hokianga River ¶ Mr. Hobbs' Mission ¶ The Timber Industry"|+]] Redefining the MakePageNameFunction gets around this. At the moment, if I could find a way around the (King George) problem, I think I would have a working solution that requires no change to the core. JR -- John Rankin _______________________________________________ pmwiki-devel mailing list pmwiki-devel@pmichaud.com http://www.pmichaud.com/mailman/listinfo/pmwiki-devel