Author: mcbrown
Date: 2006-07-18 09:41:16 +0200 (Tue, 18 Jul 2006)
New Revision: 2758
Log:
Updated deep-check.pl
It now tracks section IDs, so it can give you a more precise location (well, section at
least) when it finds an error. (Thanks, Jon, for an obvious suggestions on this!)
In tables, it now checks whether the <tgroup>, <colspec> and the actual number
of <entry> columns match, rather than just comparing the first two. (Thanks Paul,
for highlighting an element I hand't fixed in the c/net docs that triggered this)
Modified:
trunk/tools/deep-check.pl
Modified: trunk/tools/deep-check.pl
===================================================================
--- trunk/tools/deep-check.pl 2006-07-17 18:42:52 UTC (rev 2757)
+++ trunk/tools/deep-check.pl 2006-07-18 07:41:16 UTC (rev 2758)
Changed blocks: 5, Lines Added: 56, Lines Deleted: 10; 6372 bytes
@@ -63,6 +63,8 @@
return bless {'tag' => $tag,
'sectionids' => {},
+ 'currsection' => '',
+ 'sectionmap' => [],
'intag' => 0,
'tablecount' => 0,
'tabledefs' => {},
@@ -87,6 +89,8 @@
{
if (exists($element->{Attributes}->{id}))
{
+ push(@{$self->{sectionmap}},$element->{Attributes}->{id});
+ $self->{currsection} = $element->{Attributes}->{id};
if (exists($self->{sectionids}->{$element->{Attributes}->{id}}))
{
print STDERR "Error: Found a duplicate section ID
($element->{Attributes}->{id})\n";
@@ -109,7 +113,18 @@
{
$self->{tabledefs}->{$self->{tablecount}}->{defcolumns} =
$element->{Attributes}->{cols};
$self->{tabledefs}->{$self->{tablecount}}->{speccolumns} = 0;
+ $self->{tabledefs}->{$self->{tablecount}}->{foundcolumns} = 0;
+ $self->{tabledefs}->{$self->{tablecount}}->{maxcolumns} = 0;
+ $self->{tabledefs}->{$self->{tablecount}}->{section} =
$self->{currsection};
}
+ if ($element->{Name} eq 'row')
+ {
+ $self->{tabledefs}->{$self->{tablecount}}->{foundcolumns} = 0;
+ }
+ if ($element->{Name} eq 'entry')
+ {
+ $self->{tabledefs}->{$self->{tablecount}}->{foundcolumns}++;
+ }
if ($element->{Name} eq 'colspec')
{
if (defined($element->{Attributes}->{colwidth}))
@@ -135,6 +150,26 @@
{
my ($self, $element) = @_;
+ if ($element->{Name} eq 'section')
+ {
+ if (exists($element->{Attributes}->{id}))
+ {
+ my $cursection = pop(@{$self->{sectionmap}});
+ $self->{currsection} = $self->{sectionmap}->[-1];
+ }
+ }
+
+
+ if ($element->{Name} eq 'row')
+ {
+ if ($self->{tabledefs}->{$self->{tablecount}}->{foundcolumns} >
+ $self->{tabledefs}->{$self->{tablecount}}->{maxcolumns})
+ {
+ $self->{tabledefs}->{$self->{tablecount}}->{maxcolumns} =
+ $self->{tabledefs}->{$self->{tablecount}}->{foundcolumns};
+ }
+ }
+
if ($element->{Name} eq 'informaltable' ||
$element->{Name} eq 'table')
{
@@ -143,38 +178,49 @@
if
(!defined($self->{tabledefs}->{$self->{tablecount}}->{speccolumns}))
{
- print STDERR "Error in Table $self->{tablecount}: No columns specified in
table!\n";
+ print STDERR "Error in Table within section
$self->{tablecount}->{section}: No columns specified in table!\n";
}
elsif
(!defined($self->{tabledefs}->{$self->{tablecount}}->{defcolumns}))
{
- print STDERR "Error in Table $self->{tablecount}: No columns in table!\n";
+ print STDERR "Error in Table within section
$self->{tablecount}->{section}: No columns in table!\n";
}
elsif ($self->{tabledefs}->{$self->{tablecount}}->{speccolumns} !=
$self->{tabledefs}->{$self->{tablecount}}->{defcolumns})
{
- print STDERR "Error in Table $self->{tablecount}\n";
- print STDERR "\tWarning!: Table definition mismatch!!\n";
- print STDERR "\tDefined columns
$self->{tabledefs}->{$self->{tablecount}}->{defcolumns}\n";
- print STDERR "\tActual columns
$self->{tabledefs}->{$self->{tablecount}}->{speccolumns}\n";
+ print STDERR "Error in Table within section
$self->{tabledefs}->{$self->{tablecount}}->{section}\n";
+ print STDERR "\tWarning!: Column definition mismatch!!\n";
+ print STDERR "\tGroup defined columns (tgroup)
$self->{tabledefs}->{$self->{tablecount}}->{defcolumns}\n";
+ print STDERR "\tSpecified columns (colspec)
$self->{tabledefs}->{$self->{tablecount}}->{speccolumns}\n";
}
+ elsif (($self->{tabledefs}->{$self->{tablecount}}->{speccolumns} !=
+ $self->{tabledefs}->{$self->{tablecount}}->{maxcolumns}) ||
+ ($self->{tabledefs}->{$self->{tablecount}}->{speccolumns} !=
+ $self->{tabledefs}->{$self->{tablecount}}->{maxcolumns}))
+ {
+ print STDERR "Error in Table within section
$self->{tabledefs}->{$self->{tablecount}}->{section}\n";
+ print STDERR "\tWarning!: Column definition/column number mismatch!!\n";
+ print STDERR "\tGroup defined columns (tgroup)
$self->{tabledefs}->{$self->{tablecount}}->{defcolumns}\n";
+ print STDERR "\tSpecified columns (colspec)
$self->{tabledefs}->{$self->{tablecount}}->{speccolumns}\n";
+ print STDERR "\tActual columns (entry)
$self->{tabledefs}->{$self->{tablecount}}->{maxcolumns}\n";
+ }
# Check the column width count and ensure that the total figures equal 100
if (!defined($self->{tabledefs}->{$self->{tablecount}}->{colwidth}))
{
- print STDERR "Error in Table $self->{tablecount}: No column width
specified\n";
+ print STDERR "Error in Table within section
$self->{tablecount}->{section}: No column width specified\n";
}
elsif ($self->{tabledefs}->{$self->{tablecount}}->{colwidth} == 0)
{
- print STDERR "Error in Table $self->{tablecount}: Total column width is
0\n";
+ print STDERR "Error in Table within section
$self->{tablecount}->{section}: Total column width is 0\n";
}
elsif ($self->{tabledefs}->{$self->{tablecount}}->{colwidth} == 0)
{
- print STDERR "Error in Table $self->{tablecount}: Total column width is
less than 100%\n";
+ print STDERR "Error in Table within section
$self->{tablecount}->{section}: Total column width is less than 100%\n";
}
elsif ($self->{tabledefs}->{$self->{tablecount}}->{colwidth} >
100)
{
- print STDERR "Error in Table $self->{tablecount}: Total column width is
more than 100%\n";
+ print STDERR "Error in Table within section
$self->{tablecount}->{section}: Total column width is more than 100%\n";
}
$self->{intable} = 0;
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r2758 - trunk/tools | mcbrown | 18 Jul |