--- loncom/xml/lonxml.pm 2002/11/13 23:21:07 1.215 +++ loncom/xml/lonxml.pm 2002/12/06 17:49:48 1.217 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # XML Parser Module # -# $Id: lonxml.pm,v 1.215 2002/11/13 23:21:07 albertel Exp $ +# $Id: lonxml.pm,v 1.217 2002/12/06 17:49:48 matthew Exp $ # # Copyright Michigan State University Board of Trustees # @@ -101,6 +101,8 @@ use Apache::File(); use Apache::loncommon(); use Apache::lonfeedback(); use Apache::lonmsg(); +use Apache::lonmenu(); +use Apache::loncacc(); #================================================== Main subroutine: xmlparse #debugging control, to turn on debugging modify the correct handler @@ -144,8 +146,8 @@ $Apache::lonxml::registered=0; # a pointer the the Apache request object $Apache::lonxml::request=''; -# a problem number counter, and check on hether it is used -$Apache::lonxml::counter=0; +# a problem number counter, and check on ether it is used +$Apache::lonxml::counter=1; $Apache::lonxml::counter_changed=0; #internal check on whether to look at style defs @@ -373,6 +375,18 @@ sub fontsettings() { return $headerstring; } + +## +## switchmenu - modeled on lonmenu::switchmenu, but better. +## Helper function for registerurl +## +sub switchmenu { + my ($row,$col,$imgsrc,$texttop,$textbot,$action,$description)=@_; + return(< @@ -456,6 +526,7 @@ ENDPARM menu.switchbutton (9,3,'anot.gif','anno-','tations','annotate()','Make notes and annotations about this resource'); $hwkadd + $editbutton } function LONCAPAstale() { @@ -598,7 +669,7 @@ sub htmlclean { sub latex_special_symbols { my ($current_token,$stack,$parstack)=@_; - $current_token=~s/\\/\\char92 /g; + $current_token=~s/\\ /\\char92 /g; $current_token=~s/\^/\\char94 /g; $current_token=~s/\~/\\char126 /g; $current_token=~s/(&[^a-z\#])/\\$1/g; @@ -623,8 +694,7 @@ sub inner_xmlparse { if ($metamode<1) { my $text=$token->[1]; if ($token->[0] eq 'C' && $target eq 'tex') { - $text = '%'.$text; - $text =~ s/[\n\r]//g; + $text = '%'.$text."\n"; } $result.=$text; } @@ -716,7 +786,7 @@ sub inner_xmlparse { if (($ENV{'QUERY_STRING'}) && ($target eq 'web')) { $finaloutput=&afterburn($finaloutput); - } + } return $finaloutput; }