- From: Olivier Thereaux via cvs-syncmail <cvsmail@w3.org>
- Date: Thu, 12 Apr 2007 07:18:17 +0000
- To: www-validator-cvs@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 UTC