doc-src/IsarOverview/Isar/makeDemo
author Walther Neuper <neuper@ist.tugraz.at>
Thu, 12 Aug 2010 15:03:34 +0200
branchisac-from-Isabelle2009-2
changeset 37913 20e3616b2d9c
parent 13999 454a2ad0c381
permissions -rwxr-xr-x
prepare reactivation of isac-update-Isa09-2
     1 #!/usr/bin/perl -w
     2 
     3 sub doit {
     4     my ($file) = @_;
     5 
     6     open (FILE, $file) || die $!;
     7     undef $/; $text = <FILE>; $/ = "\n";
     8     close FILE || die $!;
     9 
    10     $_ = $text;
    11 
    12     s/text_raw\{\*([^*]|\*[^}])*\*\}//sg;       # actual work done here
    13     s/text\{\*([^*]|\*[^}])*\*\}//sg;       # actual work done here
    14     s/\(\*<\*\)//sg;
    15     s/\(\*>\*\)//sg;
    16     s/--(\ )*"([^"])*"//sg;
    17     s/--(\ )*\{\*([^*]|\*[^}])*\*\}//sg;
    18 
    19     $result = $_;
    20 
    21     if ($text ne $result) {
    22         print STDERR "fixing $file\n";
    23 #        if (! -f "$file~~") {
    24 #            rename $file, "$file~~" || die $!;
    25 #        }
    26         open (FILE, "> Demo/$file") || die $!;
    27         print FILE $result;
    28         close FILE || die $!;
    29     }
    30 }
    31 
    32 
    33 foreach $file (@ARGV) {
    34   eval { &doit($file); };
    35   if ($@) { print STDERR "*** doit $file: ", $@, "\n"; }
    36 }