--- loncom/interface/entities.pm 2008/05/05 10:46:19 1.11 +++ loncom/interface/entities.pm 2008/12/11 14:03:14 1.12.2.1 @@ -1,7 +1,7 @@ # The LearningOnline Network # entity -> tex. # -# +# $Id: entities.pm,v 1.12.2.1 2008/12/11 14:03:14 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -979,6 +979,7 @@ sub entity_to_latex { # Try to look up the entity (text or numeric) in the hash: + my $latex = $entities{"$entity"}; if (defined $latex) { return $latex; @@ -1031,6 +1032,18 @@ sub replace_entities { $latex = &entity_to_latex($entity); substr($input, $start, $end-$start) = $latex; } + + # Hexadecimal entities: + + while ($input =~ /&\#x(\d|[a-f,A-f])+;/) { + ($start) = @-; + ($end) = @+; + $entity = "0" . substr($input, $start+2, $end-$start-3); # 0xhexnumber + $latex = &entity_to_latex(hex($entity)); + substr($input, $start, $end-$start) = $latex; + } + + # Now the &text; entites; while ($input =~/(&\w+;)/) {