/[suikacvs]/test/html-webhacc/WebHACC/Input.pm
Suika

Diff of /test/html-webhacc/WebHACC/Input.pm

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

revision 1.3 by wakaba, Mon Jul 21 05:24:32 2008 UTC revision 1.5 by wakaba, Mon Jul 21 12:56:34 2008 UTC
# Line 11  sub nested ($) { 0 } Line 11  sub nested ($) { 0 }
11    
12  sub subdocument_index ($) { 0 }  sub subdocument_index ($) { 0 }
13    
14    sub full_subdocument_index ($) { 0 }
15    
16  sub generate_info_section ($$) {  sub generate_info_section ($$) {
17    my $self = shift;    my $self = shift;
18        
# Line 42  sub generate_info_section ($$) { Line 44  sub generate_info_section ($$) {
44      $out->start_tag ('dd');      $out->start_tag ('dd');
45      $out->code ($self->{media_type}, class => 'MIME', lang => 'en');      $out->code ($self->{media_type}, class => 'MIME', lang => 'en');
46      if ($self->{media_type_overridden}) {      if ($self->{media_type_overridden}) {
47        $out->html (' <em>(overridden)</em>');        $out->nl_text ('... overridden');
48      } elsif (defined $self->{official_type}) {      } elsif (defined $self->{official_type}) {
49        if ($self->{media_type} eq $self->{official_type}) {        if ($self->{media_type} eq $self->{official_type}) {
50          #          #
51        } else {        } else {
52          $out->html (' <em>(sniffed; official type is: ');          $out->nl_text ('... sniffed, official type is #',
53          $out->code ($self->{official_type}, class => 'MIME', lang => 'en');                         text => $self->{official_type});
         $out->html (')</em>');  
54        }        }
55      } else {      } else {
56        $out->html ( '<em>(sniffed)</em>');        $out->nl_text ( '... sniffed');
57      }      }
58    
59      $out->dt ('Character Encoding');      $out->dt ('Character Encoding');
# Line 60  sub generate_info_section ($$) { Line 61  sub generate_info_section ($$) {
61      if (defined $self->{charset}) {      if (defined $self->{charset}) {
62        $out->code ($self->{charset}, class => 'charset', lang => 'en');        $out->code ($self->{charset}, class => 'charset', lang => 'en');
63      } else {      } else {
64        $out->text ('(none)');        $out->nl_text ('(unknown)');
65      }      }
66      $out->html (' <em>overridden</em>') if $self->{charset_overridden};      $out->nl_text ('... overridden') if $self->{charset_overridden};
67    
68      $out->dt ($self->{is_char_string} ? 'Character Length' : 'Byte Length');      $out->dt ($self->{is_char_string} ? 'Character Length' : 'Byte Length');
69      ## TODO: formatting      ## TODO: formatting
70      $out->start_tag ('dd');      $out->start_tag ('dd');
71      my $length = length $self->{s};      my $length = length $self->{s};
72      $out->text ($length . ($self->{is_char_string} ? ' character' : ' byte') .      $out->text ($length . ' ');
73                  ($length == 1 ? '' : 's'));      $out->nl_text (($self->{is_char_string} ? 'character' : 'byte') .
74                       ($length == 1 ? '' : 's'));
75    }    }
76    
77    $out->end_tag ('dl');    $out->end_tag ('dl');
# Line 134  sub new ($$) { Line 136  sub new ($$) {
136  } # new  } # new
137    
138  sub id_prefix ($) {  sub id_prefix ($) {
139    return 'subdoc-' . shift->{subdocument_index} . '-';    return 'subdoc-' . shift->full_subdocument_index . '-';
140  } # id_prefix  } # id_prefix
141    
142  sub nested ($) { 1 }  sub nested ($) { 1 }
# Line 143  sub subdocument_index ($) { Line 145  sub subdocument_index ($) {
145    return shift->{subdocument_index};    return shift->{subdocument_index};
146  } # subdocument_index  } # subdocument_index
147    
148    sub full_subdocument_index ($) {
149      my $self = shift;
150      my $parent = $self->{parent_input}->full_subdocument_index;
151      if ($parent) {
152        return $parent . '.' . $self->{subdocument_index};
153      } else {
154        return $self->{subdocument_index};
155      }
156    } # full_subdocument_index
157    
158  sub start_section ($$) {  sub start_section ($$) {
159    my $self = shift;    my $self = shift;
160    
161    my $result = shift;    my $result = shift;
162    my $out = $result->output;    my $out = $result->output;
163    
164      my $index = $self->full_subdocument_index;
165    $out->start_section (id => $self->id_prefix,    $out->start_section (id => $self->id_prefix,
166                         title => qq[Subdocument #] . $self->subdocument_index,                         title => qq[Subdocument #],
167                         short_title => 'Sub #' . $self->subdocument_index);                         short_title => 'Sub #',
168                           text => $index);
169  } # start_section  } # start_section
170    
171  sub end_section ($$) {  sub end_section ($$) {

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.5

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24