List:Commits« Previous MessageNext Message »
From:mcbrown Date:September 6 2006 10:15am
Subject:svn commit - mysqldoc@docsrva: r3250 - trunk/tools
View as plain text  
Author: mcbrown
Date: 2006-09-06 12:15:22 +0200 (Wed, 06 Sep 2006)
New Revision: 3250

Log:
Reworked tool so that it correctly manages the remapping of multi-line elements (particularly affects <link...>)



Modified:
   trunk/tools/idremap.pl


Modified: trunk/tools/idremap.pl
===================================================================
--- trunk/tools/idremap.pl	2006-09-06 10:04:30 UTC (rev 3249)
+++ trunk/tools/idremap.pl	2006-09-06 10:15:22 UTC (rev 3250)
Changed blocks: 4, Lines Added: 10, Lines Deleted: 8; 1591 bytes

@@ -79,10 +79,14 @@
 
 open(DATA,$file);
 
-while(<DATA>)
+my $filesrc = join('',<DATA>);
+
+close(DATA);
+
+if($filesrc =~ m{<(xref|link) linkend})
 {
-    my (@xrefmatches) = ($_ =~ m{(<xref linkend=".*?"/>)}g);
-    my (@linkmatches) = ($_ =~ m{(<link linkend=".*?">.*?</link>)}g);
+    my (@xrefmatches) = ($filesrc =~ m{(<xref linkend=".*?"/>)}g);
+    my (@linkmatches) = ($filesrc =~ m{(<link linkend=".*?">.*?</link>)}msg);
     my (@matches);
     push @matches,@xrefmatches,@linkmatches;
 

@@ -96,7 +100,7 @@
             $idref = $2;
             $type = 'xref';
         }
-        elsif ($match =~ m{(<link linkend="(.*?)">(.*?)</link>)})
+        elsif ($match =~ m{(<link linkend="(.*?)">(.*?)</link>)}ms)
         {
             $srcrepl = $1;
             $idref = $2;

@@ -111,8 +115,6 @@
         }
         if (exists($missing->{$idref}))
         {
-#            print STDERR Dumper($idmap->{$idref}),"\n";
-            
             if ($idmap->{$idref}->{type} eq 'section' || 
                 $idmap->{$idref}->{type} eq 'appendix' || 
                 $idmap->{$idref}->{type} eq 'refentry' || 

@@ -140,11 +142,11 @@
             {
                 $destrepl = sprintf('<ulink url="%s">%s</ulink>',$url,$content);
             }
-            $_ =~ s/$match/$destrepl/;
+            $filesrc =~ s/$match/$destrepl/msg;
         }
     }
-    print;
 }
+print $filesrc;
 
 package MySQLDocBook;
 


Thread
svn commit - mysqldoc@docsrva: r3250 - trunk/toolsmcbrown6 Sep