[Bug 1265] Interface validation results with tidy

http://www.w3.org/Bugs/Public/show_bug.cgi?id=1265





------- Comment #5 from ot@w3.org  2007-02-08 10:36 -------
(In reply to comment #3)
> Any chance of making it optional, available only if HTML::Tidy is installed?

Like this?

===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.468
diff -u -r1.468 check
--- check       7 Feb 2007 15:24:29 -0000       1.468
+++ check       8 Feb 2007 10:35:24 -0000
@@ -56,7 +56,6 @@
 use Encode::Alias             qw();
 use HTML::Encoding       0.52 qw();
 use SGML::Parser::OpenSP      qw();
-use HTML::Tidy                qw();


###############################################################################
 #### Constant definitions.
####################################################
@@ -691,8 +690,17 @@

 ## if invalid content, pass through tidy
 if (! $File->{'Is Valid'}) {
-  my $tidy = HTML::Tidy->new();
-  $File->{'Tidy'} = $tidy->clean(join"\n",@{$File->{Content}});
+  eval {
+    local $SIG{__DIE__};
+    require HTML::Tidy;
+    my $tidy = HTML::Tidy->new();
+    $File->{'Tidy'} = $tidy->clean(join"\n",@{$File->{Content}});
+    $File->{'Tidy_OK'} = TRUE;
+  };
+  if ($@) {
+    $File->{'Tidy_OK'} = FALSE;
+  }
+
 }

Received on Thursday, 8 February 2007 10:36:24 UTC