Diff for /loncom/homework/structuretags.pm between versions 1.107 and 1.108

version 1.107, 2002/08/26 20:42:36 version 1.108, 2002/08/26 21:01:52
Line 387  sub end_problem { Line 387  sub end_problem {
       $status ne 'UNCHECKEDOUT') {        $status ne 'UNCHECKEDOUT') {
       # if part is zero, no <part>s existed, so we need show the current         # if part is zero, no <part>s existed, so we need show the current 
       # grading status        # grading status
       my $gradesatement = &Apache::inputtags::gradestatus($Apache::inputtags::part);        my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part);
       if ($target eq 'tex') {        #FIXME this is ugly we should just generate tex in inputtags
   $gradesatement =~ s/<table>//;        if ($target eq 'tex') { $gradestatus=&html_to_tex($gradestatus); }
   $gradesatement =~ s/<\/table>//;        $result.= $gradestatus;
   $gradesatement =~ s/<tr([^>]*)>//g;  
   $gradesatement =~ s/<\/tr>//g;  
   $gradesatement =~ s/<td([^>]*)>//g;  
   $gradesatement =~ s/<\/td>//g;  
   $gradesatement =~ s/<b>/\\textbf{/g;  
   $gradesatement =~ s/<\/b>/}/g;  
   $gradesatement =~ s/<br \/>/\\vskip 0 mm /g;  
   $gradesatement =~ s/<input([^>]*)>//g;  
       }  
       $result.= $gradesatement;  
     }      }
     if (      if (
  (($target eq 'web' || $target eq 'tex') && ($ENV{'request.state'} ne 'construct')) ||   (($target eq 'web' || $target eq 'tex') && ($ENV{'request.state'} ne 'construct')) ||
Line 442  sub end_problem { Line 432  sub end_problem {
   return $result;    return $result;
 }  }
   
   #FIXME I am ugly shoot me
   sub html_to_tex {
     my ($string)=@_;
     $string =~ s/<table>//;
     $string =~ s/<\/table>//;
     $string =~ s/<tr([^>]*)>//g;
     $string =~ s/<\/tr>//g;
     $string =~ s/<td([^>]*)>//g;
     $string =~ s/<\/td>//g;
     $string =~ s/<b>/\\textbf{/g;
     $string =~ s/<\/b>/}/g;
     $string =~ s/<br \/>/\\vskip 0 mm /g;
     $string =~ s/<input([^>]*)>//g;
     return $string;
   }
   
 sub start_library {  sub start_library {
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;    my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
   my ($result,$head_tag_start,$body_tag_start,$form_tag_start)=    my ($result,$head_tag_start,$body_tag_start,$form_tag_start)=
Line 645  sub end_part { Line 651  sub end_part {
   if ( $target eq 'grade' && $status eq 'CAN_ANSWER') {    if ( $target eq 'grade' && $status eq 'CAN_ANSWER') {
     return &Apache::inputtags::grade;      return &Apache::inputtags::grade;
   }    }
   if ($target eq 'web') {    if ($target eq 'web' || $target eq 'tex' ) {
     return &Apache::inputtags::gradestatus($Apache::inputtags::part);      my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part);
       #FIXME this is ugly we should just generate tex in inputtags
       if ($target eq 'tex') { $gradestatus=&html_to_tex($gradestatus); }
       return $gradestatus;
   }    }
   return '';    return '';
 }  }

Removed from v.1.107  
changed lines
  Added in v.1.108


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>