--- loncom/xml/londefdef.pm 2003/08/27 15:00:43 1.158.4.3 +++ loncom/xml/londefdef.pm 2003/10/14 00:21:12 1.180 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.158.4.3 2003/08/27 15:00:43 albertel Exp $ +# $Id: londefdef.pm,v 1.180 2003/10/14 00:21:12 albertel Exp $ # # # Copyright Michigan State University Board of Trustees @@ -51,6 +51,8 @@ use Image::Magick; use Apache::lonmenu(); use Apache::lonmeta(); +$Apache::londefdef::TD_redirection=0; + BEGIN { &Apache::lonxml::register('Apache::londefdef',('a','abbr','acronym','accessrule','address','allow','applet','area','b','base','basefont','bgo','bgsound','big','blink','blockquote','blankspace','body','br','button','caption','center','cite','code','col','colgroup','dd','del','dfn','dir','div','dl','dt','em','embed','externallink','fieldset','font','form','frame','frameset','h1','h2','h3','h4','h5','h6','head','hr','html','i','iframe','img','input','ins','insert','isindex','kbd','keygen','label','layer','legend','li','link','m','map','marquee','menu','meta','multicol','nobr','noembed','noframes','nolayer','noscript','object','ol','optgroup','option','output','p','param','pre','q','s','samp','select','server','small','spacer','span','strike','strong','sub','sup','table','tbody','td','textarea','tfoot','th','thead','title','tr','tt','tthoption','u','ul','var','wbr','hideweboutput')); @@ -90,9 +92,15 @@ sub start_m { $Apache::lontexconvert::errorstring=''; } #&Apache::lonxml::debug("M is ends with:$currentstring:"); + $Apache::lonxml::post_evaluate=0; } elsif ($target eq 'tex') { $currentstring = &Apache::lonxml::get_all_text_unbalanced("/m",$parser); + my $eval=&Apache::lonxml::get_param('eval',$parstack,$safeeval); + if ($eval eq 'on') { + $currentstring=&Apache::run::evaluate($currentstring,$safeeval,$$parstack[-1]); + } if ($currentstring=~/^(\s*\\\\\s*)*$/) {$currentstring = ' \vskip 0 mm ';} + $Apache::lonxml::post_evaluate=0; } else { my $inside = &Apache::lonxml::get_all_text_unbalanced("/m",$parser); } @@ -162,9 +170,11 @@ sub start_html { \renewcommand{\deg}{$^{\circ}$} \usepackage{longtable} \usepackage{textcomp} + \usepackage{makeidx} \usepackage[dvips]{graphicx} \usepackage{epsfig}\usepackage{calc} -\newenvironment{choicelist}{\begin{list}{}{\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in}\setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in}\setlength{\abovedisplayskip}{0.05in}\setlength{\abovedisplayshortskip}{-0.04in}\setlength{\belowdisplayshortskip}{0.04in}}}{\end{list}}'; +\newenvironment{choicelist}{\begin{list}{}{\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in}\setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in}\setlength{\abovedisplayskip}{0.05in}\setlength{\abovedisplayshortskip}{-0.04in}\setlength{\belowdisplayshortskip}{0.04in}}}{\end{list}} +\renewenvironment{theindex}{\begin{list}{}{{\vskip 1mm \noindent \large\textbf{Index}} \newline \setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.01in}\setlength{\itemsep}{0.1in}\setlength{\parsep}{-0.02in}\setlength{\belowdisplayskip}{0.01in}\setlength{\abovedisplayskip}{0.01in}\setlength{\abovedisplayshortskip}{-0.04in}\setlength{\belowdisplayshortskip}{0.01in}}}{\end{list}}'; } return $currentstring; } @@ -191,7 +201,7 @@ sub start_head { sub end_head { my ($target,$token) = @_; my $currentstring = ''; - if ($target eq 'web') { + if ($target eq 'web' && $ENV{'request.state'} eq 'published') { $currentstring = &Apache::lonmenu::registerurl(undef,$target). $token->[2]; } @@ -319,7 +329,7 @@ sub start_title { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= '\keephidden{' + $currentstring .= '\keephidden{Title of the document: ' } if ($target eq 'meta') { $currentstring=''; @@ -462,7 +472,12 @@ sub start_body { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { - if (!$Apache::lonxml::registered) { + if ($Apache::lonhomework::parsing_a_problem) { + &Apache::lonxml::warning("<body> tag found inside of <problem> tag this can cause problems."); + return ''; + } + if (!$Apache::lonxml::registered && + $ENV{'request.state'} eq 'published') { $currentstring.='<head>'. &Apache::lonmenu::registerurl(undef,$target).'</head>'; } @@ -533,7 +548,7 @@ sub end_body { if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { - $currentstring = '\end{document}'; + $currentstring = '\strut\newline\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}\newline\noindent \end{document}'; } return $currentstring; } @@ -879,7 +894,7 @@ sub start_cite { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "\\textit{"; + $currentstring .= '\textit{'; } return $currentstring; } @@ -890,7 +905,7 @@ sub end_cite { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - $currentstring .= "}"; + $currentstring .= '}'; } return $currentstring; } @@ -925,7 +940,7 @@ sub start_address { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "\\textit{"; + $currentstring .= '\textit{'; } return $currentstring; } @@ -936,7 +951,7 @@ sub end_address { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - $currentstring .= "}"; + $currentstring .= '}'; } return $currentstring; } @@ -948,7 +963,7 @@ sub start_dfn { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "\\textit{"; + $currentstring .= '\textit{'; } return $currentstring; } @@ -959,7 +974,7 @@ sub end_dfn { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - $currentstring .= "}"; + $currentstring .= '}'; } return $currentstring; } @@ -994,7 +1009,7 @@ sub start_kbd { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "\\texttt"; + $currentstring .= '\texttt{'; } return $currentstring; } @@ -1005,7 +1020,7 @@ sub end_kbd { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - $currentstring .= "}"; + $currentstring .= '}'; } return $currentstring; } @@ -1063,7 +1078,7 @@ sub start_q { if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= "\\emph{"; + $currentstring .= '\emph{'; } return $currentstring; } @@ -1074,7 +1089,7 @@ sub end_q { if ($target eq 'web') { $currentstring .= $token->[2]; } elsif ($target eq 'tex') { - $currentstring .= "}"; + $currentstring .= '}'; } return $currentstring; } @@ -1403,8 +1418,15 @@ sub start_a { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { my $a=&Apache::lonxml::get_param('href',$parstack,$safeeval,undef,1); - $a=~s/([^\\])%/$1\\\%/g; - $currentstring .= '\ref{'.$a.'}'; + my $b=&Apache::lonxml::get_param('name',$parstack,$safeeval,undef,1); + if ($a=~/\S/) { + $a=~s/([^\\])%/$1\\\%/g; + $currentstring .= '\ref{URI: '.$a.'}'; + } elsif ($b=~/\S/) { + $currentstring .= '\ref{Anchor: '.$b.'}'; + } else { + $currentstring.=''; + } } return $currentstring; } @@ -1623,45 +1645,77 @@ sub start_dl { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - $currentstring = '\begin{description}'; + $currentstring = '\begin{description}'; + @Apache::londefdef::description=(); + $Apache::londefdef::DD_redirection=0; + $Apache::londefdef::DT_redirection=0; } return $currentstring; } sub end_dl { - my ($target,$token) = @_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { - $currentstring = '\end{description}'; + if ($Apache::londefdef::DT_redirection) { + my $data=&item_cleanup; + push @Apache::londefdef::description,'\item['.$data.']'; + $Apache::londefdef::DT_redirection=0; + } elsif ($Apache::londefdef::DD_redirection) { + $Apache::londefdef::description[-1].=&Apache::lonxml::endredirection(); + } + foreach my $element (@Apache::londefdef::description) { + $currentstring.=' '.$element.' '; + } + @Apache::londefdef::description=(); + $currentstring.='\end{description}'; } return $currentstring; } -#-- <dt> tag +#-- <dt> tag (end tag optional) sub start_dt { - my ($target,$token) = @_; - my $currentstring = ''; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; + my $currentstring=''; if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - $currentstring = '\item['; + if ($Apache::londefdef::DT_redirection) { + my $data=&item_cleanup; + push @Apache::londefdef::description,'\item['.$data.']'; + $Apache::londefdef::DT_redirection=0; + } elsif ($Apache::londefdef::DD_redirection) { + $Apache::londefdef::description[-1].=&Apache::lonxml::endredirection(); + $Apache::londefdef::DD_redirection=0; + } + &Apache::lonxml::startredirection(); + $Apache::londefdef::DT_redirection=1; } return $currentstring; } sub end_dt { - my ($target,$token) = @_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { - $currentstring = ']'; + my $data=&item_cleanup; + push @Apache::londefdef::description,'\item['.$data.']'; + $Apache::londefdef::DT_redirection=0; } return $currentstring; } +sub item_cleanup { + my $item=&Apache::lonxml::endredirection(); + $item=~s/\\begin{center}//g; + $item=~s/\\end{center}//g; + return $item; +} + #-- <dd> tag sub start_dd { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; @@ -1669,21 +1723,26 @@ sub start_dd { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - if ($$tagstack[-2] eq 'dl') { - $currentstring = ' \item [] '; - } elsif ($$tagstack[-2] eq 'dt') { - $currentstring = ']'; + if ($Apache::londefdef::DT_redirection) { + my $data=&item_cleanup; + push @Apache::londefdef::description,'\item['.$data.']'; + $Apache::londefdef::DT_redirection=0; } + $Apache::londefdef::DD_redirection=1; + &Apache::lonxml::startredirection(); } return $currentstring; } sub end_dd { - my ($target,$token) = @_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[2]; - } + } elsif ($target eq 'tex') { + $Apache::londefdef::description[-1].=&Apache::lonxml::endredirection(); + $Apache::londefdef::DD_redirection=0; + } return $currentstring; } @@ -1784,7 +1843,7 @@ sub end_table { $needed=$#length_row_final-$needed+1; for (my $jn=0;$jn<=$#length_row_final;$jn++) { if ($length_row_final[$jn]==0) { - if ($length_raw_row[$jn]<$available_length/3) { + if ($length_raw_row[$jn]<$available_length) { $length_row_final[$jn]=$length_raw_row[$jn]; $available_length=$available_length-$length_raw_row[$jn]; $needed--; @@ -1820,7 +1879,7 @@ sub end_table { return $currentstring; } -#-- <tr> tag +#-- <tr> tag (end tag optional) sub start_tr { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; @@ -1843,72 +1902,121 @@ sub start_tr { } sub end_tr { - my ($target,$token) = @_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { + if ($Apache::londefdef::TD_redirection) { + &end_td_tex($parstack,$parser,$safeeval); + } push @{ $Apache::londefdef::table[-1]{'TeXlengthrow'} },$Apache::londefdef::table[-1]{'TeXlength'}; push @{ $Apache::londefdef::table[-1]{'lengthrow'} },$Apache::londefdef::table[-1]{'length'}; } return $currentstring; } -#-- <td> tag +#-- <td> tag (end tag optional) sub start_td { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - my $what_to_push = substr(&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1),0,1); - if ($what_to_push eq '') { - $what_to_push = substr($Apache::londefdef::table[-1]{'rows'}[0],0,1);; - } - push @{ $Apache::londefdef::table[-1]{'columns'} }, $what_to_push; - $Apache::londefdef::table[-1]{'counter_columns'}++; - &Apache::lonxml::startredirection(); + $Apache::londefdef::TD_redirection = 1; + &tag_check('tr','td',$tagstack,$parstack,$parser,$safeeval); } return $currentstring; } - + +sub tag_check { + my ($good_tag,$bad_tag,$tagstack,$parstack,$parser,$safeeval) = @_; + my @ar=@$parstack; + for (my $i=$#ar-1;$i>=0;$i--) { + if (lc($$tagstack[$i]) eq $good_tag) { + &start_td_tex($parstack,$parser,$safeeval); + last; + } elsif (lc($$tagstack[$i]) eq $bad_tag) { + splice @ar, $i+1; + &end_td_tex(\@ar,$parser,$safeeval); + &start_td_tex($parstack,$parser,$safeeval); + last; + } + } + return ''; +} + +sub start_td_tex { + my ($parstack,$parser,$safeeval) = @_; + my $what_to_push = substr(&Apache::lonxml::get_param('align',$parstack,$safeeval,undef,1),0,1); + if ($what_to_push eq '') { + $what_to_push = substr($Apache::londefdef::table[-1]{'rows'}[0],0,1);; + } + push @{ $Apache::londefdef::table[-1]{'columns'} }, $what_to_push; + $Apache::londefdef::table[-1]{'counter_columns'}++; + &Apache::lonxml::startredirection(); + return ''; +} + +sub end_td_tex { + my ($parstack,$parser,$safeeval) = @_; + my $current_row = $Apache::londefdef::table[-1]{'row_number'}; + my $data=&Apache::lonxml::endredirection(); + my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); + if (defined $TeXwidth) { + my $current_length=&recalc($TeXwidth); + $current_length=~/(\d+)/; + $Apache::londefdef::table[-1]{'TeXlength'} .= $1.','; + $Apache::londefdef::table[-1]{'length'} .= '0,'; + } else { + if ($data=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/) { + my $current_length=&recalc($1); + $current_length=~/(\d+\.?\d*)/; + $Apache::londefdef::table[-1]{'TeXlength'} .= $1.','; + $Apache::londefdef::table[-1]{'length'} .= '0,'; + } else { + $data=~s/^\s+(\S.*)/$1/; + $data=~s/(.*\S)\s+$/$1/; + $data=~s/(\s)+/$1/; + my $current_length=0; + if ($data=~/\\vskip/) { + my $newdata=$data; + $newdata=~s/\\vskip \d*\.?\d*\s*mm/THISISJUSTTEMPORARYSEPARATOR/g; + my @newdata=split(/THISISJUSTTEMPORARYSEPARATOR/,$newdata); + foreach my $elementdata (@newdata) { + $elementdata=~s/^\s+(\S.*)/$1/; + $elementdata=~s/(.*\S)\s+$/$1/; + $elementdata=~s/(\s)+/$1/; + my $lengthnewdata=1.8*length($elementdata); + if ($lengthnewdata>$current_length) {$current_length=$lengthnewdata;} + } + } else { + $current_length=1.8*length($data); + } + $Apache::londefdef::table[-1]{'length'} .= $current_length.','; + $Apache::londefdef::table[-1]{'TeXlength'} .= '0,'; + } + } + for (my $in=0; $in<=$#{$Apache::londefdef::table[-1]{'include'}};$in++) { + $data=~s/\\keephidden\{NEW TABLE ENTRY\}/$Apache::londefdef::table[-1]{'include'}[$in]/; + } + @{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{TOBECHANGEDONNUMBER}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'}; + return''; +} + sub end_td { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { - my $current_row = $Apache::londefdef::table[-1]{'row_number'}; - my $data=&Apache::lonxml::endredirection(); - my $TeXwidth=&Apache::lonxml::get_param('TeXwidth',$parstack,$safeeval,undef,0); - if (defined $TeXwidth) { - my $current_length=&recalc($TeXwidth); - $current_length=~/(\d+)/; - $Apache::londefdef::table[-1]{'TeXlength'} .= $1.','; - $Apache::londefdef::table[-1]{'length'} .= '0,'; - } else { - if ($data=~m/width\s*=\s*(\d+\.?\d*\s*(mm|cm|in|pc|pt)*)/) { - my $current_length=&recalc($1); - $current_length=~/(\d+\.?\d*)/; - $Apache::londefdef::table[-1]{'TeXlength'} .= $1.','; - $Apache::londefdef::table[-1]{'length'} .= '0,'; - } else { - $data=~s/^\s+(\S.*)/$1/; - $data=~s/(.*\S)\s+$/$1/; - my $current_length=2*length($data); - $Apache::londefdef::table[-1]{'length'} .= $current_length.','; - $Apache::londefdef::table[-1]{'TeXlength'} .= '0,'; - } - } - for (my $in=0; $in<=$#{$Apache::londefdef::table[-1]{'include'}};$in++) { - $data=~s/\\keephidden\{NEW TABLE ENTRY\}/$Apache::londefdef::table[-1]{'include'}[$in]/; - } - @{ $Apache::londefdef::table[-1]{'rowdata'} }[$current_row] .= '\parbox{TOBECHANGEDONNUMBER}{'.$data.'} '.$Apache::londefdef::table[-1]{'vinc'}; + $Apache::londefdef::TD_redirection =0; + &end_td_tex($parstack,$parser,$safeeval); } return $currentstring; } -#-- <th> tag +#-- <th> tag (end tag optional) sub start_th { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; @@ -2101,7 +2209,16 @@ sub start_applet { $currentstring='[APPLET: '.$alttag.']'; } } elsif ($target eq 'tex') { - $currentstring = " \\begin{figure} "; + my $alttag= &Apache::lonxml::get_param('alt',$parstack, + $safeeval,undef,1); + unless ($alttag) { + my $code=&Apache::lonxml::get_param('code',$parstack,$safeeval, + undef,1); + $alttag=&Apache::lonmeta::alttag($Apache::lonxml::pwd[-1], + $code); + } + $currentstring.='\begin{center} \fbox{Java Applet: '.$alttag. + '.}\end{center}'; } return $currentstring; } @@ -2112,7 +2229,6 @@ sub end_applet { if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { - $currentstring = " \\end{figure}"; } return $currentstring; } @@ -2135,7 +2251,6 @@ sub start_embed { $currentstring='[EMBED: '.$alttag.']'; } } elsif ($target eq 'tex') { - $currentstring = " \\begin{figure} "; } return $currentstring; } @@ -2145,8 +2260,7 @@ sub end_embed { my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[2]; - } elsif ($target eq 'tex') { - $currentstring = " \\end{figure}"; + } elsif ($target eq 'tex') { } return $currentstring; } @@ -2165,7 +2279,6 @@ sub start_param { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - $currentstring = " \\begin{figure} "; } return $currentstring; } @@ -2176,7 +2289,6 @@ sub end_param { if ($target eq 'web') { $currentstring = $token->[2]; } elsif ($target eq 'tex') { - $currentstring = " \\end{figure}"; } return $currentstring; } @@ -2213,7 +2325,8 @@ sub start_frameset { my ($target,$token) = @_; my $currentstring = ''; if ($target eq 'web') { - if (!$Apache::lonxml::registered) { + if (!$Apache::lonxml::registered && + $ENV{'request.state'} eq 'published') { $currentstring.='<head>'. &Apache::lonmenu::registerurl(undef,$target).'</head>'; } @@ -2253,6 +2366,29 @@ sub end_frameset { return $currentstring; } +#-- <xmp> +sub start_xmp { + my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; + my $currentstring = ''; + if ($target eq 'web') { + $currentstring .= $token->[4]; + } elsif ($target eq 'tex') { + $currentstring .= '\begin{verbatim}'; + } + return $currentstring; +} + +sub end_xmp { + my ($target,$token) = @_; + my $currentstring = ''; + if ($target eq 'web') { + $currentstring .= $token->[2]; + } elsif ($target eq 'tex') { + $currentstring .= '\end{verbatim}'; + } + return $currentstring; +} + #-- <pre> sub start_pre { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; @@ -2399,7 +2535,7 @@ sub start_base { my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[4]; - } + } return $currentstring; } @@ -2792,8 +2928,8 @@ sub end_marquee { return $currentstring; } -#-- <malticol> tag -sub start_malticol { +#-- <multicol> tag (end tag required) +sub start_multicol { my ($target,$token) = @_; my $currentstring = ''; if ($target eq 'web') { @@ -2802,7 +2938,7 @@ sub start_malticol { return $currentstring; } -sub end_malticol { +sub end_multicol { my ($target,$token) = @_; my $currentstring = ''; if ($target eq 'web') { @@ -2811,13 +2947,15 @@ sub end_malticol { return $currentstring; } -#-- <nobr> tag +#-- <nobr> tag (end tag required) sub start_nobr { my ($target,$token) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[4]; - } + } elsif ($target eq 'tex') { + $currentstring='\mbox{'; + } return $currentstring; } @@ -2826,11 +2964,13 @@ sub end_nobr { my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[2]; - } + } elsif ($target eq 'tex') { + $currentstring='}'; + } return $currentstring; } -#-- <noembed> tag +#-- <noembed> tag (end tag required) sub start_noembed { my ($target,$token) = @_; my $currentstring = ''; @@ -2849,7 +2989,7 @@ sub end_noembed { return $currentstring; } -#-- <noframes> tag +#-- <noframes> tag (end tag required) sub start_noframes { my ($target,$token) = @_; my $currentstring = ''; @@ -2868,7 +3008,7 @@ sub end_noframes { return $currentstring; } -#-- <nolayer> tag +#-- <nolayer> tag (end tag required) sub start_nolayer { my ($target,$token) = @_; my $currentstring = ''; @@ -2887,7 +3027,7 @@ sub end_nolayer { return $currentstring; } -#-- <noscript> tag +#-- <noscript> tag (end tag required) sub start_noscript { my ($target,$token) = @_; my $currentstring = ''; @@ -2906,7 +3046,7 @@ sub end_noscript { return $currentstring; } -#-- <object> tag +#-- <object> tag (end tag required) sub start_object { my ($target,$token) = @_; my $currentstring = ''; @@ -2925,7 +3065,7 @@ sub end_object { return $currentstring; } -#-- <optgroup> tag +#-- <optgroup> tag (end tag required) sub start_optgroup { my ($target,$token) = @_; my $currentstring = ''; @@ -2944,13 +3084,15 @@ sub end_optgroup { return $currentstring; } -#-- <samp> tag +#-- <samp> tag (end tag required) sub start_samp { my ($target,$token) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[4]; - } + } elsif ($target eq 'tex') { + $currentstring='\texttt{'; + } return $currentstring; } @@ -2959,7 +3101,9 @@ sub end_samp { my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[2]; - } + } elsif ($target eq 'tex') { + $currentstring='}'; + } return $currentstring; } @@ -2982,7 +3126,7 @@ sub end_server { return $currentstring; } -#-- <spacer> tag +#-- <spacer> tag (end tag forbidden) sub start_spacer { my ($target,$token) = @_; my $currentstring = ''; @@ -3001,7 +3145,7 @@ sub end_spacer { return $currentstring; } -#-- <span> tag +#-- <span> tag (end tag required) sub start_span { my ($target,$token) = @_; my $currentstring = ''; @@ -3020,7 +3164,7 @@ sub end_span { return $currentstring; } -#-- <tbody> tag +#-- <tbody> tag (end tag optional) sub start_tbody { my ($target,$token) = @_; my $currentstring = ''; @@ -3039,7 +3183,7 @@ sub end_tbody { return $currentstring; } -#-- <tfoot> tag +#-- <tfoot> tag (end tag optional) sub start_tfoot { my ($target,$token) = @_; my $currentstring = ''; @@ -3058,7 +3202,7 @@ sub end_tfoot { return $currentstring; } -#-- <thead> tag +#-- <thead> tag (end tag optional) sub start_thead { my ($target,$token) = @_; my $currentstring = ''; @@ -3083,7 +3227,9 @@ sub start_var { my $currentstring = ''; if ($target eq 'web') { $currentstring = $token->[4]; - } + } elsif ($target eq 'tex') { + $currentstring = '\textit{'; + } return $currentstring; } @@ -3091,12 +3237,14 @@ sub end_var { my ($target,$token) = @_; my $currentstring = ''; if ($target eq 'web') { - $currentstring = $token->[2]; + $currentstring = $token->[2]; + } elsif ($target eq 'tex') { + $currentstring = '}'; } return $currentstring; } -#-- <wbr> tag +#-- <wbr> tag (end tag forbidden) sub start_wbr { my ($target,$token) = @_; my $currentstring = ''; @@ -3115,7 +3263,6 @@ sub end_wbr { return $currentstring; } - #-- <hideweboutput> tag sub start_hideweboutput { my ($target,$token) = @_;