]> git.donarmstrong.com Git - lilypond.git/blobdiff - debian/remove_w3c_callback
fix rules and remove w3c callback
[lilypond.git] / debian / remove_w3c_callback
index 9b70881f7ee52a04c86936c56185339d64073b4f..e8a892ab3418d8c5742b4d85a786543adc7ddb0c 100644 (file)
@@ -11,7 +11,7 @@ use File::Find;
 #      alt="Valid HTML 4.01 Transitional"
 #      height="31" width="88"></a>
 
-file_find(\&fix_if_file,@ARGV)
+find(\&fix_if_file,@ARGV);
 
 sub fix_if_file {
     return unless -f $_;
@@ -20,14 +20,16 @@ sub fix_if_file {
     local $/;
     my $fc = <$fh>;
     close($fh);
-    if (# strip out the w3c img callback; replace with alt text
-        $fc =~ s{<img\s+src="http://www.w3c.org/Icons/[^"]+"[^>]*?alt="([^"]+)"[^>]*>}{$1}img
-        or
-        # if it doesn't have alt text, just replace it with Valid HTML
-        $fc =~ s{<img\s+src="http://www.w3c.org/Icons/[^"]+"[^>]*>}{Valid HTML}img ) {
+    # strip out the w3c img callback; replace with alt text
+    my $changed = $fc =~ s{<img\s+src="http://www.w3c?.org/Icons/[^"]+"[^>]*?alt="([^"]+)"[^>]*>}{$1}imsg;
+    # if it doesn't have alt text, just replace it with Valid HTML
+    $changed += $fc =~ s{<img\s+src="http://www.w3c?.org/Icons/[^"]+"[^>]*>}{Valid HTML}imsg;
+
+    if ($changed) {
         $fh = IO::File->new($_,'w') or
             die "Unable to open $_ for writing: $!";
         print {$fh} $fc;
         close($fh);
+        print STDERR "$File::Find::name was changed\n";
     }
 }