[LON-CAPA-cvs] cvs: loncom /xml lontexconvert.pm

www www@source.lon-capa.org
Wed, 12 Aug 2009 20:31:08 -0000


www		Wed Aug 12 20:31:08 2009 EDT

  Modified files:              
    /loncom/xml	lontexconvert.pm 
  Log:
  Mimetex alt-argument for screen readers:
  * do not remove original math enviroment delimiters
  * change double quotes into double primes (so we do not have alt="..."...")
  * remove artificial math delimiters
  
  
Index: loncom/xml/lontexconvert.pm
diff -u loncom/xml/lontexconvert.pm:1.96 loncom/xml/lontexconvert.pm:1.97
--- loncom/xml/lontexconvert.pm:1.96	Mon May 25 19:41:59 2009
+++ loncom/xml/lontexconvert.pm	Wed Aug 12 20:31:08 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # TeX Conversion Module
 #
-# $Id: lontexconvert.pm,v 1.96 2009/05/25 19:41:59 raeburn Exp $
+# $Id: lontexconvert.pm,v 1.97 2009/08/12 20:31:08 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -282,8 +282,17 @@
 
 sub mimetex_converted {
     my $texstring=shift;
+
+# Alt-Argument for screen readers
+    my $alt_string=$$texstring;
+    $alt_string=~s/\"/\'\'/g;
+
+# Is this displaystyle?
+
     my $displaystyle=&displaystyle($texstring);
 
+# Remove math environment delimiters
+
     &clean_out_math_mode($texstring);
 
     if ($displaystyle) {
@@ -291,7 +300,7 @@
     }
     my $esc_texstring = &uri_escape($$texstring);
     my $valign = &mimetex_valign($esc_texstring);
-    my $result='<img src="/cgi-bin/mimetex.cgi?'.$esc_texstring.'" style="vertical-align:'.$valign.'px" alt="$'.$$texstring.'$" />';
+    my $result='<img src="/cgi-bin/mimetex.cgi?'.$esc_texstring.'" style="vertical-align:'.$valign.'px" alt="'.$alt_string.'" />';
     if ($displaystyle) {
 	$result='<center>'.$result.'</center>';
     }