validator/httpd/cgi-bin check,1.467,1.468

Update of /sources/public/validator/httpd/cgi-bin
In directory hutz:/tmp/cvs-serv20209/httpd/cgi-bin

Modified Files:
	check 
Log Message:
* fixing (silly) version requirement issue with S:P:O (for perl, v 0.100 < 0.99)
* adding proof of concept HTM::Tidy output



Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.467
retrieving revision 1.468
diff -u -d -r1.467 -r1.468
--- check	13 Nov 2006 04:26:29 -0000	1.467
+++ check	7 Feb 2007 15:24:29 -0000	1.468
@@ -55,7 +55,8 @@
 use Encode                    qw();
 use Encode::Alias             qw();
 use HTML::Encoding       0.52 qw();
-use SGML::Parser::OpenSP 0.99 qw();
+use SGML::Parser::OpenSP      qw();
+use HTML::Tidy                qw();
 
 ###############################################################################
 #### Constant definitions. ####################################################
@@ -368,6 +369,7 @@
 # Set session switches.
 $File->{Opt}->{'Outline'}        = $q->param('outline') ? TRUE                   :  FALSE;
 $File->{Opt}->{'Show Source'}    = $q->param('ss')      ? TRUE                   :  FALSE;
+$File->{Opt}->{'Show Tidy'}      = $q->param('st')      ? TRUE                   :  FALSE;
 $File->{Opt}->{'Show Parsetree'} = $q->param('sp')      ? TRUE                   :  FALSE;
 $File->{Opt}->{'No Attributes'}  = $q->param('noatt')   ? TRUE                   :  FALSE;
 $File->{Opt}->{'Show ESIS'}      = $q->param('esis')    ? TRUE                   :  FALSE;
@@ -649,6 +651,7 @@
   return $File;
 }
 
+
 #
 # Force "XML" if type is an XML type and an FPI was not found.
 # Otherwise set the type to be the FPI.
@@ -685,6 +688,13 @@
   }
 }
 
+
+## if invalid content, pass through tidy
+if (! $File->{'Is Valid'}) {
+  my $tidy = HTML::Tidy->new();
+  $File->{'Tidy'} = $tidy->clean(join"\n",@{$File->{Content}});
+}
+
 my $template;
 
 if ($File->{Opt}->{Output} eq 'xml') {
@@ -714,6 +724,7 @@
 fin_template($File, $template);
 
 $template->param(file_warnings => $File->{Warnings});
+$template->param(tidy_output => $File->{'Tidy'});
 $template->param(file_source => &source($File))
   if $template->param('opt_show_source');
 #$template->param('opt_show_esis' => TRUE)
@@ -770,6 +781,7 @@
   #
   # Output options...
   $T->param(opt_show_source    => $File->{Opt}->{'Show Source'});
+  $T->param(opt_show_tidy    => $File->{Opt}->{'Show Tidy'});  
   $T->param(opt_show_outline   => $File->{Opt}->{'Outline'});
   $T->param(opt_show_parsetree => $File->{Opt}->{'Show Parsetree'});
   $T->param(opt_show_noatt     => $File->{Opt}->{'No Attributes'});
@@ -1822,6 +1834,7 @@
   my $escaped_uri = uri_escape($File->{URI});
   $thispage .= qq(?uri=$escaped_uri);
   $thispage .= ';ss=1'      if $File->{Opt}->{'Show Source'};
+  $thispage .= ';st=1'      if $File->{Opt}->{'Show Tidy'};
   $thispage .= ';sp=1'      if $File->{Opt}->{'Show Parsetree'};
   $thispage .= ';noatt=1'   if $File->{Opt}->{'No Attributes'};
   $thispage .= ';outline=1' if $File->{Opt}->{'Outline'};

Received on Wednesday, 7 February 2007 15:24:43 UTC