version 1.8, 2016/01/20 00:40:39
|
version 1.9, 2016/01/21 22:09:38
|
Line 128 sub post_xml {
|
Line 128 sub post_xml {
|
|
|
remove_useless_notsolved($root); |
remove_useless_notsolved($root); |
|
|
|
fix_comments($root); |
|
|
fix_paragraphs_inside($root, \@all_block); |
fix_paragraphs_inside($root, \@all_block); |
|
|
remove_empty_style($root); |
remove_empty_style($root); |
Line 1809 sub remove_useless_notsolved {
|
Line 1811 sub remove_useless_notsolved {
|
} |
} |
} |
} |
} |
} |
|
|
|
# Use <pre> for multi-line comments without elements. |
|
sub fix_comments { |
|
my ($root) = @_; |
|
my $doc = $root->ownerDocument; |
|
my @comments = $root->getElementsByTagName('comment'); |
|
foreach my $comment (@comments) { |
|
my $first = $comment->firstChild; |
|
if (defined $first) { |
|
if ($first->nodeType == XML_TEXT_NODE && $first->nodeValue =~ /\n/ && |
|
!defined $first->nextSibling) { |
|
my $pre = $doc->createElement('pre'); |
|
$comment->removeChild($first); |
|
$comment->appendChild($pre); |
|
$pre->appendChild($first); |
|
} |
|
} |
|
} |
|
} |
|
|
# adds a paragraph inside if needed and calls fix_paragraph for all paragraphs (including new ones) |
# adds a paragraph inside if needed and calls fix_paragraph for all paragraphs (including new ones) |
sub fix_paragraphs_inside { |
sub fix_paragraphs_inside { |