List:Commits« Previous MessageNext Message »
From:mcbrown Date:September 20 2006 9:35am
Subject:svn commit - mysqldoc@docsrva: r3398 - trunk/tools
View as plain text  
Author: mcbrown
Date: 2006-09-20 11:35:12 +0200 (Wed, 20 Sep 2006)
New Revision: 3398

Log:
Changing the items for which we generate an ID in the ID map

Updating the genoptionstable generation to allow XREFs to be generated from a supplied option.




Modified:
   trunk/tools/genoptionstable.pl
   trunk/tools/idmap.pl


Modified: trunk/tools/genoptionstable.pl
===================================================================
--- trunk/tools/genoptionstable.pl	2006-09-19 23:32:44 UTC (rev 3397)
+++ trunk/tools/genoptionstable.pl	2006-09-20 09:35:12 UTC (rev 3398)
Changed blocks: 8, Lines Added: 118, Lines Deleted: 15; 6058 bytes

@@ -9,7 +9,21 @@
 # 2006-08-29
 
 use strict;
+use Getopt::Long;
+use Data::Dumper;
 
+my ($version,$section,$opclass,$engine,$genxref) = (undef,undef,undef,undef,undef);
+
+GetOptions("version=s" => \$version,
+           "section=s" => \$section,
+           "opclass=s" => \$opclass,
+           "engine=s" => \$engine,
+           "genxref" => \$genxref,
+           );
+
+die "You must specify the based manaul version"
+    if (!defined($version));
+
 eval "require XML::Parser::PerlSAX;";
 
 if ($@) 

@@ -43,10 +57,15 @@
 EOF
 }
 
+if (scalar @ARGV == 0)
+{
+    print <<EOF;
+genoptionstable.pl --version=# [--section=#] [--opclass=#] [--engine=#] options.xml
+EOF
+}
+
 my $file = shift or die "You must supply the name of the file to process";
 
-my $version = shift or die "You must specify the based manaul version";
-
 my $checkversion = vertodec($version);
 
 my $my_handler = MySQLDocBook->new();

@@ -70,7 +89,7 @@
 <row>
 <entry><emphasis role="bold">Name</emphasis></entry>
 <entry><emphasis role="bold">Cmd-line</emphasis></entry>
-<entry><emphasis role="bold">Conf file</emphasis></entry>
+<entry><emphasis role="bold">Option file</emphasis></entry>
 <entry><emphasis role="bold">Server Var</emphasis></entry>
 <entry><emphasis role="bold">Status Var</emphasis></entry>
 <entry><emphasis role="bold">Version</emphasis></entry>

@@ -86,6 +105,7 @@
     next unless (exists($my_handler->{tabledata}->{$id}->{manualversion}->{$version}));
     $count++;
     my $row = [];
+    my $varrow = [];
 
     push @{$row},$id;
 

@@ -116,18 +136,56 @@
         push @{$row},undef;
     }
 
-    print summaryrow($row);
 
+    if (exists($my_handler->{tabledata}->{$id}->{type}->{cmdline}->{setvar}) && 
+        $my_handler->{tabledata}->{$id}->{type}->{cmdline}->{setvar} ne $id)
+    {
+        $varrow = [];
+        push @{$varrow},@{$row};
 
-    foreach my $type (qw/cmdlin mycnf/)
+        $row->[3] = '';
+        $row->[4] = '';
+
+        print summaryrow($row,
+                         {rowsep => {0 => 0},
+                          xref => $my_handler->{tabledata}->{$id}->{xrefto},
+                      });
+
+        $varrow->[1] = '';
+        $varrow->[2] = '';
+        $varrow->[0] = sprintf(' - <emphasis>Variable</emphasis>: %s',
+                               $my_handler->{tabledata}->{$id}->{type}->{cmdline}->{setvar});
+        print summaryrow($varrow);
+    }
+    elsif (exists($my_handler->{tabledata}->{$id}->{type}->{mycnf}->{setvar}) && 
+           ($my_handler->{tabledata}->{$id}->{type}->{cmdline}->{setvar} ne $id))
     {
-        if (exists($my_handler->{tabledata}->{$id}->{type}->{$type}->{format}) &&
-            $my_handler->{tabledata}->{$id}->{type}->{$type}->{format} ne $id)
-        {
-            $row->[0] = $my_handler->{tabledata}->{$id}->{type}->{$type}->{format};
-            print summaryrow($row);
-        }
+        $varrow = [];
+        push @{$varrow},@{$row};
+
+        $row->[3] = '';
+        $row->[4] = '';
+
+        print summaryrow($row,
+                         {rowsep => {0 => 0},
+                          xref => $my_handler->{tabledata}->{$id}->{xrefto},
+                      });
+
+        $varrow->[1] = '';
+        $varrow->[2] = '';
+        $varrow->[0] = sprintf(' - <emphasis>Variable</emphasis>: %s',
+                            $my_handler->{tabledata}->{$id}->{type}->{mycnf}->{setvar});
+        print summaryrow($varrow);
     }
+    else
+    {
+        print summaryrow($row,
+                         {
+                          xref => $my_handler->{tabledata}->{$id}->{xrefto},
+                          }
+                         );
+    }
+
 }
 print "</tbody>\n</tgroup>\n</informaltable>\n";
 

@@ -135,14 +193,29 @@
 
 sub summaryrow
 {
-    my ($row) = @_;
+    my ($row,$options) = @_;
     
+    $options = {} unless defined($options);
+
     my @string = ();
 
     push(@string,"<row>");
+    my $counter = 0;
     foreach my $cell (@{$row})
     {
-        push @string,entry($cell);
+        my $attr = {};
+
+        if ($genxref && ($counter == 0) && exists($options->{xref}) && defined($options->{xref}))
+        {
+            $attr->{_xref} = $options->{xref};
+            die "Have a undefined ID, which should be impossible " . Dumper($row) unless (defined($options->{xref}));
+        }
+
+        $attr->{rowsep} = $options->{rowsep}->{$counter}
+        if (exists($options->{rowsep}->{$counter}));
+
+        push @string,entry($cell,$attr);
+        $counter++;
     }
     push(@string,"</row>");
     return join("\n",@string);

@@ -150,11 +223,36 @@
 
 sub entry
 {
-    my ($string) = @_;
+    my ($string,$attributes) = @_;
 
     if (defined($string) && $string ne '')
     {
-        return sprintf("<entry>%s</entry>",$string);
+        my $realstring = $string;
+        if (exists($attributes->{_xref}))
+        {
+            $realstring = sprintf('<link linkend="%s">%s</link>',
+                                  $attributes->{_xref},
+                                  $string);
+        }
+
+        if (scalar keys %{$attributes})
+        {
+            my @attr;
+
+            foreach my $att (keys %{$attributes})
+            {
+                next if ($att =~ m{^_});
+                push @attr,sprintf('%s="%s"',$att,$attributes->{$att});
+            }
+
+            return sprintf("<entry %s>%s</entry>",
+                           join(' ',@attr),
+                           $realstring);
+        }
+        else
+        {
+            return sprintf("<entry>%s</entry>",$realstring);
+        }
     }
     else
     {

@@ -209,6 +307,11 @@
         $self->{tabledata}->{$self->{currentid}} = {_sortbase => lc($element->{Attributes}->{id}) };
     }
 
+    if ($element->{Name} eq 'xrefto')
+    {
+        $self->{tabledata}->{$self->{currentid}}->{xrefto} = $element->{Attributes}->{id};
+    }
+
     if ($element->{Name} eq 'optype')
     {
         $self->{tabledata}->{$self->{currentid}}->{type}->{$element->{Attributes}->{class}} = {};


Modified: trunk/tools/idmap.pl
===================================================================
--- trunk/tools/idmap.pl	2006-09-19 23:32:44 UTC (rev 3397)
+++ trunk/tools/idmap.pl	2006-09-20 09:35:12 UTC (rev 3398)
Changed blocks: 1, Lines Added: 2, Lines Deleted: 0; 691 bytes

@@ -154,6 +154,8 @@
 
     if (exists($element->{Attributes}->{id}))
     {
+        return unless ($element->{Name} =~ m/appendix|book|chapter|example|para|preface|programlisting|refentry|refsection|section/i);
+
         $self->{ids}->{$element->{Attributes}->{id}} = {'type' => $element->{Name},
                                                         'sectionparent' => $self->{currsection} || '--TOP--',
                                                         'title' => undef,


Thread
svn commit - mysqldoc@docsrva: r3398 - trunk/toolsmcbrown20 Sep