List:Commits« Previous MessageNext Message »
From:martin.brown Date:September 8 2008 5:06pm
Subject:svn commit - mysqldoc@docsrva: r11729 - in trunk/tools: . MySQL
View as plain text  
Author: mcbrown
Date: 2008-09-08 19:06:57 +0200 (Mon, 08 Sep 2008)
New Revision: 11729

Log:
Fixing ID mapping forward and reverse links, which weren't being loaded correctly from the already existing ID maps
Adding support for showing forward and reverse links in idfind



Modified:
   trunk/tools/MySQL/IDMap.pm
   trunk/tools/idfind.pl


Modified: trunk/tools/MySQL/IDMap.pm
===================================================================
--- trunk/tools/MySQL/IDMap.pm	2008-09-08 14:01:44 UTC (rev 11728)
+++ trunk/tools/MySQL/IDMap.pm	2008-09-08 17:06:57 UTC (rev 11729)
Changed blocks: 2, Lines Added: 3, Lines Deleted: 2; 811 bytes

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

@@ -596,7 +596,8 @@
     my ($self,$prefix,$line) = @_;
 
     my ($parent,$id) = split(/:/,$line);
-    $self->{reversebyid}->{$id}->{$prefix}->{$parent} = 1;
+    $self->{idlinkedto}->{$parent}->{$prefix}->{$id} = 1;
+    $self->{idlinkedfrom}->{$id}->{$prefix}->{$parent} = 1;
 }
 
 sub parseline_image


Modified: trunk/tools/idfind.pl
===================================================================
--- trunk/tools/idfind.pl	2008-09-08 14:01:44 UTC (rev 11728)
+++ trunk/tools/idfind.pl	2008-09-08 17:06:57 UTC (rev 11729)
Changed blocks: 4, Lines Added: 36, Lines Deleted: 8; 3277 bytes

@@ -23,16 +23,20 @@
 use Getopt::Long;
 use Data::Dumper;
 
-my ($srcpathopt,$debug,$showreverse,$showtitle,$showlevel,$showtype,$optformat) = ('',0,0,0,0,'','');
+my ($srcpathopt,$debug,$showlinkedto,$showlinkedfrom,
+    $showtitle,$showlevel,$showtype,$optformat,$optprefix) = ('',0,0,0,0,0,'','',undef);
 my @srcpaths = ();
 
 GetOptions("srcpaths=s" => \$srcpathopt,
            "debug" => \$debug,
-           "r" => \$showreverse,
+           "showlinkedto" => \$showlinkedto,
+           "showlinkedfrom" => \$showlinkedfrom,
            "title" => \$showtitle,
            "type=s" => \$showtype,
            "level=i" => \$showlevel,
-           "format=s" => \$optformat);
+           "format=s" => \$optformat,
+           "prefix=s" => \$optprefix,
+           );
 
 if ((scalar @ARGV == 0) && ($showlevel == 0) && ($showtype eq ''))
 {

@@ -78,6 +82,8 @@
 
 my $idmap = MySQL::IDMap->new({sources => $srcpathopt});
 
+#print STDERR Dumper($idmap),"\n";
+
 my ($id);
 
 if ($showlevel > 0)

@@ -138,9 +144,22 @@
         {
             next if ($match =~ m/__.*?__/);
 
+            if (defined($optprefix))
+            {
+                next unless (exists($idmap->{byprefixid}->{$optprefix}->{$match}));
+            }
+
             if ($showtitle)
             {
-                print "$idmap->{byid}->{$match}->{title} [$match] is located within $idmap->{byid}->{$match}->{prefix}/$idmap->{byid}->{$match}->{file}\n";
+                if ($optformat eq 'xml')
+                {
+                    print(sprintf('<link linkend="%s">%s</link>',$match,$idmap->{byid}->{$match}->{title}),
+                          "\n");
+                }
+                else
+                {
+                    print "$idmap->{byid}->{$match}->{title} [$match] is located within $idmap->{byid}->{$match}->{prefix}/$idmap->{byid}->{$match}->{file}\n";
+                }
             }
             else
             {

@@ -168,13 +187,22 @@
                     }                        
                 }
             }
-            if ($showreverse && 
-                exists($idmap->{reversebyid}->{$match}))
+            if ($showlinkedto && 
+                exists($idmap->{idlinkedto}->{$match}))
             {
-                foreach my $prefix (keys %{$idmap->{reversebyid}->{$match}})
+                foreach my $prefix (keys %{$idmap->{idlinkedto}->{$match}})
                 {
+                    print("  -> and links to these sections ($prefix) ",
+                          join(', ',keys %{$idmap->{idlinkedto}->{$match}->{$prefix}}),"\n");
+                }
+            }
+            if ($showlinkedfrom && 
+                exists($idmap->{idlinkedfrom}->{$match}))
+            {
+                foreach my $prefix (keys %{$idmap->{idlinkedfrom}->{$match}})
+                {
                     print("  -> and is referenced within these sections ($prefix) ",
-                          join(', ',keys %{$idmap->{reversebyid}->{$match}->{$prefix}}),"\n");
+                          join(', ',keys %{$idmap->{idlinkedfrom}->{$match}->{$prefix}}),"\n");
                 }
             }
         }


Thread
svn commit - mysqldoc@docsrva: r11729 - in trunk/tools: . MySQLmartin.brown8 Sep