--- loncom/xml/lonxml.pm 2015/02/22 18:40:18 1.552 +++ loncom/xml/lonxml.pm 2015/04/06 16:27:12 1.553 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.552 2015/02/22 18:40:18 raeburn Exp $ +# $Id: lonxml.pm,v 1.553 2015/04/06 16:27:12 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -368,6 +368,8 @@ sub inner_xmlparse { my $result; my $token; my $dontpop=0; + my $lastdontpop; + my $lastendtag; my $startredirection = $Apache::lonxml::redirection; while ( $#$pars > -1 ) { while ($token = $$pars['-1']->get_token) { @@ -463,17 +465,29 @@ sub inner_xmlparse { } $result = ''; - if ($token->[0] eq 'E' && !$dontpop) { - &end_tag($stack,$parstack,$token); + if ($token->[0] eq 'E') { + if ($dontpop) { + $lastdontpop = $token; + } else { + $lastendtag = $token->[1]; + &end_tag($stack,$parstack,$token); + } } $dontpop=0; - } + } if ($#$pars > -1) { pop @$pars; pop @Apache::lonxml::pwd; } } + if (($#$stack == 0) && ($stack->[0] eq 'physnet') && ($target eq 'web') && + ($lastendtag eq 'LONCAPA_INTERNAL_TURN_STYLE_ON')) { + if ((ref($lastdontpop) eq 'ARRAY') && ($lastdontpop->[1] eq 'physnet')) { + &end_tag($stack,$parstack,$lastdontpop); + } + } + # if ($target eq 'meta') { # $finaloutput.=&endredirection; # } @@ -1460,13 +1474,15 @@ SIMPLECONTENT sub verify_html { my ($filecontents)=@_; - my ($is_html,$is_xml); + my ($is_html,$is_xml,$is_physnet); if ($filecontents =~/(?:\<|\<\;)\?xml[^\<]*\?(?:\>|\>\;)/is) { $is_xml = 1; } elsif ($filecontents =~/(?:\<|\<\;)html(?:\s+[^\<]+|\s*)(?:\>|\>\;)/is) { $is_html = 1; + } elsif ($filecontents =~/(?:\<|\<\;)physnet[^\<]*(?:\>|\>\;)/is) { + $is_physnet = 1; } - unless ($is_xml || $is_html) { + unless ($is_xml || $is_html || $is_physnet) { return &mt('File does not have [_1] or [_2] starting tag','<html>','<?xml ?>'); } if ($is_html) {