use DevHelp::HTML;
use Carp 'confess';
-our $VERSION = "1.003";
+our $VERSION = "1.004";
use constant DEBUG => 0;
sub replace_char {
my ($self, $rpart) = @_;
- $$rpart =~ s#(acronym|abbr|dfn)\[(?:\r?\n)?([^|\]\[]+)\|([^\]\[]+)\|([^\]\[]+?)(?:\r?\n)?\]#
+ $$rpart =~ s#(acronym|abbr|dfn|cite)\[(?:\r?\n)?([^|\]\[]+)\|([^\]\[]+)\|([^\]\[]+?)(?:\r?\n)?\]#
$self->_fix_spanned(qq/<$1 class="$3" title="$2">/, "</$1>", $4)#egi
and return 1;
- $$rpart =~ s#(acronym|abbr|dfn)\[(?:\r?\n)?([^|\]\[]+)\|([^\]\[]+?)(?:\r?\n)?\]#
+ $$rpart =~ s#(acronym|abbr|dfn|cite)\[(?:\r?\n)?([^|\]\[]+)\|([^\]\[]+?)(?:\r?\n)?\]#
$self->_fix_spanned(qq/<$1 title="$2">/, "</$1>", $3)#egi
and return 1;
- $$rpart =~ s#(acronym|abbr|dfn)\[(?:\r?\n)?\|([^\]\[]+?)(?:\r?\n)?\]#
+ $$rpart =~ s#(acronym|abbr|dfn|cite)\[(?:\r?\n)?\|([^\]\[]+?)(?:\r?\n)?\]#
$self->_fix_spanned("<$1>", "</$1>", $2)#egi
and return 1;
- $$rpart =~ s#(acronym|abbr|dfn)\[(?:\r?\n)?([^\]\[]+?)(?:\r?\n)?\]#
+ $$rpart =~ s#(acronym|abbr|dfn|cite)\[(?:\r?\n)?([^\]\[]+?)(?:\r?\n)?\]#
$self->_fix_spanned("<$1>", "</$1>", $2)#egi
and return 1;
$$rpart =~ s#bdo\[(?:\r?\n)?([^|\]\[]+)\|([^\]\[]+?)(?:\r?\n)?\]#
$self->_fix_spanned(qq/<bdo dir="$1">/, "</bdo>", $2)#egi
and return 1;
- $$rpart =~ s#(strong|em|samp|code|var|sub|sup|kbd|q|b|i|tt|span)\[(?:\r?\n)?([^|\]\[]+)\|([^\]\[]+?)(?:\r?\n)?\]#
+ $$rpart =~ s#(strong|em|samp|code|var|sub|sup|kbd|q|b|i|tt|span|small|large)\[(?:\r?\n)?([^|\]\[]+)\|([^\]\[]+?)(?:\r?\n)?\]#
$self->_fix_spanned(qq/<$1 class="$2">/, "</$1>", $3)#egi
and return 1;
- $$rpart =~ s#(strong|em|samp|code|var|sub|sup|kbd|q|b|i|tt|span)\[(?:\r?\n)?\|([^\]\[]+?)(?:\r?\n)?\]#
+ $$rpart =~ s#(strong|em|samp|code|var|sub|sup|kbd|q|b|i|tt|span|small|large)\[(?:\r?\n)?\|([^\]\[]+?)(?:\r?\n)?\]#
$self->_fix_spanned("<$1>", "</$1>", $2)#egi
and return 1;
- $$rpart =~ s#(strong|em|samp|code|var|sub|sup|kbd|q|b|i|tt|span)\[(?:\r?\n)?([^\]\[]+?)(?:\r?\n)?\]#
+ $$rpart =~ s#(strong|em|samp|code|var|sub|sup|kbd|q|b|i|tt|span|small|large)\[(?:\r?\n)?([^\]\[]+?)(?:\r?\n)?\]#
$self->_fix_spanned("<$1>", "</$1>", $2)#egi
and return 1;
$$rpart =~ s#poplink\[([^|\]\[]+)\|([^\]\[]+)\]#
TRY: while (1) {
$self->remove(\$part)
and next TRY;
- $part =~ s#(?:acronym|abbr|dfn)\[([^|\]\[]+)\|([^\]\[]+)\|([^\]\[]*)\]#$3#ig
+ $part =~ s#(?:acronym|abbr|dfn|cite)\[([^|\]\[]+)\|([^\]\[]+)\|([^\]\[]*)\]#$3#ig
and next TRY;
- $part =~ s#(?:acronym|abbr|dfn|bdo)\[([^|\]\[]+)\|([^\]\[]*)\]#$2#ig
+ $part =~ s#(?:acronym|abbr|dfn|cite|bdo)\[([^|\]\[]+)\|([^\]\[]*)\]#$2#ig
and next TRY;
- $part =~ s#(?:acronym|abbr|dfn|bdo)\[\|([^|\]\[]*)\]#$1#ig
+ $part =~ s#(?:acronym|abbr|dfn|cite|bdo)\[\|([^|\]\[]*)\]#$1#ig
and next TRY;
- $part =~ s#(?:acronym|abbr|dfn)\[([^|\]\[]*)\]#$1#ig
+ $part =~ s#(?:acronym|abbr|dfn|cite)\[([^|\]\[]*)\]#$1#ig
and next TRY;
- $part =~ s#(?:strong|em|samp|code|var|sub|sup|kbd|q|address|blockquote|b|i|tt|span)\[([^|\]\[]+)\|([^\]\[]*)\]#$2#ig
+ $part =~ s#(?:strong|em|samp|code|var|sub|sup|kbd|q|address|blockquote|b|i|tt|span|small|large)\[([^|\]\[]+)\|([^\]\[]*)\]#$2#ig
and next TRY;
- $part =~ s#(?:strong|em|samp|code|var|sub|sup|kbd|q|address|blockquote|b|i|tt|span)\[\|([^\]\[]*)\]#$1#ig
+ $part =~ s#(?:strong|em|samp|code|var|sub|sup|kbd|q|address|blockquote|b|i|tt|span|small|large)\[\|([^\]\[]*)\]#$1#ig
and next TRY;
- $part =~ s#(?:strong|em|samp|code|var|sub|sup|kbd|q|address|blockquote|b|i|tt|span)\[([^\]\[]*)\]#$1#ig
+ $part =~ s#(?:strong|em|samp|code|var|sub|sup|kbd|q|address|blockquote|b|i|tt|span|small|large)\[([^\]\[]*)\]#$1#ig
and next TRY;
$part =~ s#div\[([^\[\]\|]+)\|([^\[\]]*)\](?:\r?\n)?#$2#ig
and next TRY;
format_test 'blockquote[hello]', '<blockquote><p>hello</p></blockquote>', 'blockquote';
format_test 'blockquote[|hello]', '<blockquote><p>hello</p></blockquote>', 'blockquote with empty class';
format_test 'blockquote[foo|hello]', '<blockquote class="foo"><p>hello</p></blockquote>', 'blockquote with class';
+ format_test 'cite[hello]', '<p><cite>hello</cite></p>', 'cite';
+ format_test 'cite[|hello]', '<p><cite>hello</cite></p>', 'cite with empty title';
+ format_test 'cite[foo|hello]', '<p><cite title="foo">hello</cite></p>', 'cite with title';
+ format_test 'cite[foo|bar|hello]', '<p><cite class="bar" title="foo">hello</cite></p>', 'cite with class and title';
+ format_test 'small[hello]', '<p><small>hello</small></p>', 'small';
+ format_test 'small[|hello]', '<p><small>hello</small></p>', 'small empty class';
+ format_test 'small[foo|hello]', '<p><small class="foo">hello</small></p>', 'small with class';
+ format_test 'large[hello]', '<p><large>hello</large></p>', 'large';
+ format_test 'large[|hello]', '<p><large>hello</large></p>', 'large empty class';
+ format_test 'large[foo|hello]', '<p><large class="foo">hello</large></p>', 'large with class';
format_test <<IN, <<OUT, 'strong over paras', 'both';
strong[foo|hello