This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 1265 - Interface validation results with tidy
Summary: Interface validation results with tidy
Status: RESOLVED FIXED
Alias: None
Product: Validator
Classification: Unclassified
Component: check (show other bugs)
Version: 0.7.0
Hardware: All All
: P3 enhancement
Target Milestone: ---
Assignee: Olivier Thereaux
QA Contact: qa-dev tracking
URL: http://tidy.sourceforge.net/
Whiteboard:
Keywords:
: 76 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-04-22 03:17 UTC by Olivier Thereaux
Modified: 2007-02-20 07:31 UTC (History)
2 users (show)

See Also:


Attachments

Description Olivier Thereaux 2005-04-22 03:17:11 UTC
[migrating a few items of interest from todo.html to bugzilla]

For HTML document types (probably doesn't make sense for math, smil, svg?), the validation results 
could be interfaced with tidy. One idea would be to add, afterthe "this document is not valid X" banner, 
a paragraph saying "you can try to clean up your markup automatically with HTML tidy".

Implementation-wise, Bjoern, do you have any idea which would be the best choice? µTidylib? ptidy? 
Just a popen() / system() seems to be popular too, but probably isn't the best in terms of security/
resources.

Related to, but not duplicate of, AFAICT, Bug #76
Comment 1 Dominique Hazael-Massieux 2005-05-18 08:15:05 UTC
What about simply linking to
http://cgi.w3.org/cgi-bin/tidy?docAddr=<uri_of_validate_page> ? Or do you think
it needs to be more integrated than that in the validation service?
Comment 2 Olivier Thereaux 2007-02-07 15:27:35 UTC
Working on it, looking at using HTML::Tidy perl module
Comment 3 Ville Skyttä 2007-02-07 17:03:13 UTC
Any chance of making it optional, available only if HTML::Tidy is installed?
Comment 4 Olivier Thereaux 2007-02-08 08:11:13 UTC
(In reply to comment #3)
> Any chance of making it optional, available only if HTML::Tidy is installed?

It would be optional for the user, but I suspect that's not what you're meaning here, is it?

I think we would have the checkbox option regardless of whether HTML::Tidy is present, but in the results we could have a "sorry, this server does not have HTML::Tidy" installed error message instead of a harsher 500 fatal error becausew HTML::Tidy was not in @INC.
Comment 5 Olivier Thereaux 2007-02-08 10:36:12 UTC
(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;
+  }
+
 }
 
Comment 6 Ville Skyttä 2007-02-08 23:11:46 UTC
Yep, something like that, thanks.
Comment 7 Olivier Thereaux 2007-02-20 07:27:35 UTC
*** Bug 76 has been marked as a duplicate of this bug. ***
Comment 8 Olivier Thereaux 2007-02-20 07:31:42 UTC
Suggestion by Ville in comment #3 and detailed in comment #5 implemented in code, Tidy functionality now effectively working in 0.8.0dev, closing this RFE.