[LON-CAPA-cvs] cvs: loncom /publisher lonpublisher.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Wed, 07 Aug 2002 19:50:22 -0000
albertel Wed Aug 7 15:50:22 2002 EDT
Modified files:
/loncom/publisher lonpublisher.pm
Log:
- should handle < and > inside <m> when publishing
Index: loncom/publisher/lonpublisher.pm
diff -u loncom/publisher/lonpublisher.pm:1.86 loncom/publisher/lonpublisher.pm:1.87
--- loncom/publisher/lonpublisher.pm:1.86 Wed Aug 7 15:45:05 2002
+++ loncom/publisher/lonpublisher.pm Wed Aug 7 15:50:22 2002
@@ -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 @@
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 @@
}
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') {