[pmwiki-users] Preventing a URL being converted to an IMG tag

Patrick R. Michaud pmichaud at pobox.com
Tue Nov 6 18:39:11 CST 2007


On Tue, Nov 06, 2007 at 07:23:48PM -0500, DaveG wrote:
> I'm trying to create a div with an image background inside a wiki page:
> 
>     (:div id="test" 
> style="background-image:url({$SkinDirUrl}/images/spring/header_bg.jpg);":)
>     (:divend:)
> 
> The problem is that $SkinDirUrl is being interpreted by PmWiki as an 
> image, and is converted to:
>     <div id="test" style="background-image:url(<img 
> src='INTERPRETED_PATH/images/header_bg.jpg' alt='' title='' />);" >
>     </div>
> 
> I've tried using [={$SkinDirUrl}=], but that obviously prevents PmWiki 
> interpreting the variable.
> 
> Is there anyway to achieve this?

At present the only way to do this is to use a url without
the http://server/ prefix.

(:div id="test" style="background-image:url(/path/to/pmwiki/pub/images/...)":)

There has been some talk about getting url(...) to automatically
escape its contents after variable substitution has taken place.
This can probably be done with a markup rule like:

  Markup('url()', '<links', 
    "/url\\([^$UrlExcludeChars]+\\)/e",
    "Keep(PSS('$0'))");

Pm



More information about the pmwiki-users mailing list