List:Commits« Previous MessageNext Message »
From:mcbrown Date:November 16 2007 5:38pm
Subject:svn commit - mysqldoc@docsrva: r8772 - in trunk/tools: . MySQL MySQL/IDMap
View as plain text  
Author: mcbrown
Date: 2007-11-16 17:38:02 +0100 (Fri, 16 Nov 2007)
New Revision: 8772

Log:
Updating the IDMapping system

 - Correcting the gengeration of maps on refsection elements
 - We now ignore fake IDs in terms of depth
 - We correctly use the correspnding refentrytitle for refentry blocks



Modified:
   trunk/tools/MySQL/IDMap.pm
   trunk/tools/MySQL/IDMap/XMLParser.pm
   trunk/tools/idmap.pl


Modified: trunk/tools/MySQL/IDMap/XMLParser.pm
===================================================================
--- trunk/tools/MySQL/IDMap/XMLParser.pm	2007-11-16 15:53:49 UTC (rev 8771)
+++ trunk/tools/MySQL/IDMap/XMLParser.pm	2007-11-16 16:38:02 UTC (rev 8772)
Changed blocks: 2, Lines Added: 33, Lines Deleted: 25; 3675 bytes

@@ -147,40 +147,49 @@
                 $self->{rootid} = $element->{Attributes}->{id};
             }
 
-            $self->{ids}->{$element->{Attributes}->{id}} = {
-                'type' => $element->{Name},
-                'sectionparent' => $self->{currsection} || 
-                    $element->{Attributes}->{id} || '--TOP--',
-                    'title' => undef,
-            };
-
-            if ($element->{Name} eq 'section' ||
-                $element->{Name} eq 'refsection' ||
-                $element->{Name} eq 'refentry' ||
-                $element->{Name} eq 'chapter'
-                )
+            if ($element->{Attributes}->{id} !~ m/^fake-id-/)
             {
-                push(@{$self->{sectionmap}},$element->{Attributes}->{id});
-                $self->{currsection} = $element->{Attributes}->{id};
-                if
(exists($self->{sectionids}->{$element->{Attributes}->{id}}))
+                $self->{ids}->{$element->{Attributes}->{id}} = {
+                    'type' => $element->{Name},
+                    'sectionparent' => $self->{currsection} || 
+                        $element->{Attributes}->{id} || '--TOP--',
+                        'title' => undef,
+                };
+                
+                if ($element->{Name} eq 'section' ||
+                    $element->{Name} eq 'refentry' ||
+                    $element->{Name} eq 'refsection' ||
+                    $element->{Name} eq 'chapter'
+                    )
                 {
-                    print STDERR "Error: Found a duplicate section ID
($element->{Attributes}->{id})\n";
+                    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";
+                    }
+                    else
+                    {
+                        $self->{sectionids}->{$element->{Attributes}->{id}} =
0;
+                    }
+                    $self->{sectionids}->{$element->{Attributes}->{id}}++;
                 }
-                else
-                {
-                    $self->{sectionids}->{$element->{Attributes}->{id}} = 0;
-                }
-                $self->{sectionids}->{$element->{Attributes}->{id}}++;
+                $self->{currid} = $element->{Attributes}->{id};
             }
-            $self->{currid} = $element->{Attributes}->{id};
         }
     }
     if ($self->{captext})
     {
         $self->{currtext} .= sprintf('<%s>',$element->{Name});
     }
-    if ($element->{Name} eq 'title' ||
-        $element->{Name} eq 'refentrytitle') 
+
+    if ((($element->{Name} eq 'title') &&
+         (defined($self->{ids}->{$self->{currid}}->{type})) &&
+         ($self->{ids}->{$self->{currid}}->{type} ne 'refentry')) ||
+        (($element->{Name} eq 'refentrytitle') &&
+         (defined($self->{ids}->{$self->{currid}}->{type})) &&
+         ($self->{ids}->{$self->{currid}}->{type} eq 'refentry'))
+        )
     {
         $self->{captext} = 1;
         $self->{currtext} = '';

@@ -192,7 +201,6 @@
     my ($self, $element) = @_;
 
     if ($element->{Name} eq 'section' ||
-        $element->{Name} eq 'refsection' ||
         $element->{Name} eq 'refentry' ||
         $element->{Name} eq 'chapter' )
     {


Modified: trunk/tools/MySQL/IDMap.pm
===================================================================
--- trunk/tools/MySQL/IDMap.pm	2007-11-16 15:53:49 UTC (rev 8771)
+++ trunk/tools/MySQL/IDMap.pm	2007-11-16 16:38:02 UTC (rev 8772)
Changed blocks: 2, Lines Added: 5, Lines Deleted: 2; 941 bytes

@@ -31,7 +31,10 @@
     my $opts = shift;
     my $object = {};
 
-    my $maptypes = [qw/root idmap ridmap image xmlimport dynimport entityfile indexterm
command option function/];
+    my $maptypes = [qw/root idmap ridmap image xmlimport dynimport 
+                       entityfile indexterm command option function
+                       syntax
+                      /];
 
     my ($forward,$reverse) = ({},{});
 

@@ -518,7 +521,7 @@
 		    $self->{_opts}->{parseindexterm}
 		    );
 
-	    foreach my $term (qw/command option function/)
+	    foreach my $term (qw/command option function syntax/)
 	    {
 		$self->parseline_term($prefix,$restofline,$term) 
 		    if ($self->{_types}->{forward}->{$idtype} eq $term && 


Modified: trunk/tools/idmap.pl
===================================================================
--- trunk/tools/idmap.pl	2007-11-16 15:53:49 UTC (rev 8771)
+++ trunk/tools/idmap.pl	2007-11-16 16:38:02 UTC (rev 8772)
Changed blocks: 4, Lines Added: 38, Lines Deleted: 3; 2697 bytes

@@ -142,9 +142,13 @@
     {
         if (!defined($id) || $id eq '')
         {
-            printf STDERR ("WARNING: Can't make a valid ID $dest on %s when the ID for
'%s' is not specified\n",
-                           $file, 
-                           $my_handler->{ids}->{$id}->{title});
+            if (!defined($my_handler->{ids}->{$id}->{title}) ||
+                 $my_handler->{ids}->{$id}->{title} =~ m/[a-z]/i)
+            {
+                printf STDERR ("WARNING: Can't make a valid ID on %s when the ID for '%s'
is not specified\n",
+                               $file, 
+                               $my_handler->{ids}->{$id}->{title});
+            }
         }
         else
         {

@@ -260,10 +264,12 @@
         my $dynxml = MySQL::DynXML->new();
         my $OptVars = new MySQL::DynXML::Optvar($dynxml,$options);
         my $OpFuncs = new MySQL::DynXML::Opfuncs($dynxml,$options);
+        my $ResWords = new MySQL::DynXML::ReservedWords($dynxml,$options);
 
         my ($optionmap,$opfuncmap);
         map { $optionmap->{$_} = 1 } $OptVars->generate_dictwords($options);
         map { $opfuncmap->{$_} = 1 } $OpFuncs->generate_dictwords($options);
+        my @reswords = $ResWords->generate_dictwords($options);
 
         foreach my $literal (keys %{$my_handler->{literals}})
         {

@@ -283,6 +289,17 @@
                     $my_handler->{functions}->{$literal}->{$parent} = 1;
                 }
             }
+            foreach my $word (@reswords)
+            {
+                if ($literal =~ m/$word/ &&
+                    $literal =~ m/^[A-Z \._]+$/)
+                {
+                    foreach my $parent (keys
%{$my_handler->{literals}->{$literal}})
+                    {
+                        $my_handler->{syntax}->{$literal}->{$parent} = 1;
+                    }
+                }
+            }
         }
     }
 

@@ -340,6 +357,24 @@
         }
     }
 
+    if (scalar keys %{$my_handler->{syntax}})
+    {
+        # Write out the entity imports
+
+        foreach my $syntax (keys %{$my_handler->{syntax}})
+        {
+            foreach my $parent (keys %{$my_handler->{syntax}->{$syntax}})
+            {
+                print $dest (join(':',
+                                  $idmap->{_types}->{reverse}->{syntax},
+                                  $syntax || '',
+                                  $parent || '',
+                             ),
+                             "\n");
+            }
+        }
+    }
+
     close($dest);
     
     unlink($mapfile);


Thread
svn commit - mysqldoc@docsrva: r8772 - in trunk/tools: . MySQL MySQL/IDMapmcbrown16 Nov