Author: mcbrown
Date: 2006-09-06 11:12:42 +0200 (Wed, 06 Sep 2006)
New Revision: 3248
Log:
Fixing the ID remapping so that it copes with <link...></link> elements
Modified:
trunk/tools/idremap.pl
Modified: trunk/tools/idremap.pl
===================================================================
--- trunk/tools/idremap.pl 2006-09-06 08:51:42 UTC (rev 3247)
+++ trunk/tools/idremap.pl 2006-09-06 09:12:42 UTC (rev 3248)
Changed blocks: 2, Lines Added: 34, Lines Deleted: 6; 2062 bytes
@@ -81,14 +81,34 @@
while(<DATA>)
{
- my (@matches) = ($_ =~ m{(<xref linkend=".*?"/>)}g);
+ my (@xrefmatches) = ($_ =~ m{(<xref linkend=".*?"/>)}g);
+ my (@linkmatches) = ($_ =~ m{(<link linkend=".*?">.*?</link>)}g);
+ my (@matches);
+ push @matches,@xrefmatches,@linkmatches;
foreach my $match (@matches)
{
- $match =~ m{(<xref linkend="(.*?)"/>)};
- my $idref = $2;
- my $srcrepl = $1;
+ my ($idref,$type,$srcrepl,$content);
+
+ if ($match =~ m{(<xref linkend="(.*?)"/>)})
+ {
+ $srcrepl = $1;
+ $idref = $2;
+ $type = 'xref';
+ }
+ elsif ($match =~ m{(<link linkend="(.*?)">(.*?)</link>)})
+ {
+ $srcrepl = $1;
+ $idref = $2;
+ $type = 'xref';
+ $content = $3;
+ }
my $title = '';
+ if (!exists($idmap->{$idref}))
+ {
+ print STDERR "Error: Cannot find reference for id=\"$idref\"\n";
+ next;
+ }
if (exists($missing->{$idref}))
{
# print STDERR Dumper($idmap->{$idref}),"\n";
@@ -111,8 +131,16 @@
$url = sprintf('%s%s/%s.html#%s',$urlcore,$idmap->{$idref}->{parent},$idmap->{$idref}->{urlbase},$idref);
$title = $idmap->{$idmap->{$idref}->{parent}}->{title} || $idref;
}
- my $destrepl = sprintf('<ulink url="%s">%s</ulink>',$url,$title);
- $_ =~ s/$srcrepl/$destrepl/;
+ my $destrepl = '';
+ if ($type eq 'xref')
+ {
+ $destrepl = sprintf('<ulink url="%s">%s</ulink>',$url,$title);
+ }
+ elsif ($type eq 'link')
+ {
+ $destrepl = sprintf('<ulink url="%s">%s</ulink>',$url,$content);
+ }
+ $_ =~ s/$match/$destrepl/;
}
}
print;
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r3248 - trunk/tools | mcbrown | 6 Sep |