On Sat, 11 Aug 2007, H. Fox wrote:
On 8/11/07, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
The LyX wiki site obviously uses the word 'LyX' (written like that). I'd
now like to use the pagelist formt #titlespaced, however all pages with
'LyX' get split up in an unfortunate way. For instance, 'LyXSomePage'
becomes 'Ly X Some Page', rather than 'LyX Some Page'.
Any ideas on how I can make the wiki treat 'LyX' as something that should
not have spaces inserted?
The automatically generated title will be overridden if you explicitly
specify a title, as in (:title LyX Some Page:) on LyXSomePage.
This is true, but requires that I (or the users) add a title directive to
a _lot_ of pages. For some reason 'LyX' is very popular in the name of the
pages on the LyX wiki..
Anyway, looking at the code, it seems I have to provide my own
function that 'spaces' names, and then let the function reference
$AsSpaceFunction refer to this function. The default function is AsSpaced:
function AsSpaced($text) {
$text = preg_replace("/([[:lower:]\\d])([[:upper:]])/", '$1 $2', $text);
$text = preg_replace('/([^-\\d])(\\d[-\\d]*( |$))/','$1 $2',$text);
return preg_replace("/([[:upper:]])([[:upper:]][[:lower:]\\d])/",
'$1 $2', $text);
}
The following works, but it's a bit of a hack:
#
# Introduce a special function that converts a text to a 'spaced'
# form, that prevents 'LyX' from being split up into 'Ly X'.
# This is a bit of a hack, as a name originally containing 'Ly__x__' will
# be converted to contain 'LyX ' instead.
#
function AsSpaced_preserving_LyX($text) {
$text = preg_replace("/(LyX *)/", "Ly__x__ ", $text);
$text = preg_replace("/([[:lower:]\\d])([[:upper:]])/", '$1 $2', $text);
$text = preg_replace('/([^-\\d])(\\d[-\\d]*( |$))/','$1 $2',$text);
$text = preg_replace("/([[:upper:]])([[:upper:]][[:lower:]\\d])/",
'$1 $2', $text);
return preg_replace("/Ly__x__ /", "LyX ", $text);
}
$AsSpacedFunction = 'AsSpaced_preserving_LyX';
cheers
/Christian
--
Christian Ridderström, +46-8-768 39 44 http://www.md.kth.se/~chr_______________________________________________
pmwiki-users mailing list
[email protected]
http://www.pmichaud.com/mailman/listinfo/pmwiki-users