[Pmwiki-users] Spaces in file names

Dave Noonan PmWiki
Mon Mar 1 06:18:21 CST 2004


This worked beautifully except when I typed "file:some stuff.xls".  Do you
think you could get it to type for me? :)

Thanks much.
--
Dave
-----------------------
I have yet to see any problem, however complicated, which, when looked at in
the right way, did not become still more complicated.
~ Poul Anderson


> Patrick R. Michaud wrote:

Okay, try this in your config.php:

$LinkPatterns[300]['\\bfile:".*?"'] = 'FmtSpacedUrlLink';

function FmtSpacedUrlLink($pat,$ref,$txt) {
global $FmtUrlLink;
$url = str_replace(array(' ','"'),array('%20',''),$ref);
if (is_null($txt)) $txt=str_replace('"','',$ref);
return $FmtUrlLink($pat,$url,$txt);
}

This allows markup of the form

file:"\\server\some dir\some other dir\pain in the butt.xls"

correctly eliminating the quotes and replacing the spaces with '%20'.
It also gets rid of the quotes when displaying the file:... reference in the
text.  I have this code temporarily enabled at
http://www.pmichaud.com/wiki/Development/UrlPathSpaces .

________________________________________________
This mail was sent by UebiMiau 2.5




More information about the pmwiki-users mailing list