| 
13262
 | 
     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  | 
  | 
| 
 | 
    17  | 
    $result = $_;
  | 
| 
 | 
    18  | 
  | 
| 
 | 
    19  | 
    if ($text ne $result) {
 | 
| 
 | 
    20  | 
        print STDERR "fixing $file\n";
  | 
| 
 | 
    21  | 
#        if (! -f "$file~~") {
 | 
| 
 | 
    22  | 
#            rename $file, "$file~~" || die $!;
  | 
| 
 | 
    23  | 
#        }
  | 
| 
 | 
    24  | 
        open (FILE, "> Demo/$file") || die $!;
  | 
| 
 | 
    25  | 
        print FILE $result;
  | 
| 
 | 
    26  | 
        close FILE || die $!;
  | 
| 
 | 
    27  | 
    }
  | 
| 
 | 
    28  | 
}
  | 
| 
 | 
    29  | 
  | 
| 
 | 
    30  | 
  | 
| 
 | 
    31  | 
foreach $file (@ARGV) {
 | 
| 
 | 
    32  | 
  eval { &doit($file); };
 | 
| 
 | 
    33  | 
  if ($@) { print STDERR "*** doit $file: ", $@, "\n"; }
 | 
| 
 | 
    34  | 
}
  |