]> granicus.if.org Git - docbook-dsssl/commitdiff
Use untidy to restore the broken anchors that tidy creates...grrr
authorNorman Walsh <ndw@nwalsh.com>
Mon, 12 Nov 2001 21:29:05 +0000 (21:29 +0000)
committerNorman Walsh <ndw@nwalsh.com>
Mon, 12 Nov 2001 21:29:05 +0000 (21:29 +0000)
cvstools/Makefile.incl
cvstools/untidy [new file with mode: 0755]

index 9d8f6a8ca5643d1086b4591df89330e257b35531..54651cc195b4fdda09299d062e1d189e535e0624 100644 (file)
@@ -6,7 +6,7 @@ NEXTVERSION=$(CVSTOOLSROOT)/nextversion
 SCHEMATRON-BASIC=$(SCHEMATRON-PATH)/schematron-basic.xsl
 SCHEMATRON-PATH=/share/doctypes/schematron
 SCHEMATRON-SKELETON=$(SCHEMATRON-PATH)/skeleton1-5.xsl
-TIDY=tidy
+TIDY=$(CVSTOOLSROOT)/untidy
 XJPARSE=$(CVSTOOLSROOT)/xjparse
 XNSGMLS=xnsgmls
 XSLT=$(CVSTOOLSROOT)/xslt
diff --git a/cvstools/untidy b/cvstools/untidy
new file mode 100755 (executable)
index 0000000..9a132f2
--- /dev/null
@@ -0,0 +1,26 @@
+#!/usr/bin/perl -w -- # -*- Perl -*-
+
+my $filename = pop @ARGV;
+my $opts = join(" ", @ARGV);
+
+my $content = "";
+
+open (F, "tidy $opts $filename |");
+while (<F>) {
+    $content .= $_;
+}
+close (F);
+
+if ($content eq '') {
+    # we must have done an "in-place" tidy
+    if (open (F, $filename)) {
+       read (F, $content, -s $filename);
+       close (F);
+    }
+}
+
+$content =~ s/(<a\s[^>]+>)\s+/$1/sg;
+
+open (F, ">$filename");
+print F $content;
+close (F);