[LON-CAPA-cvs] cvs: loncom /interface entities.pm
foxr
lon-capa-cvs-allow@mail.lon-capa.org
Mon, 14 Apr 2008 09:33:39 -0000
foxr Mon Apr 14 05:33:39 2008 EDT
Modified files:
/loncom/interface entities.pm
Log:
Initial good perl compilation of the full entities module.
Index: loncom/interface/entities.pm
diff -u loncom/interface/entities.pm:1.5 loncom/interface/entities.pm:1.6
--- loncom/interface/entities.pm:1.5 Wed Apr 9 06:24:32 2008
+++ loncom/interface/entities.pm Mon Apr 14 05:33:39 2008
@@ -997,5 +997,28 @@
#
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;
+ }
}