Eom replace for

From Encyclopedia of Mathematics
Jump to: navigation, search
#!/usr/bin/perl -w

## This script replaces all references to
## images of tex code by strings "$_$"
## and separates reference entries by newlines

use strict;
use utf8;
use Encode;
use Unicode::Collate;

undef $/;

my $x = decode('UTF-8', readline STDIN);

$x =~ s/\n*\<table .*?\<\/table\>\n*\s*/\n\$\$•\$\$\n/sg;
$x =~ s/<img align[^>]*>/\$•\$/sg;
$x =~ s/ \[\[/\n\n\[\[/sg;
$x =~ s/\n\[\[/\[\[/sg;
$x =~ s/\n\[\[/\[\[/sg;
$x =~ s/\]\]\n/\]\]/sg;
$x =~ s/==== /====\n/sg;
$x =~ s/\.== /.==\n/sg;
$x =~ s/\$\$•\$\$\n* */\n\$\$•\$\$\n/sg;

if ($x =~ /====References====\n.*?(\<table\>.*?\<\/table\>)/) {
    my $y = $1;
    my $yy = $y;
    $yy =~ s/\n/ /sg;
    $yy =~ s/\<\/TD\>/<\/TD>\n/sg;
    $x =~ s/\Q$y\E/$yy/sg;



sub upr{
    print encode('UTF-8', $_[0]);
How to Cite This Entry:
Eom replace for Encyclopedia of Mathematics. URL: