Hello,
I'm trying to write a markup rule for nested span tags.
Example:
(:span SomeAttr="x":)Text
(:span1 someAttr="y":)nested span
(:span1end:)some more text in outer span
(:spanend:)
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',
'/\\(:(span([^\\s]*(end)?))(\\s?.*?):\\)/ie',
"HTMLBlock('span','$1',PSS('$4'))");
?>
regards
Jens
_______________________________________________
pmwiki-users mailing list
pmwiki-users@pmichaud.com
http://www.pmichaud.com/mailman/listinfo/pmwiki-users