[pmwiki-users] underscores in file names ?
David Pilling
pmwiki at pilling.demon.co.uk
Mon Jan 28 10:00:16 CST 2013
Hi,
FWIW when I added underscore in wiki page names to the Pacific Bulb
Society wiki, this is the code I added to the config file. Two chunks
were needed. One at the start, one further down.
## Allow underscore in page name DJP 2012-03-01
## must appear before any page name functions called
$PageNameChars='-[:alnum:]_\\x80-\\xfe';
function AsSpacedUS($text) {
return AsSpacedUTF8(str_replace('_',' ',$text));
}
function MakePageNameUS($basepage, $str)
{
global $MakePageNameFunction;
$page=$str;
if($MakePageNameFunction)
{
$MakePageNameFunction='';
$page=MakePageName($basepage,$str);
if(!PageExists($page))
{
$page2=MakePageName($basepage,str_replace(' ','_',$str));
if(PageExists($page2)) $page=$page2;
}
$MakePageNameFunction = 'MakePageNameUS';
}
return($page);
}
$AsSpacedFunction = 'AsSpacedUS'; // has to be set up after UTF8 below
$MakePageNameFunction = 'MakePageNameUS';
// second chunk
## Enable UTF-8 (Unicode) support
# * it is better to leave it alone after instalation
# * must come before any pagename resolution
include_once($FarmD.'/scripts/xlpage-utf-8.php');
$AsSpacedFunction = 'AsSpacedUS'; // underscore names set up above
--
David Pilling
email: david at pilling.demon.co.uk
web: http://www.davidpilling.net
More information about the pmwiki-users
mailing list