--- loncom/publisher/lonpublisher.pm 2002/08/07 19:45:05 1.86 +++ loncom/publisher/lonpublisher.pm 2002/08/07 19:50:22 1.87 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Publication Handler # -# $Id: lonpublisher.pm,v 1.86 2002/08/07 19:45:05 albertel Exp $ +# $Id: lonpublisher.pm,v 1.87 2002/08/07 19:50:22 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -299,7 +299,36 @@ sub get_max_ids_indices { return ($needsfixup,$maxid,$maxindex); } -#Arguably this should all be done as an lonnet::ssi instead +sub get_all_text_unbalanced { + #there is a copy of this in lonxml.pm + my($tag,$pars)= @_; + my $token; + my $result=''; + $tag='<'.$tag.'>'; + while ($token = $$pars[-1]->get_token) { + if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) { + $result.=$token->[1]; + } elsif ($token->[0] eq 'PI') { + $result.=$token->[2]; + } elsif ($token->[0] eq 'S') { + $result.=$token->[4]; + } elsif ($token->[0] eq 'E') { + $result.=$token->[2]; + } + if ($result =~ /(.*)$tag(.*)/) { + &Apache::lonnet::logthis('Got a winner with leftovers ::'.$2); + &Apache::lonnet::logthis('Result is :'.$1); + $result=$1; + my $redo=$tag.$2; + push (@$pars,HTML::LCParser->new(\$redo)); + $$pars[-1]->xml_mode('1'); + last; + } + } + return $result +} + +#Arguably this should all be done as a lonnet::ssi instead sub fix_ids_and_indices { my ($logfile,$source,$target)=@_; @@ -413,6 +442,9 @@ sub fix_ids_and_indices { } if (!$endtag) { if ($token->[4]=~m:/>$:) { $endtag=' /'; }; } $outstring.='<'.$tag.$newparmstring.$endtag.'>'; + if ($lctag eq 'm') { + $outstring.=&get_all_text_unbalanced('/m',\@parser); + } } elsif ($token->[0] eq 'E') { if ($token->[2]) { unless ($token->[1] eq 'allow') {