W3C home > Mailing lists > Public > www-validator-cvs@w3.org > April 2007

validator/httpd/cgi-bin check,1.498,1.499

From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
Date: Thu, 12 Apr 2007 07:18:17 +0000
To: www-validator-cvs@w3.org
Message-Id: <E1HbtZR-0004x3-8h@lionel-hutz.w3.org>

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

Modified Files:
	check 
Log Message:
making prefilling of document structure on the server-side rather than via scripting.
See: http://lists.w3.org/Archives/Public/www-validator/2007Mar/0078.html
+thread
and: http://lists.w3.org/Archives/Public/www-validator/2007Apr/0049.html
+thread



Index: check
===================================================================
RCS file: /sources/public/validator/httpd/cgi-bin/check,v
retrieving revision 1.498
retrieving revision 1.499
diff -u -d -r1.498 -r1.499
--- check	9 Apr 2007 07:51:30 -0000	1.498
+++ check	12 Apr 2007 07:18:15 -0000	1.499
@@ -375,6 +375,25 @@
   global_vars       => TRUE,
 );
 
+my $PREFILL_HTML_T = HTML::Template->new(
+  filename          => File::Spec->catfile($CFG->{Paths}->{Templates},
+                                          $lang, 'prefill_html401.tmpl'),
+  die_on_bad_params => FALSE,
+  loop_context_vars => TRUE,
+  cache             => TRUE,
+  global_vars       => TRUE,
+);
+
+my $PREFILL_XHTML_T = HTML::Template->new(
+  filename          => File::Spec->catfile($CFG->{Paths}->{Templates},
+                                          $lang, 'prefill_xhtml10.tmpl'),
+  die_on_bad_params => FALSE,
+  loop_context_vars => TRUE,
+  cache             => TRUE,
+  global_vars       => TRUE,
+);
+
+
 $File->{T} = $T;
 $File->{S} = $SOAPT;
 $File->{E} = $E;
@@ -406,6 +425,8 @@
 $File->{Opt}->{'DOCTYPE'}        = $q->param('doctype') ? $q->param('doctype')   :     '';
 $File->{Opt}->{'Output'}         = $q->param('output')  ? $q->param('output')    : 'html';
 $File->{Opt}->{'Max Errors'}     = $q->param('me')      ? $q->param('me')        :     '';
+$File->{Opt}->{'Prefill'}        = $q->param('prefill') ? TRUE                   :  FALSE;
+$File->{Opt}->{'Prefill Doctype'}        = $q->param('prefill_doctype') ? $q->param('prefill_doctype')   :     'html401';
 
 #
 # "Fallback" info for Character Encoding (fbc), Content-Type (fbt),
@@ -1293,6 +1314,22 @@
   $File->{'Direct Input'} = TRUE;
   $File->{Charset}->{HTTP} = "utf-8"; # by default, the form accepts utf-8 chars
 
+  if ($File->{Opt}->{'Prefill'} eq TRUE ) {
+    # we surround the HTML fragment with some basic document structure
+    my $prefill_Template = undef;
+    if ($File->{Opt}->{'Prefill Doctype'} eq 'html401') {
+      $prefill_Template = $PREFILL_HTML_T;
+    }
+    else {
+      $prefill_Template = $PREFILL_XHTML_T;
+    }
+    $prefill_Template->param(fragment => $File->{Bytes});
+    $File->{Bytes} = $prefill_Template->output();
+    # let's force the view source so that the user knows what we've put around their code
+    $File->{Opt}->{'Show Source'} = TRUE;
+  }
+  
+
 
   return $File;
 }
Received on Thursday, 12 April 2007 07:18:24 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 April 2012 12:54:56 GMT