--- loncom/xml/londefdef.pm 2003/07/09 20:04:19 1.152 +++ loncom/xml/londefdef.pm 2003/07/31 21:00:55 1.157 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.152 2003/07/09 20:04:19 sakharuk Exp $ +# $Id: londefdef.pm,v 1.157 2003/07/31 21:00:55 sakharuk Exp $ # # # Copyright Michigan State University Board of Trustees @@ -25,8 +25,7 @@ # /home/httpd/html/adm/gpl.txt # # http://www.lon-capa.org/ -# -# Copyright for TtHfunc and TtMfunc by Ian Hutchinson. +## Copyright for TtHfunc and TtMfunc by Ian Hutchinson. # TtHfunc and TtMfunc (the "Code") may be compiled and linked into # binary executable programs or libraries distributed by the # Michigan State University (the "Licensee"), but any binaries so @@ -157,9 +156,9 @@ sub start_html { &Apache::lonxml::fontsettings(); } elsif ($target eq 'tex') { @Apache::londefdef::table = (); - $currentstring .= '\documentclass[letterpaper]{article}'. - #'\batchmode'. - '\newcommand{\keephidden}[1]{} + $currentstring .= '\documentclass[letterpaper]{article}'; + if ($ENV{'form.latex_type'}=~'batchmode') {$currentstring .='\batchmode';} + $currentstring .= '\newcommand{\keephidden}[1]{} \renewcommand{\deg}{$^{\circ}$} \usepackage{longtable} \usepackage{textcomp} @@ -364,11 +363,25 @@ sub start_meta { $name=~s/\s/\_/gs; $name=~s/\W//gs; if ($name) { - $currentstring='<'.$name.'>'. + $currentstring='<'.$name; + my $display=&Apache::lonxml::get_param + ('display',$parstack,$safeeval,undef,1); + if ($display) { + $display=~s/\"/\'/g; + $currentstring.=' display="'.$display.'"'; + } + $currentstring.='>'. &Apache::lonxml::get_param ('content',$parstack,$safeeval,undef,1). ''; } + my $display=&Apache::lonxml::get_param + ('display',$parstack,$safeeval,undef,1); + if ($display) { + $display=&HTML::Entities::encode($display); + $currentstring.='<'.$name.'.display>'.$display. + ''; + } } } elsif ($target eq 'tex') { my $content=&Apache::lonxml::get_param('content',$parstack,$safeeval); @@ -450,6 +463,29 @@ sub start_body { $currentstring.=''. &Apache::lonmenu::registerurl(undef,$target).''; } +# Accessibility + if ($ENV{'browser.imagesuppress'} eq 'on') { + delete($token->[2]->{'background'}); + } + if ($ENV{'browser.fontenhance'} eq 'on') { + my $style=''; + foreach my $key (keys(%{$token->[2]})) { + if ($key =~ /^style$/i) { + $style.=$token->[2]->{$key}.';'; + delete($token->[2]->{$key}); + } + } + $token->[2]->{'style'}=$style.'; font-size: x-large;'; + } + if ($ENV{'browser.blackwhite'} eq 'on') { + delete($token->[2]->{'font'}); + delete($token->[2]->{'link'}); + delete($token->[2]->{'alink'}); + delete($token->[2]->{'vlink'}); + delete($token->[2]->{'bgcolor'}); + delete($token->[2]->{'background'}); + } +# Overload loads my $onLoad=''; foreach my $key (keys(%{$token->[2]})) { if ($key =~ /^onload$/i) { @@ -1042,12 +1078,14 @@ sub end_q { #--

tag sub start_p { - my ($target,$token) = @_; + my ($target,$token,$tagstack,$parstack,$parser,$safeeval) = @_; my $currentstring = ''; if ($target eq 'web') { $currentstring .= $token->[4]; } elsif ($target eq 'tex') { - $currentstring .= '\par '; + my $signal=1; + foreach my $tag (@$tagstack) {if ($tag eq 'b') {$signal=0;}} + if ($signal) {$currentstring .= '\par ';} } return $currentstring; } @@ -1165,7 +1203,12 @@ sub start_font { my $currentstring = ''; if ($target eq 'web') { my $face=&Apache::lonxml::get_param('face',$parstack,$safeeval); - if ($face=~/symbol/i) {$Apache::lonxml::prevent_entity_encode++;} + if ($face=~/symbol/i) { + $Apache::lonxml::prevent_entity_encode++; + } else { + if (($ENV{'browser.fontenhance'} eq 'on') || + ($ENV{'browser.blackwhite'} eq 'on')) { return ''; } + } $currentstring = $token->[4]; } elsif ($target eq 'tex') { my $fontsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval); @@ -1969,6 +2012,7 @@ sub start_img { } elsif ($width ne '') { $width_param = $width*$scaling; } + if ($width_param > $ENV{'form.textwidth'}) {$width_param =0.95*$ENV{'form.textwidth'}} my $file; my $path; if ($src =~ m!(.*)/([^/]*)$!) {