<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>1265</bug_id>
          
          <creation_ts>2005-04-22 03:17:11 +0000</creation_ts>
          <short_desc>Interface validation results with tidy</short_desc>
          <delta_ts>2007-02-20 07:31:42 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Validator</product>
          <component>check</component>
          <version>0.7.0</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://tidy.sourceforge.net/</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Olivier Thereaux">ot</reporter>
          <assigned_to name="Olivier Thereaux">ot</assigned_to>
          <cc>bjoern</cc>
    
    <cc>link</cc>
          
          <qa_contact name="qa-dev tracking">www-validator-cvs</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>3604</commentid>
    <comment_count>0</comment_count>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2005-04-22 03:17:11 +0000</bug_when>
    <thetext>[migrating a few items of interest from todo.html to bugzilla]

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

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&apos;t the best in terms of security/
resources.

Related to, but not duplicate of, AFAICT, Bug #76</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>3177</commentid>
    <comment_count>1</comment_count>
    <who name="Dominique Hazael-Massieux">dom</who>
    <bug_when>2005-05-18 08:15:05 +0000</bug_when>
    <thetext>What about simply linking to
http://cgi.w3.org/cgi-bin/tidy?docAddr=&lt;uri_of_validate_page&gt; ? Or do you think
it needs to be more integrated than that in the validation service?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13919</commentid>
    <comment_count>2</comment_count>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2007-02-07 15:27:35 +0000</bug_when>
    <thetext>Working on it, looking at using HTML::Tidy perl module</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13921</commentid>
    <comment_count>3</comment_count>
    <who name="Ville Skyttä">ville.skytta</who>
    <bug_when>2007-02-07 17:03:13 +0000</bug_when>
    <thetext>Any chance of making it optional, available only if HTML::Tidy is installed?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13925</commentid>
    <comment_count>4</comment_count>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2007-02-08 08:11:13 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; Any chance of making it optional, available only if HTML::Tidy is installed?

It would be optional for the user, but I suspect that&apos;s not what you&apos;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 &quot;sorry, this server does not have HTML::Tidy&quot; installed error message instead of a harsher 500 fatal error becausew HTML::Tidy was not in @INC.
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13926</commentid>
    <comment_count>5</comment_count>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2007-02-08 10:36:12 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; 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-&gt;{&apos;Is Valid&apos;}) {
-  my $tidy = HTML::Tidy-&gt;new();
-  $File-&gt;{&apos;Tidy&apos;} = $tidy-&gt;clean(join&quot;\n&quot;,@{$File-&gt;{Content}});
+  eval {
+    local $SIG{__DIE__};
+    require HTML::Tidy;
+    my $tidy = HTML::Tidy-&gt;new();
+    $File-&gt;{&apos;Tidy&apos;} = $tidy-&gt;clean(join&quot;\n&quot;,@{$File-&gt;{Content}});
+    $File-&gt;{&apos;Tidy_OK&apos;} = TRUE;
+  };
+  if ($@) {
+    $File-&gt;{&apos;Tidy_OK&apos;} = FALSE;
+  }
+
 }
 
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>13936</commentid>
    <comment_count>6</comment_count>
    <who name="Ville Skyttä">ville.skytta</who>
    <bug_when>2007-02-08 23:11:46 +0000</bug_when>
    <thetext>Yep, something like that, thanks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14023</commentid>
    <comment_count>7</comment_count>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2007-02-20 07:27:35 +0000</bug_when>
    <thetext>*** Bug 76 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>14024</commentid>
    <comment_count>8</comment_count>
    <who name="Olivier Thereaux">ot</who>
    <bug_when>2007-02-20 07:31:42 +0000</bug_when>
    <thetext>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.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>