forked from github/kensanata.oddmuse
div-foo.pl: syntax for setting the "title" attribute; /x in regexes
The syntax is <class1 class2?My title stuff> ... </>
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user