--- loncom/interface/entities.pm 2008/04/09 10:24:32 1.5 +++ loncom/interface/entities.pm 2008/04/14 09:33:39 1.6 @@ -997,5 +997,28 @@ sub entity_to_latex { # sub replace_entities { my ($input) = @_; + my $start; + my $end; + my $entity; + my $latex; + + # First the &#nnn; entities: + + while ($input =~ /(&\#\d+;)/) { + ($start) = @-; + ($end) = @+; + $entity = substr($input, $start+2, $end-$start-3); + $latex = &entity_to_latex($entity); + substr($input, $start, $end-$start) = $latex; + } + # Now the &text; entites; + + while ($input =~/($\w;)/) { + ($start) = @-; + ($end) = @+; + $entity = substr($input, $start+1, $end-$start-2); + $latex = &entity_to_latex($entity); + substr($input, $start, $end-$start) = $latex; + } }