[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /xml lonxml.pm

raeburn raeburn at source.lon-capa.org
Mon Apr 6 13:02:33 EDT 2015


raeburn		Mon Apr  6 17:02:33 2015 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/xml	lonxml.pm 
  Log:
  - For 2.11
    Backport 1.553
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.531.2.18 loncom/xml/lonxml.pm:1.531.2.19
--- loncom/xml/lonxml.pm:1.531.2.18	Wed Mar 11 13:10:56 2015
+++ loncom/xml/lonxml.pm	Mon Apr  6 17:02:33 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.531.2.18 2015/03/11 13:10:56 raeburn Exp $
+# $Id: lonxml.pm,v 1.531.2.19 2015/04/06 17:02:33 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -463,6 +463,8 @@
   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) {
@@ -558,17 +560,29 @@
       }
       $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;
   # }
@@ -1555,13 +1569,15 @@
 
 sub verify_html {
     my ($filecontents)=@_;
-    my ($is_html,$is_xml);
+    my ($is_html,$is_xml,$is_physnet);
     if ($filecontents =~/(?:\<|\&lt\;)\?xml[^\<]*\?(?:\>|\&gt\;)/is) {
         $is_xml = 1;
     } elsif ($filecontents =~/(?:\<|\&lt\;)html(?:\s+[^\<]+|\s*)(?:\>|\&gt\;)/is) {
         $is_html = 1;
+    } elsif ($filecontents =~/(?:\<|\&lt\;)physnet[^\<]*(?:\>|\&gt\;)/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) {




More information about the LON-CAPA-cvs mailing list