Namespaces
Variants
Actions

Eom replace for mac.pl

From Encyclopedia of Mathematics
Revision as of 13:38, 20 June 2014 by Thomas Unger (talk | contribs) (file eom_replace_for_mac.pl created)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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;

}

&upr($x);


sub upr{
    print encode('UTF-8', $_[0]);
}
How to Cite This Entry:
Eom replace for mac.pl. Encyclopedia of Mathematics. URL: http://encyclopediaofmath.org/index.php?title=Eom_replace_for_mac.pl&oldid=32263