/[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.4 by wakaba, Wed Jun 27 14:36:45 2007 UTC revision 1.5 by wakaba, Sat Jun 30 08:26:08 2007 UTC
# Line 194  my $http = SuikaWiki::Input::HTTP->new; Line 194  my $http = SuikaWiki::Input::HTTP->new;
194            "</a></dt>\n<dd>", htescape $opt{type}, "</dd>\n";            "</a></dt>\n<dd>", htescape $opt{type}, "</dd>\n";
195      };      };
196    
197        my $elements;
198      if ($el) {      if ($el) {
199        Whatpm::ContentChecker->check_element ($el, $onerror);        $elements = Whatpm::ContentChecker->check_element ($el, $onerror);
200      } else {      } else {
201        Whatpm::ContentChecker->check_document ($doc, $onerror);        $elements = Whatpm::ContentChecker->check_document ($doc, $onerror);
202      }      }
203    
204      print STDOUT qq[      print STDOUT qq[
205  </dl>  </dl>
206  </div>  </div>
207  ];  ];
208    
209        if (@{$elements->{table}}) {
210          require JSON;
211    
212          print STDOUT qq[
213    <div id="tables" class="section">
214    <h2>Tables</h2>
215    
216    <!--[if IE]><script type="text/javascript" src="../excanvas.js"></script><![endif]-->
217    <script src="../table-script.js" type="text/javascript"></script>
218    <noscript>
219    <p><em>Structure of tables are visualized here if scripting is enabled.</em></p>
220    </noscript>
221    ];
222    
223          my $i = 0;
224          for my $table_el (@{$elements->{table}}) {
225            $i++;
226            print STDOUT qq[<div class="section" id="table-$i"><h3>];
227            print STDOUT qq[<a href="#node-@{[refaddr $table_el]}">],
228              htescape get_node_path ($table_el);
229            print STDOUT qq[</a></h3>\n];
230            
231            my $table = Whatpm::HTMLTable->form_table ($table_el);
232            
233            for (@{$table->{column_group}}, @{$table->{column}}, $table->{caption}) {
234              next unless $_;
235              delete $_->{element};
236            }
237            
238            for (@{$table->{row_group}}) {
239              next unless $_;
240              next unless $_->{element};
241              $_->{type} = $_->{element}->manakai_local_name;
242              delete $_->{element};
243            }
244            
245            for (@{$table->{cell}}) {
246              next unless $_;
247              for (@{$_}) {
248                next unless $_;
249                for (@$_) {
250                  $_->{id} = refaddr $_->{element} if defined $_->{element};
251                  delete $_->{element};
252                }
253              }
254            }
255            
256            print STDOUT '</div><script type="text/javascript">tableToCanvas (';
257            print STDOUT JSON::objToJson ($table);
258            print STDOUT qq[, document.getElementById ('table-$i'));</script>];
259          }
260        
261          print STDOUT qq[</div>];
262        }
263    }    }
264    
265    ## TODO: Show result    ## TODO: Show result
# Line 282  sub print_document_tree ($) { Line 338  sub print_document_tree ($) {
338          unshift @node, @{$child->child_nodes}, '</ol>';          unshift @node, @{$child->child_nodes}, '</ol>';
339        }        }
340      } elsif ($nt == $child->DOCUMENT_TYPE_NODE) {      } elsif ($nt == $child->DOCUMENT_TYPE_NODE) {
341        $r .= qq'<li id="$node_id" class="tree-doctype"><code>&lt;!DOCTYPE&gt;</code><ul>';        $r .= qq'<li id="$node_id" class="tree-doctype"><code>&lt;!DOCTYPE&gt;</code><ul class="attributes">';
342        $r .= '<li class="tree-doctype-name">Name = <q>@{[htescape ($child->name)]}</q></li>';        $r .= qq[<li class="tree-doctype-name">Name = <q>@{[htescape ($child->name)]}</q></li>];
343        $r .= '<li class="tree-doctype-publicid">Public identifier = <q>@{[htescape ($child->public_id)]}</q></li>';        $r .= qq[<li class="tree-doctype-publicid">Public identifier = <q>@{[htescape ($child->public_id)]}</q></li>];
344        $r .= '<li class="tree-doctype-systemid">System identifier = <q>@{[htescape ($child->system_id)]}</q></li>';        $r .= qq[<li class="tree-doctype-systemid">System identifier = <q>@{[htescape ($child->system_id)]}</q></li>];
345        $r .= '</ul></li>';        $r .= '</ul></li>';
346      } elsif ($nt == $child->PROCESSING_INSTRUCTION_NODE) {      } elsif ($nt == $child->PROCESSING_INSTRUCTION_NODE) {
347        $r .= qq'<li id="$node_id" class="tree-id"><code>&lt;?@{[htescape ($child->target)]}</code> <q>@{[htescape ($child->data)]}</q><code>?&gt;</code></li>';        $r .= qq'<li id="$node_id" class="tree-id"><code>&lt;?@{[htescape ($child->target)]}</code> <q>@{[htescape ($child->data)]}</q><code>?&gt;</code></li>';

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

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24