| 141 |
my $tag = shift; |
my $tag = shift; |
| 142 |
my $new_class = shift; # should not contain bare & and bare " |
my $new_class = shift; # should not contain bare & and bare " |
| 143 |
|
|
| 144 |
if ($tag =~ /\bclass="/) { |
if ($tag =~ /^<li\b/) { |
| 145 |
|
## NOTE: This |p| wrapper is necessary, otherwise, if |li| element |
| 146 |
|
## is set to |display: table|, then no list marker is shown. |
| 147 |
|
$tag .= qq[<p class="$new_class ja-translation-inserted">]; |
| 148 |
|
} elsif ($tag =~ /\bclass="/) { |
| 149 |
$tag =~ s/\bclass="([^"]*)"/class="$1 $new_class"/; |
$tag =~ s/\bclass="([^"]*)"/class="$1 $new_class"/; |
| 150 |
} elsif ($tag =~ /\bclass=/) { |
} elsif ($tag =~ /\bclass=/) { |
| 151 |
$tag =~ s/\bclass=([^\s>]+)/class="$1 $new_class"/g; |
$tag =~ s/\bclass=([^\s>]+)/class="$1 $new_class"/g; |