version 1.4, 2015/12/18 22:07:42
|
version 1.5, 2016/01/06 16:44:32
|
Line 150 sub fix_structure {
|
Line 150 sub fix_structure {
|
# the root element has already been added in pre_xml |
# the root element has already been added in pre_xml |
my $root = $doc->documentElement; |
my $root = $doc->documentElement; |
# inside the root, replace html, problem and library elements by their content |
# inside the root, replace html, problem and library elements by their content |
my @toreplace = ('html','problem','library'); |
my @toreplace = ('html','problem','library','Task'); |
foreach my $name (@toreplace) { |
foreach my $name (@toreplace) { |
my @elements = $root->getElementsByTagName($name); |
my @elements = $root->getElementsByTagName($name); |
foreach my $element (@elements) { |
foreach my $element (@elements) { |
Line 1812 sub remove_useless_notsolved {
|
Line 1812 sub remove_useless_notsolved {
|
sub fix_paragraphs_inside { |
sub fix_paragraphs_inside { |
my ($node, $all_block) = @_; |
my ($node, $all_block) = @_; |
# blocks in which paragrahs will be added: |
# blocks in which paragrahs will be added: |
my @blocks_with_p = ('loncapa','library','problem','part','problemtype','window','block','while','postanswerdate','preduedate','solved','notsolved','languageblock','instructorcomment','togglebox','standalone','form'); |
my @blocks_with_p = ('loncapa','library','problem','part','problemtype','window','block','while','postanswerdate','preduedate','solved','notsolved','languageblock','instructorcomment','togglebox','standalone','body','form'); |
my @fix_p_if_br_or_p = (@responses,'foil','item','text','label','hintgroup','hintpart','hint','web','windowlink','div','li','dd','td','th','blockquote'); |
my @fix_p_if_br_or_p = (@responses,'foil','item','text','label','hintgroup','hintpart','hint','web','windowlink','div','li','dd','td','th','blockquote'); |
if ((string_in_array(\@blocks_with_p, $node->nodeName) && paragraph_needed($node)) || |
if ((string_in_array(\@blocks_with_p, $node->nodeName) && paragraph_needed($node)) || |
(string_in_array(\@fix_p_if_br_or_p, $node->nodeName) && paragraph_inside($node))) { |
(string_in_array(\@fix_p_if_br_or_p, $node->nodeName) && paragraph_inside($node))) { |