List:Commits« Previous MessageNext Message »
From:mcbrown Date:November 22 2007 7:09pm
Subject:svn commit - mysqldoc@docsrva: r8834 - in trunk: make.d tools
View as plain text  
Author: mcbrown
Date: 2007-11-22 20:09:07 +0100 (Thu, 22 Nov 2007)
New Revision: 8834

Log:
Adding experimental TOC toggles



Added:
   trunk/tools/add-toc-toggle.pl
Modified:
   trunk/make.d/xml-html-web

Property changes on: trunk/tools/add-toc-toggle.pl
___________________________________________________________________
Name: svn:executable
   + *


Modified: trunk/make.d/xml-html-web
===================================================================
--- trunk/make.d/xml-html-web	2007-11-22 17:52:34 UTC (rev 8833)
+++ trunk/make.d/xml-html-web	2007-11-22 19:09:07 UTC (rev 8834)
Changed blocks: 2, Lines Added: 2, Lines Deleted: 1; 740 bytes

@@ -28,6 +28,7 @@
 		$(MYSQL_HTML_WEB_XSL) \
 		$<
 	$(ADD_INDEX_NAVLINKS) $@-tmp/*.html
+	$(REPO_ROOT)/tools/add-toc-toggle.pl $@-tmp/*.html
 	set -e; \
 	IMAGE_FILES="$(call target_images,$*)"; \
 	if [ "x$$IMAGE_FILES" != "x" ]; then \

@@ -37,7 +38,7 @@
 	fi
 	cat $@-tmp/*.html | openssl dgst -md5 > $@-tmp/checksum.txt
 	set -e; \
-	if [ -f renamed-nodes.txt ]; then \
+	if [ -f renamed-nodes.txtf ]; then \
 		if [ x"$(DOC_URL_BASE)" = "x" ]; then \
 			echo DOC_URL_BASE must be defined in the Makefile; \
 			exit 1; \


Added: trunk/tools/add-toc-toggle.pl
===================================================================
--- trunk/tools/add-toc-toggle.pl	                        (rev 0)
+++ trunk/tools/add-toc-toggle.pl	2007-11-22 19:09:07 UTC (rev 8834)
Changed blocks: 1, Lines Added: 36, Lines Deleted: 0; 1577 bytes

@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use IO::File;
+
+
+foreach my $file (@ARGV)
+{
+    my $fh = IO::File->new($file) or die "Couldn't open $file: $!\n";
+    binmode($fh,':utf8');
+    my $filetext = join('',<$fh>);
+    $fh->close();
+
+    my $counter = 0;
+
+    $filetext =~ s{<p><b>Table of Contents</b></p>.*<dl>}{<p><b>Table of Contents</b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<small>[<a href="#" onclick="toggle('tocdetail');">Toggle</a>]</small></p><dl id="tocdetail">}msg;
+
+    $filetext =~ s{<div class="toc"><dl>}{<div class="toc"><p><small>[<a href="#" onclick="toggle('tocdetail-$counter');">Toggle Contents</a>]</small></p><dl id="tocdetail-$counter">}msg;
+
+    $counter++;
+
+    my @matches = ($filetext =~ m{(</a></span></dt>.*?<dl>)});
+    foreach my $match (@matches)
+    {
+        my $repltext = sprintf("&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<small>[<a href=\"#\" onclick=\"toggle('tocdetail-%d');\">Toggle</a>]</small><dl id=\"tocdetail-%d\">",$counter,$counter);
+
+        $filetext =~ s{$match}{$repltext}msg;
+        $counter++;
+    }
+
+    $fh = IO::File->new($file,'w') or die "Couldn't open $file: $!\n";
+    binmode($fh,':utf8');
+    print $fh $filetext;
+    $fh->close();
+}


Property changes on: trunk/tools/add-toc-toggle.pl
___________________________________________________________________
Name: svn:executable
   + *


Thread
svn commit - mysqldoc@docsrva: r8834 - in trunk: make.d toolsmcbrown22 Nov