[Pmwiki-users] CustomMarkup

Patrick R. Michaud pmichaud
Fri Feb 20 14:28:09 CST 2004


On Fri, Feb 20, 2004 at 10:15:03PM +0100, Pascal Br?ck wrote:
> Hi there,
> While trying to customise the wiki i'm stuck with creating a 
> WikiStyleTag in combination with a InlineReplacement.
> I need a CustomMarkup for an div tag.
> 
> The following lines i put in my config.php:
> 
> $WikiStyleTags = array('class' => array (class=\'$value\'
> 		');
> $InlineReplacements['/\\#\\#\\#(.*?)\\#\\#\\#/'] = "	
> <div>\$1</div>";
> 
> Editing a page typing:
> 
> %class=value%###some text###
> 
> i get the div tag as a replacement but my WikiStyleTags seems not to 
> work.
> How can i add attributes to it?
> Or is there maybe a better way of solving this?

At present we don't have a mechanism for being able to attach WikiStyles
to block markups such as <div> (or lists or paragraphs or ...), but it's
definitely growing in demand.  I'll send my current thoughts about this
in a subsequent email.

However, you could probably make something work along the lines of what
you're wanting to do by doing

  $WikiStyleTags['class']['div'] = 'class=\'$value\' ';
  $InlineReplacements['/\\#\\#\\#(.*?)\\#\\#\\#/'] = "<div >\$1</div>";

...BUT this is likely to conflict with whatever solution we eventually
adopt for adding WikiStyles to <div> and other blocks.  OTOH, it should
be able to come up with a way to keep your markup choice working.

Pm

P.S. for those who are curious what the above does:  
   The first line of code above says that the %class=something% 
   WikiStyle should be converted to add the attribute 
   "class='something' " to every <div> tag that follows it up to 
   the next WikiStyle declaration or the end of the current markup line.





More information about the pmwiki-users mailing list