--- loncom/xml/londefdef.pm 2001/01/04 19:15:20 1.14 +++ loncom/xml/londefdef.pm 2001/01/17 17:41:48 1.18 @@ -10,7 +10,9 @@ use strict; use Apache::lonxml; sub BEGIN { - &Apache::lonxml::register('Apache::londefdef',('m','html','head','map','applet','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')); + + &Apache::lonxml::register('Apache::londefdef',('m','html','head','map','applet','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')); + } #===================================================================== TAG SUBROUTINES @@ -289,6 +291,8 @@ sub BEGIN { $currentstring = $token->[4]; } elsif ($target eq 'tex') { $currentstring = " \\begin{center} "; + } elsif ($target eq 'latexsource') { + $currentstring = " \\begin{center} "; } return $currentstring; } @@ -299,6 +303,8 @@ sub BEGIN { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = " \\end{center}"; + } elsif ($target eq 'latexsource') { + $currentstring = " \\end{center}"; } return $currentstring; } @@ -309,7 +315,9 @@ sub BEGIN { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - $currentstring = " {\\bf "; + $currentstring = " \\textbf{"; + } elsif ($target eq 'latexsource') { + $currentstring = " \\textbf{"; } return $currentstring; } @@ -320,6 +328,8 @@ sub BEGIN { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = "}"; + } elsif ($target eq 'latexsource') { + $currentstring = "}"; } return $currentstring; } @@ -330,7 +340,9 @@ sub BEGIN { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - $currentstring = " {\\bf "; + $currentstring = " \\textbf{"; + } elsif ($target eq 'latexsource') { + $currentstring = " \\textbf{"; } return $currentstring; } @@ -342,6 +354,8 @@ sub BEGIN { $currentstring = $token->[2]; } elsif ($target eq 'tex') { $currentstring = "}"; + } elsif ($target eq 'latexsource') { + $currentstring = "}"; } return $currentstring; } @@ -484,7 +498,9 @@ sub BEGIN { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "{ \\it "; + $currentstring .= "\\textit{"; + } elsif ($target eq 'latexsource') { + $currentstring .= "\\textit{"; } return $currentstring; } @@ -495,6 +511,8 @@ sub BEGIN { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; + } elsif ($target eq 'latexsource') { + $currentstring .= "}"; } return $currentstring; } @@ -505,7 +523,9 @@ sub BEGIN { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "{ \\it "; + $currentstring .= "\\textit{"; + } elsif ($target eq 'latexsource') { + $currentstring .= "\\textit{"; } return $currentstring; } @@ -516,6 +536,8 @@ sub BEGIN { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; + } elsif ($target eq 'latexsource') { + $currentstring .= "}"; } return $currentstring; } @@ -526,7 +548,9 @@ sub BEGIN { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "{ \\it "; + $currentstring .= "\\textit{"; + } elsif ($target eq 'latexsource') { + $currentstring .= "\\textit{"; } return $currentstring; } @@ -537,6 +561,8 @@ sub BEGIN { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; + } elsif ($target eq 'latexsource') { + $currentstring .= "}"; } return $currentstring; } @@ -547,7 +573,9 @@ sub BEGIN { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "{ \\it "; + $currentstring .= "\\textit{"; + } elsif ($target eq 'latexsource') { + $currentstring .= "\\textit{"; } return $currentstring; } @@ -558,6 +586,8 @@ sub BEGIN { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; + } elsif ($target eq 'latexsource') { + $currentstring .= "}"; } return $currentstring; } @@ -568,7 +598,9 @@ sub BEGIN { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "{ \\tt "; + $currentstring .= "\\texttt{"; + } elsif ($target eq 'latexsource') { + $currentstring .= "\\texttt{"; } return $currentstring; } @@ -579,7 +611,9 @@ sub BEGIN { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; - } + } elsif ($target eq 'latexsource') { + $currentstring .= "}"; + } return $currentstring; } #---------------------------------------------------------------------------- tag @@ -589,7 +623,9 @@ sub BEGIN { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "{ \\tt "; + $currentstring .= "\\texttt"; + } elsif ($target eq 'latexsource') { + $currentstring .= "\\texttt{"; } return $currentstring; } @@ -600,6 +636,8 @@ sub BEGIN { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; + } elsif ($target eq 'latexsource') { + $currentstring .= "}"; } return $currentstring; } @@ -631,7 +669,9 @@ sub BEGIN { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "{ \\emph "; + $currentstring .= "\\emph{"; + } elsif ($target eq 'latexsource') { + $currentstring .= "\\emph{"; } return $currentstring; } @@ -642,7 +682,9 @@ sub BEGIN { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; - } + } elsif ($target eq 'latexsource') { + $currentstring .= "}"; + } return $currentstring; } #----------------------------------------------------------------------------- tag @@ -652,8 +694,10 @@ sub BEGIN { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "{ \\emph "; - } + $currentstring .= "\\emph{"; + } elsif ($target eq 'latexsource') { + $currentstring .= "\\emph{"; + } return $currentstring; } sub end_q { @@ -663,7 +707,9 @@ sub BEGIN { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= "}"; - } + } elsif ($target eq 'latexsource') { + $currentstring .= "}"; + } return $currentstring; } #-----------------------------------------------------------------------------

tag @@ -674,6 +720,8 @@ sub BEGIN { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= "{\\par "; + } elsif ($target eq 'latexsource') { + $currentstring .= "{\\par "; } return $currentstring; } @@ -683,7 +731,9 @@ sub BEGIN { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - $currentstring .= " }"; + $currentstring .= "}"; + } elsif ($target eq 'latexsource') { + $currentstring .= "}"; } return $currentstring; } @@ -695,6 +745,8 @@ sub BEGIN { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= "\\\\"; + } elsif ($target eq 'latexsource') { + $currentstring .= "\\\\"; } return $currentstring; } @@ -714,7 +766,9 @@ sub BEGIN { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= "{\\large "; - } + } elsif ($target eq 'latexsource') { + $currentstring .= "{\\large "; + } return $currentstring; } sub end_big { @@ -724,6 +778,8 @@ sub BEGIN { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= " }"; + } elsif ($target eq 'latexsource') { + $currentstring .= " }"; } return $currentstring; } @@ -735,6 +791,8 @@ sub BEGIN { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { $currentstring .= "{\\footnotesize "; + } elsif ($target eq 'latexsource') { + $currentstring .= "{\\footnotesize "; } return $currentstring; } @@ -745,6 +803,8 @@ sub BEGIN { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { $currentstring .= " }"; + } elsif ($target eq 'latexsource') { + $currentstring .= " }"; } return $currentstring; } @@ -905,7 +965,7 @@ sub BEGIN { my $tempor_var = $stackref->[$#$stackref]; if (index($tempor_var,'name') != -1 ) { $tempor_var =~ s/name=([^,]*),/$1/g; - $currentstring .= " \\label{$tempor_var}"; +# $currentstring .= " \\label{$tempor_var}"; } elsif (index($tempor_var,'href') != -1 ) { $tempor_var =~ s/href=([^,]*),/$1/g; $currentstring .= " \\ref{$tempor_var}"; @@ -920,12 +980,16 @@ sub BEGIN { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - my $tempor_var = $stackref->[$#$stackref-1]; + my $tempor_var = $stackref->[$#$stackref]; if (index($tempor_var,'circle') != -1 ) { $currentstring .= " \\item[o] "; } elsif (index($tempor_var,'square') != -1 ) { $currentstring .= " \\item[$\Box$] "; - } else { + } elsif ($tempor_var ne '') { + $_ = $tempor_var; + m/my\s*([^=]*)=/; + $currentstring .= " \\item[$1] "; + } else { $currentstring .= " \\item "; } } @@ -1110,7 +1174,7 @@ sub BEGIN { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - $currentstring = " \\begin{tabular} "; + $currentstring = ""; } return $currentstring; } @@ -1120,11 +1184,52 @@ sub BEGIN { if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { - $currentstring = " \\end{tabular}"; + $currentstring = ""; + } + return $currentstring; + } +#------------------------------------------------------------------------- tag + sub start_tr { + my ($target,$token) = @_; + my $currentstring = ''; + if ($target eq 'web') { + $currentstring = $token->[4]; + } elsif ($target eq 'tex') { + $currentstring = ''; + } + return $currentstring; + } + sub end_tr { + my ($target,$token) = @_; + my $currentstring = ''; + if ($target eq 'web') { + $currentstring = $token->[2]; + } elsif ($target eq 'tex') { + $currentstring = ""; + } + return $currentstring; + } +#------------------------------------------------------------------------- tag + sub start_td { + my ($target,$token) = @_; + my $currentstring = ''; + if ($target eq 'web') { + $currentstring = $token->[4]; + } elsif ($target eq 'tex') { + $currentstring = ''; + } + return $currentstring; + } + sub end_td { + my ($target,$token) = @_; + my $currentstring = ''; + if ($target eq 'web') { + $currentstring = $token->[2]; + } elsif ($target eq 'tex') { + $currentstring = ""; } return $currentstring; } - # -------------------------------------------------------------------------- tag sub start_img {