From: Date: November 23 2007 10:24am Subject: svn commit - mysqldoc@docsrva: r8844 - trunk/tools List-Archive: http://lists.mysql.com/commits/38334 Message-Id: <200711230924.lAN9Oa1Q014683@docsrva.mysql.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Author: mcbrown Date: 2007-11-23 10:24:36 +0100 (Fri, 23 Nov 2007) New Revision: 8844 Log: Swapping the toggle for the entire TOC so that it collapses to the top-level header only Changing the # link so that we don't move to the top of the page Modified: trunk/tools/add-toc-toggle.pl Modified: trunk/tools/add-toc-toggle.pl =================================================================== --- trunk/tools/add-toc-toggle.pl 2007-11-23 03:17:42 UTC (rev 8843) +++ trunk/tools/add-toc-toggle.pl 2007-11-23 09:24:36 UTC (rev 8844) Changed blocks: 1, Lines Added: 8, Lines Deleted: 5; 1987 bytes @@ -14,24 +14,27 @@ my $counter = 0; - $filetext =~ s{

Table of Contents

.*?
}{

Table of Contents     [Toggle]

}msg; + $filetext =~ s{
}{

[Toggle Contents]

}msg; - $filetext =~ s{
}{

[Toggle Contents]

}msg; - $counter++; my @matches = ($filetext =~ m{(\s+
)}msg); - print join("\n",@matches); + my @toccollapse; foreach my $match (@matches) { - my $repltext = sprintf("     [Toggle]
",$counter,$counter); + my $repltext = sprintf("     [Toggle]
",$counter,$counter); $filetext =~ s{$match}{$repltext}ms; + push @toccollapse,sprintf("toggle('tocdetail-%s');",$counter); $counter++; } + my $togglelist = join('',@toccollapse); + + $filetext =~ s{

Table of Contents

.*?
}{

Table of Contents     [Toggle]

}msg; + $fh = IO::File->new($file,'w') or die "Couldn't open $file: $!\n"; binmode($fh,':utf8'); print $fh $filetext;