Diff for /loncom/interface/lonhtmlgateway.pm between versions 1.1 and 1.5

version 1.1, 2010/04/26 20:45:28 version 1.5, 2010/05/24 23:47:22
Line 545  sub process_outgoing_html { Line 545  sub process_outgoing_html {
     my $parser = HTML::LCParser->new(\$input);      my $parser = HTML::LCParser->new(\$input);
     while (my $token = $parser->get_token()) {      while (my $token = $parser->get_token()) {
     if ($token->[0] eq 'T') {      if ($token->[0] eq 'T') {
        $output .= $token->[1];              if ($self->{target} ne 'tex') {
     } elsif ($token->[0] eq 'D' || $token->[0] eq 'C') {             $output .= &Apache::lontexconvert::smiley($token->[1]);
          } else {
                   my $t = $token->[1];
                   $t =~ s/([^\n\r\t &<>!\#%\(-;=?-~])/num_entity($1)/ge;
                   $output .= $t;
               }
           } elsif ($token->[0] eq 'D' || $token->[0] eq 'C') {
        $output .= $token->[1];         $output .= $token->[1];
     } elsif ($token->[0] eq 'PI' || $token->[0] eq 'E') {      } elsif ($token->[0] eq 'PI' || $token->[0] eq 'E') {
        $output .= $token->[2];         $output .= $token->[2];
Line 561  sub process_outgoing_html { Line 567  sub process_outgoing_html {
        }         }
     }      }
     }      }
   
     return $output;      return $output;
 }  }
   
Line 633  sub get_block_level_tags { Line 638  sub get_block_level_tags {
     return \@block;      return \@block;
 }  }
   
   sub num_entity {
       sprintf "&#x%X;", ord($_[0]);
   }
   
 ##############################################  ##############################################
 ##############################################  ##############################################
   
Line 709  sub parse_algebra_tag { Line 718  sub parse_algebra_tag {
     # the <algebra> parser does NOT handle entities,      # the <algebra> parser does NOT handle entities,
     # unlike the general <m> parser; thus we run      # unlike the general <m> parser; thus we run
     # the content of this tag through HTML::Entities,      # the content of this tag through HTML::Entities,
     # decoding it first      # decoding it first. we also just get the tex, and
       # feed it through as if it were an <mi> tag.
     $input = &HTML::Entities::decode($input);      $input = &HTML::Entities::decode($input);
     return &Apache::lontexconvert::algebra($input,$self->{target});      my $algebra = 
           &Apache::lontexconvert::algebra($input,'tex',undef,undef,undef,'tth');
       return &parse_m_tag($self, $algebra);
 }  }
   
 sub parse_mi_tag {  sub parse_mi_tag {
     my $self = shift;      my $self = shift;
     my $input = shift;      my $input = shift;
     return &parse_m_tag($self, '$'.$input.'$');      return &parse_m_tag($self, '\ensuremath{'.$input.'}');
 }  }
   
 sub parse_md_tag {  sub parse_md_tag {
Line 729  sub parse_md_tag { Line 741  sub parse_md_tag {
 sub parse_m_tag {  sub parse_m_tag {
     my $self = shift;      my $self = shift;
     my $input = shift;      my $input = shift;
     return &Apache::lontexconvert::to_convert($input, $self->{target});      if ($self->{target} ne 'tex') {
           return &Apache::lontexconvert::to_convert($input, $self->{target});
       } else {
           return '<m>'.$input.'</m>';
       }
 }  }
   
 sub parse_chem_tag {  sub parse_chem_tag {

Removed from v.1.1  
changed lines
  Added in v.1.5


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