--- loncom/xml/londefdef.pm 2007/04/06 10:23:46 1.362 +++ loncom/xml/londefdef.pm 2007/06/05 22:37:58 1.366 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.362 2007/04/06 10:23:46 foxr Exp $ +# $Id: londefdef.pm,v 1.366 2007/06/05 22:37:58 albertel Exp $ # # # Copyright Michigan State University Board of Trustees @@ -516,6 +516,17 @@ sub end_accessrule { return $currentstring; } +sub generate_css_links { + my $links; + my $css_href = &Apache::lonnet::EXT('resource.0.cssfile'); + if ($css_href =~ /\S/) { + &Apache::lonxml::extlink($css_href); + $links .= + ''; + } + return $links; +} + #-- tag (end tag required) sub start_body { my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; @@ -530,9 +541,13 @@ sub start_body { if (&is_inside_of($tagstack, "head")) { &end_head(@_); } + + my $extra_head = &generate_css_links(); + $currentstring = &Apache::loncommon::start_page($Apache::londefdef::title, - $Apache::londefdef::head, + $Apache::londefdef::head + .$extra_head, {'add_entries' => $token->[2], 'no_title' => 1, 'force_register' => 1}); @@ -1609,7 +1624,11 @@ sub end_a { &Apache::lonxml::get_param('name',$parstack,$safeeval,undef,1); if ($href =~ /\S/) { $href =~ s/([^\\])%/$1\\\%/g; - $currentstring .= ' ({\tt URI:'.&Apache::lonxml::latex_special_symbols($href).'})'; + # 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/) { $currentstring .= ' ({\tt Anchor:'.&Apache::lonxml::latex_special_symbols($name).'})'; } else { @@ -1985,21 +2004,14 @@ sub start_table { } else { $TeXwidth = $textwidth; } - } else { - $Apache::londefdef::table[-1]{'forcedtablewidth'} = 1; - } - # This stuff looks a bit hokey.. - # Percentage width is actually given as an absolute width.. - # but it appears that unless the 'percent' flag is set, - # The table is just allowed to go to its natural width - # for now let's always claim 'percent' is set.. - # + } + # if the width is specified as a % it is converted to an absolute width. + # otherwise.. just plugged right in the hash + if ($TeXwidth=~/%/) { - $Apache::londefdef::table[-1]{'percent'}=1; $TeXwidth=~/(\d+)/; $Apache::londefdef::table[-1]{'width'}=$1*$textwidth/100; } else { - $Apache::londefdef::table[-1]{'percent'} = 1; # kludge until we get the intent. $Apache::londefdef::table[-1]{'width'}=$TeXwidth; } # In the end, however the table width cannot be wider than $textwidth... @@ -2231,16 +2243,16 @@ sub end_table { } } } - #use all available width if it is defined in % or as TeXwidth - if (($Apache::londefdef::table[-1]{'percent'}==1) || ($Apache::londefdef::table[-1]{'forcetablewidth'}==1)) { - my $current=0; - for (my $i=0;$i<=$#fwidth;$i++) { - $current+=$fwidth[$i]; - } - my $coef=$Apache::londefdef::table[-1]{'width'}/$current; - for (my $i=0;$i<=$#fwidth;$i++) { - $fwidth[$i]*=$coef; - } + # use all available width or specified width as if not specified, + # the specified width gets defaulted to the available width. + + my $current=0; + for (my $i=0;$i<=$#fwidth;$i++) { + $current+=$fwidth[$i]; + } + my $coef=$Apache::londefdef::table[-1]{'width'}/$current; + for (my $i=0;$i<=$#fwidth;$i++) { + $fwidth[$i]*=$coef; } #removing of empty columns if allowed my $permission=&Apache::lonxml::get_param('TeXDropEmptyColumns',$parstack,$safeeval,undef,0);