/[suikacvs]/test/html-webhacc/cc.cgi
Suika

Diff of /test/html-webhacc/cc.cgi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.23 by wakaba, Mon Nov 5 09:33:52 2007 UTC revision 1.24 by wakaba, Sun Nov 11 06:57:16 2007 UTC
# Line 110  if (defined $input->{s}) { Line 110  if (defined $input->{s}) {
110      print_source_string_section (\($input->{s}), 'utf-8');      print_source_string_section (\($input->{s}), 'utf-8');
111    } else {    } else {
112      ## TODO: Change HTTP status code??      ## TODO: Change HTTP status code??
113      print_result_unknown_type_section ($input);      print_result_unknown_type_section ($input, $result);
114    }    }
115    
116    if (defined $doc or defined $el) {    if (defined $doc or defined $el) {
# Line 143  if (defined $input->{s}) { Line 143  if (defined $input->{s}) {
143  </html>  </html>
144  ];  ];
145    
146    for (qw/decode parse parse_xml parse_manifest check check_manifest/) {    for (qw/decode parse parse_html parse_xml parse_manifest
147              check check_manifest/) {
148      next unless defined $time{$_};      next unless defined $time{$_};
149      open my $file, '>>', ".cc-$_.txt" or die ".cc-$_.txt: $!";      open my $file, '>>', ".cc-$_.txt" or die ".cc-$_.txt: $!";
150      print $file $char_length, "\t", $time{$_}, "\n";      print $file $char_length, "\t", $time{$_}, "\n";
# Line 218  sub print_syntax_error_html_section ($$) Line 219  sub print_syntax_error_html_section ($$)
219        
220    require Encode;    require Encode;
221    require Whatpm::HTML;    require Whatpm::HTML;
   
   $input->{charset} ||= 'ISO-8859-1'; ## TODO: for now.  
222        
   my $time1 = time;  
   my $t = Encode::decode ($input->{charset}, $input->{s});  
   $time{decode} = time - $time1;  
   
223    print STDOUT qq[    print STDOUT qq[
224  <div id="parse-errors" class="section">  <div id="parse-errors" class="section">
225  <h2>Parse Errors</h2>  <h2>Parse Errors</h2>
# Line 252  sub print_syntax_error_html_section ($$) Line 247  sub print_syntax_error_html_section ($$)
247    
248    my $doc = $dom->create_document;    my $doc = $dom->create_document;
249    my $el;    my $el;
   $time1 = time;  
250    if (defined $inner_html_element and length $inner_html_element) {    if (defined $inner_html_element and length $inner_html_element) {
251        $input->{charset} ||= 'ISO-8859-1'; ## TODO: for now.
252        my $time1 = time;
253        my $t = Encode::decode ($input->{charset}, $input->{s});
254        $time{decode} = time - $time1;
255        
256      $el = $doc->create_element_ns      $el = $doc->create_element_ns
257          ('http://www.w3.org/1999/xhtml', [undef, $inner_html_element]);          ('http://www.w3.org/1999/xhtml', [undef, $inner_html_element]);
258        $time1 = time;
259      Whatpm::HTML->set_inner_html ($el, $t, $onerror);      Whatpm::HTML->set_inner_html ($el, $t, $onerror);
260        $time{parse} = time - $time1;
261    } else {    } else {
262      Whatpm::HTML->parse_string ($t => $doc, $onerror);      my $time1 = time;
263        Whatpm::HTML->parse_byte_string
264            ($input->{charset}, $input->{s} => $doc, $onerror);
265        $time{parse_html} = time - $time1;
266    }    }
267    $time{parse} = time - $time1;    
   
268    print STDOUT qq[</dl></div>];    print STDOUT qq[</dl></div>];
269    
270    return ($doc, $el);    return ($doc, $el);
# Line 759  is <em>under development</em>.  The resu Line 762  is <em>under development</em>.  The resu
762    push @nav, ['#result-summary' => 'Result'];    push @nav, ['#result-summary' => 'Result'];
763  } # print_result_section  } # print_result_section
764    
765  sub print_result_unknown_type_section ($) {  sub print_result_unknown_type_section ($$) {
766    my $input = shift;    my ($input, $result) = @_;
767    
768      my $euri = htescape ($input->{uri});
769    print STDOUT qq[    print STDOUT qq[
770  <div id="result-summary" class="section">  <div id="parse-errors" class="section">
771  <p><em>Media type <code class="MIME" lang="en">@{[htescape $input->{media_type}]}</code> is not supported!</em></p>  <h2>Errors</h2>
772    
773    <dl>
774    <dt class=unsupported><code>&lt;<a href="$euri">$euri</a>&gt;</code></dt>
775        <dd class=unsupported><strong><a href="../error-description#level-u">Not
776            supported</a></strong>:
777        Media type
778        <code class="MIME" lang="en">@{[htescape $input->{media_type}]}</code>
779        is not supported.</dd>
780    </dl>
781  </div>  </div>
782  ];  ];
783    push @nav, ['#result-summary' => 'Result'];    push @nav, ['#parse-errors' => 'Errors'];
784      add_error (char => {level => 'unsupported'} => $result);
785      add_error (syntax => {level => 'unsupported'} => $result);
786      add_error (structure => {level => 'unsupported'} => $result);
787  } # print_result_unknown_type_section  } # print_result_unknown_type_section
788    
789  sub print_result_input_error_section ($) {  sub print_result_input_error_section ($) {

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.24

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24