--- loncom/xml/londefdef.pm 2001/12/07 22:23:37 1.36 +++ loncom/xml/londefdef.pm 2002/01/17 17:42:34 1.40 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.36 2001/12/07 22:23:37 albertel Exp $ +# $Id: londefdef.pm,v 1.40 2002/01/17 17:42:34 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -45,7 +45,7 @@ package Apache::londefdef; use strict; use Apache::lonxml; -sub BEGIN { +BEGIN { &Apache::lonxml::register('Apache::londefdef',('m','html','head','map','select','option','input','textarea','form','meta','title','body','center','b','strong','table','dt','h1','h2','h3','h4','h5','h6','cite','i','address','dd','dl','dir','ol','ul','menu','dfn','kbd','tt','code','em','q','p','br','big','small','basefont','font','s','sub','strike','sup','hr','a','li','u','output','param','applet','img','embed','tr','td','allow','frameset')); @@ -70,13 +70,18 @@ sub start_m { if ($target eq 'web') { my $inside = &Apache::lonxml::get_all_text("/m",$$parser[-1]); $inside ='\\documentstyle{article}'.$inside; - #&Apache::lonxml::debug("M is starting with:$inside:"); + &Apache::lonxml::debug("M is starting with:$inside:"); my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval); if ($eval eq 'on') { $inside=&Apache::run::evaluate($inside,$safeeval,$$parstack[-1]); #&Apache::lonxml::debug("M is evaulated to:$inside:"); } $currentstring = &Apache::lontexconvert::converted(\$inside); + if ($Apache::lontexconvert::errorstring) { + &Apache::lonxml::warning("tth error: ". + $Apache::lontexconvert::errorstring); + $Apache::lontexconvert::errorstring=''; + } #&Apache::lonxml::debug("M is ends with:$currentstring:"); } elsif ($target eq 'tex') { $currentstring = ""; @@ -96,7 +101,12 @@ sub end_m { #-- tag sub start_html { my ($target,$token) = @_; - my $currentstring = ''; + my $currentstring = ''; + if ($ENV{'browser.mathml'}) { + &tth::ttminit(); + } else { + &tth::tthinit(); + } if ($target eq 'web') { $currentstring = &Apache::lonxml::xmlbegin(). &Apache::lonxml::fontsettings(); @@ -337,10 +347,17 @@ sub end_m { &Apache::lonxml::unloadevents(); $currentstring .= '<'.$token->[1]; - map { - $currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"'; - } keys %{$token->[2]}; + foreach (keys %{$token->[2]}) { + $currentstring.=' '.$_.'="'.$token->[2]->{$_}.'"'; + } $currentstring.='>'; + if ($ENV{'request.state'} ne 'published') { + $currentstring.=(< + + +EDITBUTTON + } } elsif ($target eq 'tex') { $currentstring = '\begin{document}'; }