[pmwiki-users] nested span tag markup

jens at quefaire.de jens at quefaire.de
Fri Oct 18 02:57:42 CDT 2013


I'm trying to write a markup rule for nested span tags.


(:span SomeAttr="x":)Text
(:span1 someAttr="y":)nested span
(:span1end:)some more text in outer span

should result in

<span SomeAttr="x">Text<span someAttr="y">nested span</span>some more  
text in outer span</span>

I grabbed the code from an old post in this list concerning nested  
block elements. After playing around with the regexp, it will  
sometimes generate correct html, but often pmwiki will incorrectly add  
'</p>' or something else, to close the block.

Currently the rule is inserted before any block markup rule  
('<block'). What is the correct position in the markup list for this  
kind of markup? Is there a way to prevent pmwiki from inserting  
additional block element tags?

Here's the code (file nestspan.php):

<?php if (!defined('PmWiki')) exit();

function HTMLBlock($block, $name, $attr) {
   global $MarkupFrame;
   $attr = PQA($attr);
   $name = strtolower($name);
   $key = preg_replace('/end$/', '', $name);

   $out = '<:block>'.MarkupClose($key);
   if (substr($name, -3) == 'end') return $out;
   $cf = & $MarkupFrame[0]['closeall'];
   $out .= "<$block $attr>";
   $cf[$key] = "</$block>";
   return $out;

Markup('nestspan', '<block',



More information about the pmwiki-users mailing list