[Pmwiki-users] Spaces in file names
Patrick R. Michaud
pmichaud
Sat Feb 28 08:26:40 CST 2004
On Fri, Feb 27, 2004 at 07:34:29PM -0500, Dave Noonan wrote:
> Patrick R. Michaud wrote:
>
> That was my thought so I tried .* figuring anything between the
> quotes was okay. I still didn't work.
>
> File:"\\server\some dir\some other dir\pain in the butt.xls" would be
> very much easier on me. :-)
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 .
> For the curious, File: is localmap to file: which IE will use to open
> excel, folders or whatever other M$ products you've got laying around. I
> didn't just type "file:" because then PmWiki wouldn't link it.
Actually, PmWiki shouldn't care because the thing following "file:" isn't
a valid UrlPathPattern.
Pm
More information about the pmwiki-users
mailing list