List:Commits« Previous MessageNext Message »
From:mcbrown Date:March 30 2007 1:55pm
Subject:svn commit - mysqldoc@docsrva: r5658 - trunk/tools
View as plain text  
Author: mcbrown
Date: 2007-03-30 15:55:26 +0200 (Fri, 30 Mar 2007)
New Revision: 5658

Log:
Adding version summary table output option



Modified:
   trunk/tools/dyndocs-optvars-generate.pl


Modified: trunk/tools/dyndocs-optvars-generate.pl
===================================================================
--- trunk/tools/dyndocs-optvars-generate.pl	2007-03-30 09:12:13 UTC (rev 5657)
+++ trunk/tools/dyndocs-optvars-generate.pl	2007-03-30 13:55:26 UTC (rev 5658)
Changed blocks: 6, Lines Added: 208, Lines Deleted: 1; 7596 bytes

@@ -8,8 +8,10 @@
 # 2006-08-29
 
 use strict;
+use lib '../tools';
 use Getopt::Long;
 use Data::Dumper;
+use IDMap;
 
 my ($opt_version,$opt_command,$opt_section,
     $opt_subsection,$opt_genxref,$opt_genclassification) = 

@@ -44,6 +46,7 @@
     
     show_help("ERROR: You must specify the output filename for a $opt_tabletype table")
         if ((($opt_tabletype eq 'fullsummary') ||
+             ($opt_tabletype eq 'versionsummary') ||
              ($opt_tabletype eq 'varsummary')) &&
             (!defined($opt_outfile)));
     

@@ -117,10 +120,14 @@
 
     exit(0);
 }
-
 foreach my $id (sort { $td->{$a}->{'_sortbase'} cmp 
                            $td->{$b}->{'_sortbase'} } keys %{$td})
 {
+    if ($opt_tabletype eq 'versionsummary')
+    {
+        push @{$idlist},$id;
+        next;
+    }
     next unless (exists($td->{$id}->{manualversion}->{$options->{version}}));
     next unless (exists($td->{$id}->{classification}->{command}) &&
                  ($td->{$id}->{classification}->{command} eq $options->{command}));

@@ -146,6 +153,12 @@
                                 $idlist,
                                 $options);
 }
+elsif ($opt_tabletype eq 'versionsummary')
+{
+    generate_version_summary_table($my_handler->{tabledata},
+                                   $idlist,
+                                   $options);
+}
 elsif ($opt_tabletype eq 'itemsummary')
 {
     

@@ -239,6 +252,11 @@
 
 sub xml_entry
 {
+    if ((scalar @_ == 0) || 
+        (!defined($_[0])))
+    {
+        return '<entry/>';
+    }
     return sprintf('<entry>%s</entry>',join('',@_));
 }
 

@@ -722,6 +740,195 @@
     print STDERR "Written out $count entries from ",scalar keys %{$td}," definitions\n";
 }
 
+sub generate_version_summary_table
+{
+    my ($td,$idlist,$options) = @_;
+
+    my $idmap41 = IDMap->new({sources => ['../refman-4.1']});
+    my $idmap50 = IDMap->new({sources => ['../refman-5.0']});
+    my $idmap51 = IDMap->new({sources => ['../refman-5.1']});
+
+    print Dumper($idmap41),"\n";
+
+    open(OUTPUT,">$options->{outfile}") or die "Couldn't open $options->{outfile} ($!)\n";
+
+    print OUTPUT <<EOF;
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE table PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+"http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd"
+>
+        <!--
+        ****WARNING*****
+        
+        This file is automatically generated during the build process. 
+        
+        DO NOT check this file into the repository. 
+        
+        If there are problems with this file, please report the problem to mc\@mysql.com.
+        
+        ****************
+        -->
+
+<table>
+<title>Option/Variable Reference</title>
+<tgroup cols="12">
+<colspec colwidth="10*"/>
+<colspec colwidth="8*"/>
+<colspec colwidth="8*"/>
+<colspec colwidth="8*"/>
+<colspec colwidth="8*"/>
+<colspec colwidth="8*"/>
+<colspec colwidth="8*"/>
+<colspec colwidth="8*"/>
+<colspec colwidth="8*"/>
+<colspec colwidth="8*"/>
+<colspec colwidth="8*"/>
+<colspec colwidth="8*"/>
+<thead>
+<row>
+<entry><emphasis role="bold">Name</emphasis></entry>
+<entry><emphasis role="bold">In.</emphasis></entry>
+<entry><emphasis role="bold">Dep.</emphasis></entry>
+<entry><emphasis role="bold">Cmd</emphasis></entry>
+<entry><emphasis role="bold">File</emphasis></entry>
+<entry><emphasis role="bold">Server</emphasis></entry>
+<entry><emphasis role="bold">Status</emphasis></entry>
+<entry><emphasis role="bold">Scope</emphasis></entry>
+<entry><emphasis role="bold">Dynamic</emphasis></entry>
+<entry><emphasis role="bold">4.1</emphasis></entry>
+<entry><emphasis role="bold">5.0</emphasis></entry>
+<entry><emphasis role="bold">5.1</emphasis></entry>
+</row>
+</thead>
+<tbody>
+EOF
+
+    my $count = 0;
+
+    foreach my $id (@{$idlist})
+    {
+        $count++;
+        my $row = [];
+        
+        push @{$row},xml_entry(xml_literal($id));
+
+        if (exists($td->{$id}->{introduced}))
+        {
+            push @{$row},xml_entry($td->{$id}->{introduced}->{real});
+        }
+        else
+        {
+            push @{$row},xml_entry('');
+        }
+
+        if (exists($td->{$id}->{deprecated}))
+        {
+            push @{$row},xml_entry($td->{$id}->{deprecated}->{version});
+        }
+        else
+        {
+            push @{$row},xml_entry('');
+        }
+        
+        foreach my $type (qw/cmdline mycnf servervar statusvar/)
+        {
+            if (exists($td->{$id}->{type}->{$type}))
+            {
+                push @{$row},xml_entry('Y');
+            }
+            else
+            {
+                push @{$row},xml_entry('');
+            }
+        }
+        
+        if (exists($td->{$id}->{scope}))
+        {
+            push @{$row},xml_entry($td->{$id}->{scope});
+        }
+        else
+        {
+            push @{$row},xml_entry('');
+        }
+
+        if (exists($td->{$id}->{isdynamic}))
+        {
+            push @{$row},xml_entry($td->{$id}->{isdynamic});
+        }
+        else
+        {
+            push @{$row},xml_entry('');
+        }
+
+        foreach my $ver (qw/4.1 5.0 5.1/)
+        {
+            if (exists($td->{$id}->{manualversion}->{$ver}))
+            {
+                if (exists($td->{$id}->{xrefto}) &&
+                    defined($td->{$id}->{xrefto}))
+                {
+                    my $linkloc = undef;
+                    if (($ver eq '4.1') &&
+                        exists($idmap41->{$td->{$id}->{xrefto}}))
+                    {
+                        $linkloc = generate_html_xref($idmap41,$td->{$id}->{xrefto});
+                    }
+                    if (($ver eq '5.0') &&
+                        exists($idmap50->{$td->{$id}->{xrefto}}))
+                    {
+                        $linkloc = generate_html_xref($idmap50,$td->{$id}->{xrefto});
+                    }
+                    if (($ver eq '5.1') &&
+                        exists($idmap51->{$td->{$id}->{xrefto}}))
+                    {
+                        $linkloc = generate_html_xref($idmap51,$td->{$id}->{xrefto});
+                    }
+                    if (defined($linkloc))
+                    {
+                        push @{$row},xml_entry(sprintf('<ulink url="%s">%s</ulink>',
+                                                       $linkloc,
+                                                       'Yes'));
+                    }
+                    else
+                    {
+                        push @{$row},xml_entry('Yes');
+                    }
+                }
+                else
+                {
+                    push @{$row},xml_entry('Yes');
+                }
+            }
+            else
+            {
+                push @{$row},xml_entry('');
+            }
+        }
+        print OUTPUT xml_row(@{$row});
+    }
+    print OUTPUT "</tbody>\n</tgroup>\n</table>\n";
+    close(OUTPUT);
+    print STDERR "Written out $count entries from ",scalar keys %{$td}," definitions\n";
+}
+
+sub generate_html_xref
+{
+    my ($idmap,$idref) = @_;
+
+    my $urlcore = 'http://dev.mysql.com/doc/';
+    my $url;
+
+    if ($idmap->{$idref}->{type} =~ m/^(appendix|article|book|part|chapter|example|glossary|preface|refentry|refsection|section)$/i)
+    {
+        $url = sprintf('%s%s/%s.html',$urlcore,$idmap->{$idref}->{urlbase},$idref);
+    }
+    else
+    {
+        $url = sprintf('%s%s/%s.html#%s',$urlcore,$idmap->{$idref}->{parent},$idmap->{$idref}->{urlbase},$idref);
+    }
+    return($url);
+}
+
 sub summaryrow
 {
     my ($row,$options) = @_;


Thread
svn commit - mysqldoc@docsrva: r5658 - trunk/toolsmcbrown30 Mar