--- loncom/xml/londefdef.pm 2007/10/15 20:00:12 1.375.2.1 +++ loncom/xml/londefdef.pm 2008/04/29 10:16:37 1.386 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.375.2.1 2007/10/15 20:00:12 albertel Exp $ +# $Id: londefdef.pm,v 1.386 2008/04/29 10:16:37 foxr Exp $ # # # Copyright Michigan State University Board of Trustees @@ -200,6 +200,10 @@ sub start_html { '\usepackage[dvips]{graphicx}'. '\usepackage{wrapfig}'. '\usepackage{picins}'. + '\usepackage[T1]{fontenc}'."\n". + '\usepacakge{ucs}'."\n". + '\usepackage[utf8]{inputenc}'."\n". + '\usepackage{latexsym}'."\n". '\usepackage{epsfig}'. '\usepackage{calc}'. '\usepackage{amsmath}'. @@ -579,12 +583,7 @@ sub start_body { if ($env{'request.state'} ne 'published') { $currentstring.=&Apache::lonmenu::constspaceform(); - $currentstring.=(< - - -
-EDITBUTTON + $currentstring.=&Apache::londefdef::edit_controls(); } $currentstring.=&Apache::lonxml::message_location(); } elsif ($target eq 'tex') { @@ -593,6 +592,16 @@ EDITBUTTON return $currentstring; } +sub edit_controls { + my $result .= (< + + +
+EDITBUTTON + return $result; +} + sub end_body { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = &end_p(); # Close off unclosed

@@ -1580,6 +1589,9 @@ sub start_div { } if ($target eq 'tex') { # 4 possible alignments: left, right, center, and -missing-. + # If inside a table row, we must let the table logic + # do the alignment, however. + # my $endstring = ''; @@ -1590,6 +1602,7 @@ sub start_div { $endstring = '\end{center}'; if (&is_inside_of($tagstack, "table")) { $currentstring = ¢er_correction().$currentstring; + $endstring .= ¢er_end_correction(); } } elsif ($align eq 'right') { @@ -1645,14 +1658,18 @@ sub end_a { &Apache::lonxml::get_param('href',$parstack,$safeeval,undef,1); my $name = &Apache::lonxml::get_param('name',$parstack,$safeeval,undef,1); - if ($href =~ /\S/) { + my $uriprint = + &Apache::lonxml::get_param('uriprint',$parstack,$safeeval,undef,1); + my $anchorprint = + &Apache::lonxml::get_param('anchorprint',$parstack,$safeeval,undef,1); + if (($href =~ /\S/) && ($uriprint=~/^on|uriprint|yes|1$/i)) { $href =~ s/([^\\])%/$1\\\%/g; # Substitute special symbols... and allow line breaks at each / # $href = &Apache::lonxml::latex_special_symbols($href); $href =~ s/\//\/\\-/g; # Map / to /\- to allow hyphenation. $currentstring .= ' ({\tt URI:'.$href.'})'; - } elsif ($name =~ /\S/) { + } elsif (($name =~ /\S/) && ($anchorprint=~/^on|anchorprint|yes|1$/i)) { $currentstring .= ' ({\tt Anchor:'.&Apache::lonxml::latex_special_symbols($name).'})'; } else { $currentstring.=''; @@ -2087,6 +2104,10 @@ sub end_table { my $WARNING=''; #width of columns from TeXwidth attributes + # Protect against unbalanced tag. + + if (scalar(@Apache::londefdef::table) > 0) { + for (my $in=0;$in<=$Apache::londefdef::table[-1]{'row_number'};$in++) { for (my $jn=0;$jn<=$Apache::londefdef::table[-1]{'counter_columns'};$jn++) { if ($Apache::londefdef::table[-1]{'TeXlen'}[0][$jn]<$Apache::londefdef::table[-1]{'TeXlen'}[$in][$jn]) { @@ -2490,6 +2511,7 @@ sub end_table { undef @Apache::londefdef::table; } } + } return $currentstring; } @@ -3054,11 +3076,14 @@ sub start_img { my $width= &Apache::lonxml::get_param('width',$parstack,$safeeval); my $height= &Apache::lonxml::get_param('height',$parstack,$safeeval); - - $currentstring .= ''.$alt.'[2]{'src'}=~/\$/) { + $currentstring.='Variable image source'; + } else { + $currentstring .= ''.$alt.'[2]{'src'},$token->[2]{'width'},$token->[2]{'height'});