Diff for /loncom/xml/lonxml.pm between versions 1.96 and 1.97

version 1.96, 2001/06/16 18:34:31 version 1.97, 2001/06/26 21:45:28
Line 278  sub xmlparse { Line 278  sub xmlparse {
        #clear out any tags that didn't end         #clear out any tags that didn't end
        while ($token->[1] ne $stack[$#stack] && ($#stack > -1)) {         while ($token->[1] ne $stack[$#stack] && ($#stack > -1)) {
  &Apache::lonxml::warning("Unbalanced tags in resource $stack['-1']");   &Apache::lonxml::warning("Unbalanced tags in resource $stack['-1']");
  pop @stack;pop @parstack;&decreasedepth($token);   &end_tag(\@stack,\@parstack,$token);
        }         }
                 
        if (exists $style_for_target{'/'."$token->[1]"}) {         if (exists $style_for_target{'/'."$token->[1]"}) {
Line 315  sub xmlparse { Line 315  sub xmlparse {
        $result = '';         $result = '';
      }        } 
      if ($token->[0] eq 'E') {        if ($token->[0] eq 'E') { 
        pop @stack;pop @parstack;&decreasedepth($token);         &end_tag(\@stack,\@parstack,$token);
      }       }
    }     }
    pop @pars;     pop @pars;
Line 363  sub recurse { Line 363  sub recurse {
  while ($tokenpat->[1] ne $innerstack[$#innerstack]    while ($tokenpat->[1] ne $innerstack[$#innerstack] 
        && ($#innerstack > -1)) {         && ($#innerstack > -1)) {
   &Apache::lonxml::warning("Unbalanced tags in resource $innerstack['-1']");    &Apache::lonxml::warning("Unbalanced tags in resource $innerstack['-1']");
   pop @innerstack;pop @innerparstack;&decreasedepth($tokenpat);    &end_tag(\@innerstack,\@innerparstack,$tokenpat);
  }   }
  $partstring = &callsub("end_$tokenpat->[1]", $target, $tokenpat,   $partstring = &callsub("end_$tokenpat->[1]", $target, $tokenpat,
        \@innerstack, \@innerparstack, \@pat,         \@innerstack, \@innerparstack, \@pat,
Line 413  sub callsub { Line 413  sub callsub {
  $sub=~tr/A-Z/a-z/;   $sub=~tr/A-Z/a-z/;
  $space=$Apache::lonxml::alltags{$tag}   $space=$Apache::lonxml::alltags{$tag}
     }      }
     if ($space) {  
       #&Apache::lonxml::debug("Calling sub $sub in $space $metamode<br />\n");      my $deleted=0;
       $sub1="$space\:\:$sub";      $Apache::lonxml::curdepth=join('_',@Apache::lonxml::depthcounter);
       $Apache::lonxml::curdepth=join('_',@Apache::lonxml::depthcounter);      if (($token->[0] eq 'S') && ($target eq 'modified')) {
       ($currentstring,$nodefault) = &$sub1($target,$token,$tagstack,        $deleted=&Apache::edit::handle_delete($space,$target,$token,$tagstack,
    $parstack,$parser,$safeeval,       $parstack,$parser,$safeeval,
    $style);       $style);
     } else {  
       #&Apache::lonxml::debug("NOT Calling sub $sub in $space $metamode<br />\n");  
       if ($metamode <1) {  
  if (defined($token->[4]) && ($metamode < 1)) {  
   $currentstring = $token->[4];  
  } else {  
   $currentstring = $token->[2];  
  }  
       }  
     }      }
 #    &Apache::lonxml::debug("nodefalt:$nodefault:");      if (!$deleted) {
     if ($currentstring eq '' && $nodefault eq '') {        if ($space) {
       if ($target eq 'edit') {   #&Apache::lonxml::debug("Calling sub $sub in $space $metamode<br />\n");
  &Apache::lonxml::debug("doing default edit for $token->[1]");   $sub1="$space\:\:$sub";
  if ($token->[0] eq 'S') {   ($currentstring,$nodefault) = &$sub1($target,$token,$tagstack,
   $currentstring = &Apache::edit::tag_start($target,$token);       $parstack,$parser,$safeeval,
  } elsif ($token->[0] eq 'E') {       $style);
   $currentstring = &Apache::edit::tag_end($target,$token);        } else {
    #&Apache::lonxml::debug("NOT Calling sub $sub in $space $metamode<br />\n");
    if ($metamode <1) {
     if (defined($token->[4]) && ($metamode < 1)) {
       $currentstring = $token->[4];
     } else {
       $currentstring = $token->[2];
     }
  }   }
       } elsif ($target eq 'modified') {        }
  if ($token->[0] eq 'S') {        #    &Apache::lonxml::debug("nodefalt:$nodefault:");
   $currentstring = $token->[4];        if ($currentstring eq '' && $nodefault eq '') {
   $currentstring.=&Apache::edit::handle_insert();   if ($target eq 'edit') {
  } else {    &Apache::lonxml::debug("doing default edit for $token->[1]");
   $currentstring = $token->[2];    if ($token->[0] eq 'S') {
       $currentstring = &Apache::edit::tag_start($target,$token);
     } elsif ($token->[0] eq 'E') {
       $currentstring = &Apache::edit::tag_end($target,$token);
     }
    } elsif ($target eq 'modified') {
     if ($token->[0] eq 'S') {
       $currentstring = $token->[4];
       $currentstring.=&Apache::edit::handle_insert();
     } else {
       $currentstring = $token->[2];
     }
  }   }
       }        }
     }      }
Line 553  sub endredirection { Line 562  sub endredirection {
   pop @Apache::lonxml::outputstack;    pop @Apache::lonxml::outputstack;
 }  }
   
   sub end_tag {
     my ($tagstack,$parstack,$token)=@_;
     pop(@$tagstack);
     pop(@$parstack);
     &decreasedepth($token);
   }
   
 sub initdepth {  sub initdepth {
   @Apache::lonxml::depthcounter=();    @Apache::lonxml::depthcounter=();
   $Apache::lonxml::depth=-1;    $Apache::lonxml::depth=-1;

Removed from v.1.96  
changed lines
  Added in v.1.97


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>