diff --git a/modules/div-foo.pl b/modules/div-foo.pl index c3d165e6..c8cbe38d 100644 --- a/modules/div-foo.pl +++ b/modules/div-foo.pl @@ -22,16 +22,17 @@ $DivFooPrefix = 'foo_'; push(@MyRules, \&DivFooRule); sub DivFooRule { - if (m/\G\<([a-z-_][a-z-_ ]+[a-z-_])\>\s*\n/cg) { + if (m/\G \< ([a-z-_][a-z-_ ]+[a-z-_]) \> \s*\n /cgx) { return CloseHtmlEnvironment('p') . AddHtmlEnvironment('div', 'class="' . join(' ', map {"$DivFooPrefix$_"} split /\s+/, $1) . '"'); } - if (m/\G\<([a-z-_][a-z-_ ]+[a-z-_])\>/cg) { - return AddHtmlEnvironment('span', 'class="' . join(' ', map {"$DivFooPrefix$_"} split /\s+/, $1) . '"'); + if (m/\G \< ([a-z-_][a-z-_ ]+[a-z-_]) (\?(.*?(?=\>)))? \> /cgx) { + my $title = $3 ? ' title="' . QuoteHtml($3) . '"' : ''; + return AddHtmlEnvironment('span', 'class="' . join(' ', map {"$DivFooPrefix$_"} split /\s+/, $1) . '"' . $title); } - if (m/\G\<\/\/\>/cg) { + if (m/\G \< \/ \/ \> /cgx) { return CloseHtmlEnvironment('div') . (InElement('div') ? '' : AddHtmlEnvironment('p')); } - if (m/\G\<\/\>/cg) { + if (m/\G \< \/ \> /cgx) { return CloseHtmlEnvironment('span'); } return undef;