--- loncom/xml/lonxml.pm 2002/12/06 17:49:48 1.217
+++ loncom/xml/lonxml.pm 2003/03/19 21:57:59 1.221.2.3
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.217 2002/12/06 17:49:48 matthew Exp $
+# $Id: lonxml.pm,v 1.221.2.3 2003/03/19 21:57:59 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -101,7 +101,6 @@ use Apache::File();
use Apache::loncommon();
use Apache::lonfeedback();
use Apache::lonmsg();
-use Apache::lonmenu();
use Apache::loncacc();
#================================================== Main subroutine: xmlparse
@@ -353,7 +352,7 @@ sub printtokenheader {
if ($target eq 'web') {
my %idhash=&Apache::lonnet::idrget($tudom,($tuname));
return
- ''.
+ ''.
'Checked out for '.$plainname.
'
User: '.$tuname.' at '.$tudom.
'
ID: '.$idhash{$tuname}.
@@ -541,7 +540,7 @@ ENDPARM
menu.clearbut(7,3);
menu.menucltim=menu.setTimeout(
'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+
- 'clearbut(9,1);clearbut(9,2);clearbut(9,3);clearbut(6,3)',
+ 'clearbut(9,1);clearbut(9,2);clearbut(9,3);clearbut(6,3);clearbut(6,1)',
2000);
}
@@ -694,7 +693,8 @@ sub inner_xmlparse {
if ($metamode<1) {
my $text=$token->[1];
if ($token->[0] eq 'C' && $target eq 'tex') {
- $text = '%'.$text."\n";
+ $text = '';
+# $text = '%'.$text."\n";
}
$result.=$text;
}
@@ -772,7 +772,7 @@ sub inner_xmlparse {
if ($token->[0] eq 'E') {
&end_tag($stack,$parstack,$token);
}
- }
+ }
if ($#$pars > -1) {
pop @$pars;
pop @Apache::lonxml::pwd;
@@ -814,13 +814,13 @@ sub callsub {
}
if (!$deleted) {
if ($space) {
- &Apache::lonxml::debug("Calling sub $sub in $space $metamode");
+ #&Apache::lonxml::debug("Calling sub $sub in $space $metamode");
$sub1="$space\:\:$sub";
($currentstring,$nodefault) = &$sub1($target,$token,$tagstack,
$parstack,$parser,$safeeval,
$style);
} else {
- &Apache::lonxml::debug("NOT Calling sub $sub in $space $metamode");
+ #&Apache::lonxml::debug("NOT Calling sub $sub in $space $metamode");
if ($metamode <1) {
if (defined($token->[4]) && ($metamode < 1)) {
$currentstring = $token->[4];
@@ -832,7 +832,7 @@ sub callsub {
# &Apache::lonxml::debug("nodefalt:$nodefault:");
if ($currentstring eq '' && $nodefault eq '') {
if ($target eq 'edit') {
- &Apache::lonxml::debug("doing default edit for $token->[1]");
+ #&Apache::lonxml::debug("doing default edit for $token->[1]");
if ($token->[0] eq 'S') {
$currentstring = &Apache::edit::tag_start($target,$token);
} elsif ($token->[0] eq 'E') {
@@ -1114,7 +1114,9 @@ sub store_counter {
sub get_all_text {
my($tag,$pars)= @_;
&Apache::lonxml::debug("Got a ".ref($pars));
+ my $gotfullstack=1;
if (ref($pars) ne 'ARRAY') {
+ $gotfullstack=0;
$pars=[$pars];
}
my $depth=0;
@@ -1123,7 +1125,8 @@ sub get_all_text {
if ( $tag =~ m:^/: ) {
my $tag=substr($tag,1);
#&Apache::lonxml::debug("have:$tag:");
- while (($depth >=0) && ($#$pars > -1)) {
+ my $top_empty=0;
+ while (($depth >=0) && ($#$pars > -1) && (!$top_empty)) {
while (($depth >=0) && ($token = $$pars[-1]->get_token)) {
#&Apache::lonxml::debug("e token:$token->[0]:$depth:$token->[1]:".$#$pars.":".$#Apache::lonxml::pwd);
if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) {
@@ -1145,6 +1148,16 @@ sub get_all_text {
pop(@$pars);
pop(@Apache::lonxml::pwd);
}
+ if (($depth >=0) && ($#$pars == 0) ) { &debug("here4");$top_empty=1; }
+ }
+ if ($top_empty && $depth >= 0) {
+ #never found the end tag ran out of text, throw error send back blank
+ &error('Never found end tag for <'.$tag.'>');
+ if ($gotfullstack) {
+ my $newstring=''.$tag.'>'.$result;
+ &Apache::lonxml::newparser($pars,\$newstring);
+ }
+ $result='';
}
} else {
while ($#$pars > -1) {