[pmwiki-users] inline images with spaces in filename

dan mcmullen bang at bangzero.org
Mon Feb 15 15:03:40 CST 2010


hello all!

my client has a number of images with spaces in the image filename.  i 
am a bit unhappy with the 'workaround' for attaching such an image file 
so that it shows as an image.  '[[#1 | Attach:spacey image name.jpg]]' 
will display this kind of image, but it appears in the page as a link, 
with a different mouse cursor on rollover.  also, captions and popup 
text are not possible with this technique.

looking at the inline image markup, it seems a simple matter to remove 
the part of the regular expression that excludes spaces. 
"([^\\s$UrlExcludeChars]+$ImgExtPattern)" in the original becomes 
"([^$UrlExcludeChars]+$ImgExtPattern)" in this custom markup:

   Markup('spcimg','<img',
     "/\\b(?>(\\L))([^$UrlExcludeChars]+$ImgExtPattern)(\"([^\"]*)\")?/e",
 
"Keep(\$GLOBALS['LinkFunctions']['$1'](\$pagename,'$1','$2','$4','$1$2',
       \$GLOBALS['ImgTagFmt']),'L')");

since this custom markup is installed before the standard image markup, 
it essentially replaces the standard inline image markup with one that 
allows spaces.

my question is whether there are any potential problems with this 
approach that i am missing?

tia! /dan

ps- and...  can anyone explain the "(?>(\\L))" bit of the regex above? 
it seems to match the "prefix:" bit of a link, but i can't find any 
documentation on \L.



More information about the pmwiki-users mailing list