/[pub]/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.34 by wakaba, Sun Feb 10 03:11:06 2008 UTC revision 1.35 by wakaba, Sun Feb 10 04:08:04 2008 UTC
# Line 20  sub htescape ($) { Line 20  sub htescape ($) {
20    return $s;    return $s;
21  } # htescape  } # htescape
22    
23      my @nav;
24      my %time;
25      require Message::DOM::DOMImplementation;
26      my $dom = Message::DOM::DOMImplementation->new;
27    {
28    use Message::CGI::HTTP;    use Message::CGI::HTTP;
29    my $http = Message::CGI::HTTP->new;    my $http = Message::CGI::HTTP->new;
30    
# Line 31  sub htescape ($) { Line 36  sub htescape ($) {
36    binmode STDOUT, ':utf8';    binmode STDOUT, ':utf8';
37    $| = 1;    $| = 1;
38    
   require Message::DOM::DOMImplementation;  
   my $dom = Message::DOM::DOMImplementation->new;  
   
39    load_text_catalog ('en'); ## TODO: conneg    load_text_catalog ('en'); ## TODO: conneg
40    
   my @nav;  
41    print STDOUT qq[Content-Type: text/html; charset=utf-8    print STDOUT qq[Content-Type: text/html; charset=utf-8
42    
43  <!DOCTYPE html>  <!DOCTYPE html>
# Line 53  sub htescape ($) { Line 54  sub htescape ($) {
54    $| = 0;    $| = 0;
55    my $input = get_input_document ($http, $dom);    my $input = get_input_document ($http, $dom);
56    my $char_length = 0;    my $char_length = 0;
   my %time;  
57    
58    print qq[    print qq[
59  <div id="document-info" class="section">  <div id="document-info" class="section">
# Line 88  if (defined $input->{s}) { Line 88  if (defined $input->{s}) {
88  </div>  </div>
89  ];  ];
90    
91      $input->{id_prefix} = '';
92      #$input->{nested} = 0;
93    my $result = {conforming_min => 1, conforming_max => 1};    my $result = {conforming_min => 1, conforming_max => 1};
94    check_and_print ($input => $result);    check_and_print ($input => $result);
95    print_result_section ($result);    print_result_section ($result);
# Line 116  if (defined $input->{s}) { Line 118  if (defined $input->{s}) {
118    }    }
119    
120  exit;  exit;
121    }
122    
123  sub add_error ($$$) {  sub add_error ($$$) {
124    my ($layer, $err, $result) = @_;    my ($layer, $err, $result) = @_;
# Line 147  sub add_error ($$$) { Line 150  sub add_error ($$$) {
150    
151  sub check_and_print ($$) {  sub check_and_print ($$) {
152    my ($input, $result) = @_;    my ($input, $result) = @_;
   $input->{id_prefix} = '';  
   #$input->{nested} = 1/0;  
153    
154    print_http_header_section ($input, $result);    print_http_header_section ($input, $result);
155    
156    my $doc;    my $doc;
157    my $el;    my $el;
158      my $cssom;
159    my $manifest;    my $manifest;
160    my @subdoc;    my @subdoc;
161    
162    if ($input->{media_type} eq 'text/html') {    if ($input->{media_type} eq 'text/html') {
163      ($doc, $el) = print_syntax_error_html_section ($input, $result);      ($doc, $el) = print_syntax_error_html_section ($input, $result);
164      print_source_string_section      print_source_string_section
165          (\($input->{s}), $input->{charset} || $doc->input_encoding);          ($input,
166             \($input->{s}),
167             $input->{charset} || $doc->input_encoding);
168    } elsif ({    } elsif ({
169              'text/xml' => 1,              'text/xml' => 1,
170              'application/atom+xml' => 1,              'application/atom+xml' => 1,
# Line 170  sub check_and_print ($$) { Line 174  sub check_and_print ($$) {
174              'application/xml' => 1,              'application/xml' => 1,
175             }->{$input->{media_type}}) {             }->{$input->{media_type}}) {
176      ($doc, $el) = print_syntax_error_xml_section ($input, $result);      ($doc, $el) = print_syntax_error_xml_section ($input, $result);
177      print_source_string_section (\($input->{s}), $doc->input_encoding);      print_source_string_section ($input,
178                                     \($input->{s}),
179                                     $doc->input_encoding);
180      } elsif ($input->{media_type} eq 'text/css') {
181        $cssom = print_syntax_error_css_section ($input, $result);
182        print_source_string_section
183            ($input, \($input->{s}),
184             $cssom->manakai_input_encoding);
185    } elsif ($input->{media_type} eq 'text/cache-manifest') {    } elsif ($input->{media_type} eq 'text/cache-manifest') {
186  ## TODO: MUST be text/cache-manifest  ## TODO: MUST be text/cache-manifest
187      $manifest = print_syntax_error_manifest_section ($input, $result);      $manifest = print_syntax_error_manifest_section ($input, $result);
188      print_source_string_section (\($input->{s}), 'utf-8');      print_source_string_section ($input, \($input->{s}),
189                                     'utf-8');
190    } else {    } else {
191      ## TODO: Change HTTP status code??      ## TODO: Change HTTP status code??
192      print_result_unknown_type_section ($input, $result);      print_result_unknown_type_section ($input, $result);
# Line 198  sub check_and_print ($$) { Line 210  sub check_and_print ($$) {
210      print_listing_section ({      print_listing_section ({
211        id => 'classes', label => 'Classes', heading => 'Classes',        id => 'classes', label => 'Classes', heading => 'Classes',
212      }, $input, $elements->{class}) if keys %{$elements->{class}};      }, $input, $elements->{class}) if keys %{$elements->{class}};
213      } elsif (defined $cssom) {
214        print_structure_dump_cssom_section ($input, $cssom);
215        ## TODO: CSSOM validation
216    } elsif (defined $manifest) {    } elsif (defined $manifest) {
217      print_structure_dump_manifest_section ($input, $manifest);      print_structure_dump_manifest_section ($input, $manifest);
218      print_structure_error_manifest_section ($input, $manifest, $result);      print_structure_error_manifest_section ($input, $manifest, $result);
# Line 223  sub check_and_print ($$) { Line 238  sub check_and_print ($$) {
238          <dd><code class=URI>&lt;<a href="$ebaseuri">$ebaseuri</a>></code></dd>          <dd><code class=URI>&lt;<a href="$ebaseuri">$ebaseuri</a>></code></dd>
239        </dl>];                      </dl>];              
240    
241        $subinput->{id_prefix} .= '-';
242      check_and_print ($subinput => $result);      check_and_print ($subinput => $result);
243    
244      print STDOUT qq[</div>];      print STDOUT qq[</div>];
# Line 280  sub print_syntax_error_html_section ($$) Line 296  sub print_syntax_error_html_section ($$)
296      my (%opt) = @_;      my (%opt) = @_;
297      my ($type, $cls, $msg) = get_text ($opt{type}, $opt{level});      my ($type, $cls, $msg) = get_text ($opt{type}, $opt{level});
298      if ($opt{column} > 0) {      if ($opt{column} > 0) {
299        print STDOUT qq[<dt class="$cls"><a href="#line-$opt{line}">Line $opt{line}</a> column $opt{column}</dt>\n];        print STDOUT qq[<dt class="$cls"><a href="#$input->{id_prefix}line-$opt{line}">Line $opt{line}</a> column $opt{column}</dt>\n];
300      } else {      } else {
301        $opt{line} = $opt{line} - 1 || 1;        $opt{line} = $opt{line} - 1 || 1;
302        print STDOUT qq[<dt class="$cls"><a href="#line-$opt{line}">Line $opt{line}</a></dt>\n];        print STDOUT qq[<dt class="$cls"><a href="#$input->{id_prefix}line-$opt{line}">Line $opt{line}</a></dt>\n];
303      }      }
304      $type =~ tr/ /-/;      $type =~ tr/ /-/;
305      $type =~ s/\|/%7C/g;      $type =~ s/\|/%7C/g;
# Line 296  sub print_syntax_error_html_section ($$) Line 312  sub print_syntax_error_html_section ($$)
312    
313    my $doc = $dom->create_document;    my $doc = $dom->create_document;
314    my $el;    my $el;
315    my $inner_html_element = $http->get_parameter ('e');    my $inner_html_element = $input->{inner_html_element};
316    if (defined $inner_html_element and length $inner_html_element) {    if (defined $inner_html_element and length $inner_html_element) {
317      $input->{charset} ||= 'windows-1252'; ## TODO: for now.      $input->{charset} ||= 'windows-1252'; ## TODO: for now.
318      my $time1 = time;      my $time1 = time;
# Line 337  sub print_syntax_error_xml_section ($$) Line 353  sub print_syntax_error_xml_section ($$)
353    my $onerror = sub {    my $onerror = sub {
354      my $err = shift;      my $err = shift;
355      my $line = $err->location->line_number;      my $line = $err->location->line_number;
356      print STDOUT qq[<dt><a href="#line-$line">Line $line</a> column ];      print STDOUT qq[<dt><a href="#$input->{id_prefix}line-$line">Line $line</a> column ];
357      print STDOUT $err->location->column_number, "</dt><dd>";      print STDOUT $err->location->column_number, "</dt><dd>";
358      print STDOUT htescape $err->text, "</dd>\n";      print STDOUT htescape $err->text, "</dd>\n";
359    
# Line 364  sub print_syntax_error_xml_section ($$) Line 380  sub print_syntax_error_xml_section ($$)
380    return ($doc, undef);    return ($doc, undef);
381  } # print_syntax_error_xml_section  } # print_syntax_error_xml_section
382    
383    sub get_css_parser () {
384      our $CSSParser;
385      return $CSSParser if $CSSParser;
386    
387      require Whatpm::CSS::Parser;
388      my $p = Whatpm::CSS::Parser->new;
389    
390    #  if ($parse_mode eq 'q') {
391    #    $p->{unitless_px} = 1;
392    #    $p->{hashless_color} = 1;
393    #  }
394    
395      $p->{prop}->{$_} = 1 for qw/
396        background background-attachment background-color background-image
397        background-position background-position-x background-position-y
398        background-repeat border border-bottom border-bottom-color
399        border-bottom-style border-bottom-width border-collapse border-color
400        border-left border-left-color
401        border-left-style border-left-width border-right border-right-color
402        border-right-style border-right-width
403        border-spacing -manakai-border-spacing-x -manakai-border-spacing-y
404        border-style border-top border-top-color border-top-style border-top-width
405        border-width bottom
406        caption-side clear clip color content counter-increment counter-reset
407        cursor direction display empty-cells float font
408        font-family font-size font-size-adjust font-stretch
409        font-style font-variant font-weight height left
410        letter-spacing line-height
411        list-style list-style-image list-style-position list-style-type
412        margin margin-bottom margin-left margin-right margin-top marker-offset
413        marks max-height max-width min-height min-width opacity -moz-opacity
414        orphans outline outline-color outline-style outline-width overflow
415        overflow-x overflow-y
416        padding padding-bottom padding-left padding-right padding-top
417        page page-break-after page-break-before page-break-inside
418        position quotes right size table-layout
419        text-align text-decoration text-indent text-transform
420        top unicode-bidi vertical-align visibility white-space width widows
421        word-spacing z-index
422      /;
423      $p->{prop_value}->{display}->{$_} = 1 for qw/
424        block clip inline inline-block inline-table list-item none
425        table table-caption table-cell table-column table-column-group
426        table-header-group table-footer-group table-row table-row-group
427        compact marker
428      /;
429      $p->{prop_value}->{position}->{$_} = 1 for qw/
430        absolute fixed relative static
431      /;
432      $p->{prop_value}->{float}->{$_} = 1 for qw/
433        left right none
434      /;
435      $p->{prop_value}->{clear}->{$_} = 1 for qw/
436        left right none both
437      /;
438      $p->{prop_value}->{direction}->{ltr} = 1;
439      $p->{prop_value}->{direction}->{rtl} = 1;
440      $p->{prop_value}->{marks}->{crop} = 1;
441      $p->{prop_value}->{marks}->{cross} = 1;
442      $p->{prop_value}->{'unicode-bidi'}->{$_} = 1 for qw/
443        normal bidi-override embed
444      /;
445      for my $prop_name (qw/overflow overflow-x overflow-y/) {
446        $p->{prop_value}->{$prop_name}->{$_} = 1 for qw/
447          visible hidden scroll auto -webkit-marquee -moz-hidden-unscrollable
448        /;
449      }
450      $p->{prop_value}->{visibility}->{$_} = 1 for qw/
451        visible hidden collapse
452      /;
453      $p->{prop_value}->{'list-style-type'}->{$_} = 1 for qw/
454        disc circle square decimal decimal-leading-zero
455        lower-roman upper-roman lower-greek lower-latin
456        upper-latin armenian georgian lower-alpha upper-alpha none
457        hebrew cjk-ideographic hiragana katakana hiragana-iroha
458        katakana-iroha
459      /;
460      $p->{prop_value}->{'list-style-position'}->{outside} = 1;
461      $p->{prop_value}->{'list-style-position'}->{inside} = 1;
462      $p->{prop_value}->{'page-break-before'}->{$_} = 1 for qw/
463        auto always avoid left right
464      /;
465      $p->{prop_value}->{'page-break-after'}->{$_} = 1 for qw/
466        auto always avoid left right
467      /;
468      $p->{prop_value}->{'page-break-inside'}->{auto} = 1;
469      $p->{prop_value}->{'page-break-inside'}->{avoid} = 1;
470      $p->{prop_value}->{'background-repeat'}->{$_} = 1 for qw/
471        repeat repeat-x repeat-y no-repeat
472      /;
473      $p->{prop_value}->{'background-attachment'}->{scroll} = 1;
474      $p->{prop_value}->{'background-attachment'}->{fixed} = 1;
475      $p->{prop_value}->{'font-size'}->{$_} = 1 for qw/
476        xx-small x-small small medium large x-large xx-large
477        -manakai-xxx-large -webkit-xxx-large
478        larger smaller
479      /;
480      $p->{prop_value}->{'font-style'}->{normal} = 1;
481      $p->{prop_value}->{'font-style'}->{italic} = 1;
482      $p->{prop_value}->{'font-style'}->{oblique} = 1;
483      $p->{prop_value}->{'font-variant'}->{normal} = 1;
484      $p->{prop_value}->{'font-variant'}->{'small-caps'} = 1;
485      $p->{prop_value}->{'font-stretch'}->{$_} = 1 for
486          qw/normal wider narrower ultra-condensed extra-condensed
487            condensed semi-condensed semi-expanded expanded
488            extra-expanded ultra-expanded/;
489      $p->{prop_value}->{'text-align'}->{$_} = 1 for qw/
490        left right center justify begin end
491      /;
492      $p->{prop_value}->{'text-transform'}->{$_} = 1 for qw/
493        capitalize uppercase lowercase none
494      /;
495      $p->{prop_value}->{'white-space'}->{$_} = 1 for qw/
496        normal pre nowrap pre-line pre-wrap
497      /;
498      $p->{prop_value}->{'text-decoration'}->{$_} = 1 for qw/
499        none blink underline overline line-through
500      /;
501      $p->{prop_value}->{'caption-side'}->{$_} = 1 for qw/
502        top bottom left right
503      /;
504      $p->{prop_value}->{'table-layout'}->{auto} = 1;
505      $p->{prop_value}->{'table-layout'}->{fixed} = 1;
506      $p->{prop_value}->{'border-collapse'}->{collapase} = 1;
507      $p->{prop_value}->{'border-collapse'}->{separate} = 1;
508      $p->{prop_value}->{'empty-cells'}->{show} = 1;
509      $p->{prop_value}->{'empty-cells'}->{hide} = 1;
510      $p->{prop_value}->{cursor}->{$_} = 1 for qw/
511        auto crosshair default pointer move e-resize ne-resize nw-resize n-resize
512        se-resize sw-resize s-resize w-resize text wait help progress
513      /;
514      for my $prop (qw/border-top-style border-left-style
515                       border-bottom-style border-right-style outline-style/) {
516        $p->{prop_value}->{$prop}->{$_} = 1 for qw/
517          none hidden dotted dashed solid double groove ridge inset outset
518        /;
519      }
520      for my $prop (qw/color background-color
521                       border-bottom-color border-left-color border-right-color
522                       border-top-color border-color/) {
523        $p->{prop_value}->{$prop}->{transparent} = 1;
524        $p->{prop_value}->{$prop}->{flavor} = 1;
525        $p->{prop_value}->{$prop}->{'-manakai-default'} = 1;
526      }
527      $p->{prop_value}->{'outline-color'}->{invert} = 1;
528      $p->{prop_value}->{'outline-color'}->{'-manakai-invert-or-currentcolor'} = 1;
529      $p->{pseudo_class}->{$_} = 1 for qw/
530        active checked disabled empty enabled first-child first-of-type
531        focus hover indeterminate last-child last-of-type link only-child
532        only-of-type root target visited
533        lang nth-child nth-last-child nth-of-type nth-last-of-type not
534        -manakai-contains -manakai-current
535      /;
536      $p->{pseudo_element}->{$_} = 1 for qw/
537        after before first-letter first-line
538      /;
539    
540      return $CSSParser = $p;
541    } # get_css_parser
542    
543    sub print_syntax_error_css_section ($$) {
544      my ($input, $result) = @_;
545    
546      print STDOUT qq[
547    <div id="$input->{id_prefix}parse-errors" class="section">
548    <h2>Parse Errors</h2>
549    
550    <dl>];
551      push @nav, ['#parse-errors' => 'Parse Error'] unless $input->{nested};
552    
553      my $p = get_css_parser ();
554      $p->{onerror} = sub {
555        my (%opt) = @_;
556        my ($type, $cls, $msg) = get_text ($opt{type}, $opt{level});
557        if ($opt{token}) {
558          print STDOUT qq[<dt class="$cls"><a href="#$input->{id_prefix}line-$opt{token}->{line}">Line $opt{token}->{line}</a> column $opt{token}->{column}];
559        } else {
560          print STDOUT qq[<dt class="$cls">Unknown location];
561        }
562        if (defined $opt{value}) {
563          print STDOUT qq[ (<code>@{[htescape ($opt{value})]}</code>)];
564        } elsif (defined $opt{token}) {
565          print STDOUT qq[ (<code>@{[htescape (Whatpm::CSS::Tokenizer->serialize_token ($opt{token}))]}</code>)];
566        }
567        $type =~ tr/ /-/;
568        $type =~ s/\|/%7C/g;
569        $msg .= qq[ [<a href="../error-description#@{[htescape ($type)]}">Description</a>]];
570        print STDOUT qq[<dd class="$cls">], get_error_level_label (\%opt);
571        print STDOUT qq[$msg</dd>\n];
572    
573        add_error ('syntax', \%opt => $result);
574      };
575      $p->{href} = $input->{uri};
576      $p->{base_uri} = $input->{base_uri};
577    
578      my $s = \$input->{s};
579      my $charset;
580      unless ($input->{is_char_string}) {
581        require Encode;
582        if (defined $input->{charset}) {## TODO: IANA->Perl
583          $charset = $input->{charset};
584          $s = \(Encode::decode ($input->{charset}, $$s));
585        } else {
586          ## TODO: charset detection
587          $s = \(Encode::decode ($charset = 'utf-8', $$s));
588        }
589      }
590      
591      my $cssom = $p->parse_char_string ($$s);
592      $cssom->manakai_input_encoding ($charset) if defined $charset;
593    
594      print STDOUT qq[</dl></div>];
595    
596      return $cssom;
597    } # print_syntax_error_css_section
598    
599  sub print_syntax_error_manifest_section ($$) {  sub print_syntax_error_manifest_section ($$) {
600    my ($input, $result) = @_;    my ($input, $result) = @_;
601    
# Line 400  sub print_syntax_error_manifest_section Line 632  sub print_syntax_error_manifest_section
632    return $manifest;    return $manifest;
633  } # print_syntax_error_manifest_section  } # print_syntax_error_manifest_section
634    
635  sub print_source_string_section ($$) {  sub print_source_string_section ($$$) {
636    require Encode;    my $input = shift;
637    my $enc = Encode::find_encoding ($_[1]); ## TODO: charset name -> Perl name    my $s;
638    return unless $enc;    unless ($input->{is_char_string}) {
639        require Encode;
640        my $enc = Encode::find_encoding ($_[1]); ## TODO: charset name -> Perl name
641        return unless $enc;
642    
643        $s = \($enc->decode (${$_[0]}));
644      } else {
645        $s = $_[0];
646      }
647    
   my $s = \($enc->decode (${$_[0]}));  
648    my $i = 1;                                my $i = 1;                            
649    push @nav, ['#source-string' => 'Source'] unless $input->{nested};    push @nav, ['#source-string' => 'Source'] unless $input->{nested};
650    print STDOUT qq[<div id="$input->{id_prefix}source-string" class="section">    print STDOUT qq[<div id="$input->{id_prefix}source-string" class="section">
# Line 427  sub print_source_string_section ($$) { Line 666  sub print_source_string_section ($$) {
666    print STDOUT "</ol></div>";    print STDOUT "</ol></div>";
667  } # print_input_string_section  } # print_input_string_section
668    
669  sub print_document_tree ($) {  sub print_document_tree ($$) {
670    my $node = shift;    my ($input, $node) = @_;
671    
672    my $r = '<ol class="xoxo">';    my $r = '<ol class="xoxo">';
673    
674    my @node = ($node);    my @node = ($node);
# Line 526  sub print_structure_dump_dom_section ($$ Line 766  sub print_structure_dump_dom_section ($$
766  <div id="$input->{id_prefix}document-tree" class="section">  <div id="$input->{id_prefix}document-tree" class="section">
767  <h2>Document Tree</h2>  <h2>Document Tree</h2>
768  ];  ];
769    push @nav, ['#document-tree' => 'Tree'] unless $input->{nested};    push @nav, [qq[#$input->{id_prefix}document-tree] => 'Tree']
770          unless $input->{nested};
771    
772    print_document_tree ($el || $doc);    print_document_tree ($input, $el || $doc);
773    
774    print STDOUT qq[</div>];    print STDOUT qq[</div>];
775  } # print_structure_dump_dom_section  } # print_structure_dump_dom_section
776    
777    sub print_structure_dump_cssom_section ($$) {
778      my ($input, $cssom) = @_;
779    
780      print STDOUT qq[
781    <div id="$input->{id_prefix}document-tree" class="section">
782    <h2>Document Tree</h2>
783    ];
784      push @nav, [qq[#$input->{id_prefix}document-tree] => 'Tree']
785          unless $input->{nested};
786    
787      ## TODO:
788      print STDOUT "<pre>".htescape ($cssom->css_text)."</pre>";
789    
790      print STDOUT qq[</div>];
791    } # print_structure_dump_cssom_section
792    
793  sub print_structure_dump_manifest_section ($$) {  sub print_structure_dump_manifest_section ($$) {
794    my ($input, $manifest) = @_;    my ($input, $manifest) = @_;
795    
# Line 540  sub print_structure_dump_manifest_sectio Line 797  sub print_structure_dump_manifest_sectio
797  <div id="$input->{id_prefix}dump-manifest" class="section">  <div id="$input->{id_prefix}dump-manifest" class="section">
798  <h2>Cache Manifest</h2>  <h2>Cache Manifest</h2>
799  ];  ];
800    push @nav, ['#dump-manifest' => 'Caceh Manifest'] unless $input->{nested};    push @nav, [qq[#$input->{id_prefix}dump-manifest] => 'Cache Manifest']
801          unless $input->{nested};
802    
803    print STDOUT qq[<dl><dt>Explicit entries</dt>];    print STDOUT qq[<dl><dt>Explicit entries</dt>];
804    for my $uri (@{$manifest->[0]}) {    for my $uri (@{$manifest->[0]}) {
# Line 574  sub print_structure_error_dom_section ($ Line 832  sub print_structure_error_dom_section ($
832  <h2>Document Errors</h2>  <h2>Document Errors</h2>
833    
834  <dl>];  <dl>];
835    push @nav, ['#document-errors' => 'Document Error'] unless $input->{nested};    push @nav, [qq[#$input->{id_prefix}document-errors] => 'Document Error']
836          unless $input->{nested};
837    
838    require Whatpm::ContentChecker;    require Whatpm::ContentChecker;
839    my $onerror = sub {    my $onerror = sub {
# Line 612  sub print_structure_error_manifest_secti Line 871  sub print_structure_error_manifest_secti
871  <h2>Document Errors</h2>  <h2>Document Errors</h2>
872    
873  <dl>];  <dl>];
874    push @nav, ['#document-errors' => 'Document Error'] unless $input->{nested};    push @nav, [qq[#$input->{id_prefix}document-errors] => 'Document Error']
875          unless $input->{nested};
876    
877    require Whatpm::CacheManifest;    require Whatpm::CacheManifest;
878    Whatpm::CacheManifest->check_manifest ($manifest, sub {    Whatpm::CacheManifest->check_manifest ($manifest, sub {
# Line 632  sub print_structure_error_manifest_secti Line 892  sub print_structure_error_manifest_secti
892  sub print_table_section ($$) {  sub print_table_section ($$) {
893    my ($input, $tables) = @_;    my ($input, $tables) = @_;
894        
895    push @nav, ['#tables' => 'Tables'] unless $input->{nested};    push @nav, [qq[#$input->{id_prefix}tables] => 'Tables']
896          unless $input->{nested};
897    print STDOUT qq[    print STDOUT qq[
898  <div id="$input->{id_prefix}tables" class="section">  <div id="$input->{id_prefix}tables" class="section">
899  <h2>Tables</h2>  <h2>Tables</h2>
# Line 692  sub print_table_section ($$) { Line 953  sub print_table_section ($$) {
953  sub print_listing_section ($$$) {  sub print_listing_section ($$$) {
954    my ($opt, $input, $ids) = @_;    my ($opt, $input, $ids) = @_;
955        
956    push @nav, ['#' . $opt->{id} => $opt->{label}] unless $input->{nested};    push @nav, ['#' . $input->{id_prefix} . $opt->{id} => $opt->{label}]
957          unless $input->{nested};
958    print STDOUT qq[    print STDOUT qq[
959  <div id="$input->{id_prefix}$opt->{id}" class="section">  <div id="$input->{id_prefix}$opt->{id}" class="section">
960  <h2>$opt->{heading}</h2>  <h2>$opt->{heading}</h2>
# Line 804  sub print_result_unknown_type_section ($ Line 1066  sub print_result_unknown_type_section ($
1066    
1067    my $euri = htescape ($input->{uri});    my $euri = htescape ($input->{uri});
1068    print STDOUT qq[    print STDOUT qq[
1069  <div id="parse-errors" class="section">  <div id="$input->{id_prefix}parse-errors" class="section">
1070  <h2>Errors</h2>  <h2>Errors</h2>
1071    
1072  <dl>  <dl>
# Line 817  sub print_result_unknown_type_section ($ Line 1079  sub print_result_unknown_type_section ($
1079  </dl>  </dl>
1080  </div>  </div>
1081  ];  ];
1082    push @nav, ['#parse-errors' => 'Errors'];    push @nav, [qq[#$input->{id_prefix}parse-errors] => 'Errors']
1083          unless $input->{nested};
1084    add_error (char => {level => 'u'} => $result);    add_error (char => {level => 'u'} => $result);
1085    add_error (syntax => {level => 'u'} => $result);    add_error (syntax => {level => 'u'} => $result);
1086    add_error (structure => {level => 'u'} => $result);    add_error (structure => {level => 'u'} => $result);
# Line 838  sub get_error_label ($$) { Line 1101  sub get_error_label ($$) {
1101    
1102    if (defined $err->{line}) {    if (defined $err->{line}) {
1103      if ($err->{column} > 0) {      if ($err->{column} > 0) {
1104        $r = qq[<a href="#line-$err->{line}">Line $err->{line}</a> column $err->{column}];        $r = qq[<a href="#$input->{id_prefix}line-$err->{line}">Line $err->{line}</a> column $err->{column}];
1105      } else {      } else {
1106        $err->{line} = $err->{line} - 1 || 1;        $err->{line} = $err->{line} - 1 || 1;
1107        $r = qq[<a href="#line-$err->{line}">Line $err->{line}</a>];        $r = qq[<a href="#$input->{id_prefix}line-$err->{line}">Line $err->{line}</a>];
1108      }      }
1109    }    }
1110    
# Line 1124  EOH Line 1387  EOH
1387      return $r;      return $r;
1388    }    }
1389    
1390      $r->{inner_html_element} = $http->get_parameter ('e');
1391    
1392    return $r;    return $r;
1393  } # get_input_document  } # get_input_document
1394    
# Line 1156  Wakaba <w@suika.fam.cx>. Line 1421  Wakaba <w@suika.fam.cx>.
1421    
1422  =head1 LICENSE  =head1 LICENSE
1423    
1424  Copyright 2007 Wakaba <w@suika.fam.cx>  Copyright 2007-2008 Wakaba <w@suika.fam.cx>
1425    
1426  This library is free software; you can redistribute it  This library is free software; you can redistribute it
1427  and/or modify it under the same terms as Perl itself.  and/or modify it under the same terms as Perl itself.

Legend:
Removed from v.1.34  
changed lines
  Added in v.1.35

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24