diff options
Diffstat (limited to 'Docs/Support')
-rwxr-xr-x | Docs/Support/colspec-fix.pl | 46 | ||||
-rwxr-xr-x | Docs/Support/docbook-fixup.pl | 45 | ||||
-rwxr-xr-x | Docs/Support/docbook-prefix.pl | 50 | ||||
-rwxr-xr-x | Docs/Support/make-docbook | 9 | ||||
-rw-r--r-- | Docs/Support/trivial-makeinfo-4.0c.patch | 11 | ||||
-rwxr-xr-x | Docs/Support/update-reserved-words.pl | 28 |
6 files changed, 160 insertions, 29 deletions
diff --git a/Docs/Support/colspec-fix.pl b/Docs/Support/colspec-fix.pl index 64269fdbe3a..6c64edd1441 100755 --- a/Docs/Support/colspec-fix.pl +++ b/Docs/Support/colspec-fix.pl @@ -8,10 +8,10 @@ use strict; -my $table_width = 12.75; # cm -my $gutter_width = 0.09; # cm +my $table_width = 12.75; # Specify the max width of the table in cm +my $gutter_width = 0.55; # Specify the width of the gutters in cm -my $str = join '', <>; +my $str = join '', <>; # Push stdin (or file) $str =~ s{([\t ]*(<colspec colwidth=\".+?\" />\s*)+)} {&rel2abs($1)}ges; @@ -28,12 +28,17 @@ sub msg { } sub rel2abs { - my $str = shift; - my $colnum = 1; + my $str = shift; + my $colnum = 1; - my @widths = (); - my $total = 0; - my $output = ''; + my @widths = (); + my $total = 0; + my $output = ''; + + my $gutters; + my $content_width; + my $total_width; + my @num_cache; $str =~ /^(\s+)/; my $ws = $1; @@ -43,12 +48,31 @@ sub rel2abs { push @widths, $1; } - my $unit = ($table_width - ($#widths * $gutter_width)) / ($total); + msg("!!! WARNING: Total Percent > 100%: $total%") if $total > 100; + + if (! $total) { + die 'Something bad has happened - the script believes that there are no columns'; + } + + $gutters = $#widths * $gutter_width; + $content_width = $table_width - $gutters; + # Don't forget that $#... is the last offset not the count foreach (@widths) { - $output .= $ws . '<colspec colnum="'. $colnum .'" colwidth="'. sprintf ("%0.2f", $_ * $unit) .'cm" />' . "\n"; + my $temp = sprintf ("%0.2f", $_/100 * $content_width); + $total_width += $temp; + + if ($total_width > $content_width) { + $temp -= $total_width - $content_width; + msg("!!! WARNING: Column width reduced from " . + ($temp + ($total_width - $content_width)) . " to $temp !!!"); + $total_width -= $total_width - $content_width; + } + + $output .= $ws . '<colspec colnum="'. $colnum .'" colwidth="'. $temp .'cm" />' . "\n"; ++$colnum; + push @num_cache, $temp; } - + return $output . "\n$ws"; } diff --git a/Docs/Support/docbook-fixup.pl b/Docs/Support/docbook-fixup.pl index ba2e9b3779d..f9934822f40 100755 --- a/Docs/Support/docbook-fixup.pl +++ b/Docs/Support/docbook-fixup.pl @@ -3,7 +3,7 @@ # Fix the output of `makeinfo --docbook` version 4.0c # Convert the broken docbook output to well-formed XML that conforms to the O'Reilly idiom # See code for detailed comments -# Authors: Arjen Lentz and Zak Greant +# Authors: Arjen Lentz and Zak Greant (original code by Jeremy Cole) use strict; @@ -13,7 +13,7 @@ my $apx = ''; my @nodes = (); my $nodes = ''; -msg ("\n-- Post-processing `makeinfo --docbook` output --"); +msg ("-- Post-processing `makeinfo --docbook` output --"); msg ("** Written to work with makeinfo version 4.0c **\n"); msg ("Discarding DTD - not required by subsequent scripts"); @@ -31,6 +31,26 @@ msg ("Add missing <bookinfo> and <abstract> opening tags"); # ...as soon as we find the first instance, we can stop looking. $data =~ s/<book lang="en">/<book lang="en"><bookinfo><abstract>/; + +# arjen 2002-05-01 +msg ("Processing docbook-prefix special strings"); +$data =~ s/FIXUPmdashFIXUP/\&mdash\;/g; + +$data =~ s/FIXUPdoubledashFIXUP/--/g; + +$data =~ s/FIXUPstrongFIXUP/<emphasis\ role\=bold>/g; +$data =~ s/FIXUPendstrongFIXUP/<\/emphasis>/g; + +$data =~ s/FIXUPemphFIXUP/<emphasis>/g; +$data =~ s/FIXUPendemphFIXUP/<\/emphasis>/g; + +$data =~ s/FIXUPfileFIXUP/<filename>/g; +$data =~ s/FIXUPendfileFIXUP/<\/filename>/g; + +$data =~ s/FIXUPsampFIXUP/<literal>/g; +$data =~ s/FIXUPendsampFIXUP/<\/literal>/g; + + msg ("Removing mailto: from email addresses..."); $data =~ s/mailto://g; @@ -38,9 +58,19 @@ msg ("Removing INFORMALFIGURE..."); $data =~ s{<informalfigure>.+?</informalfigure>} {}gs; -msg ("Convert ampersands to XML escape sequences "); +msg ("Convert ampersand to XML escape sequence..."); $data =~ s/&(?!\w+;)/&/g; - + +# arjen 2002-05-01 +msg ("Changing (TM) to XML escape sequence..."); +$data =~ s/MySQL \(TM\)/MySQL™/g; +$data =~ s{<command>TM</command>} + {™}g; + +# arjen 2002-05-01 +msg ("Changing ' -- ' to XML escape sequence..."); +$data =~ s/ -- /—/g; + msg ("Changing @@ to @..."); $data =~ s/@@/@/g; @@ -68,6 +98,11 @@ msg ("Adding closing / to XREF and COLSPEC tags..."); $data =~ s{<(xref|colspec) (.+?)>} {<$1 $2 />}gs; +# arjen 2002-04-26 +msg ("Removing separate target titles from LINKs and make them XREFs..."); +$data =~ s{<link (linkend=.+?)>.+?</link>} + {<xref $1 />}gs; + # Probably need to strip these msg ('Adding "See " to XREFs that used to be @xref...'); $data =~ s{([.'!)])\s*<xref } @@ -137,7 +172,7 @@ exit; # sub msg { - print STDERR shift, "\n"; + print STDERR "docbook-fixup:", shift, "\n"; } sub strip_tag($$) { diff --git a/Docs/Support/docbook-prefix.pl b/Docs/Support/docbook-prefix.pl new file mode 100755 index 00000000000..e76d84dbfe0 --- /dev/null +++ b/Docs/Support/docbook-prefix.pl @@ -0,0 +1,50 @@ +#!/usr/bin/perl -w + +# Preprocess the input of `makeinfo --docbook` version 4.0c +# Authors: Arjen Lentz and Zak Greant (started by arjen 2002-05-01) + +use strict; + +my $data = ''; + +msg ("-- Pre-processing `makeinfo --docbook` input --"); +msg ("** Written to work with makeinfo version 4.0c **\n"); + +# <> is a magic filehandle - either reading lines from stdin or from file(s) specified on the command line +msg ("Get the data"); +$data = join "", <>; + +msg ("Replacing '\@-' with FIXUPmdashFIXUP"); +$data =~ s/\@-/FIXUPmdashFIXUP/g; + +msg ("Replacing '--' with FIXUPdoubledashFIXUP"); +$data =~ s/--/FIXUPdoubledashFIXUP/g; + +msg ("Turning \@strong{} into LITERAL blocks"); +$data =~ s/\@strong\{(.*?)\}/FIXUPstrongFIXUP$1FIXUPendstrongFIXUP/gs; + +msg ("Turning \@emph{} into LITERAL blocks"); +$data =~ s/\@emph\{(.*?)\}/FIXUPemphFIXUP$1FIXUPendemphFIXUP/gs; + +msg ("Turning \@file{} into LITERAL blocks"); +$data =~ s/\@file\{(.*?)\}/FIXUPfileFIXUP$1FIXUPendfileFIXUP/gs; + +msg ("Turning \@samp{} into LITERAL blocks"); +$data =~ s/\@samp\{\@\{\}/FIXUPsampFIXUP\@\{FIXUPendsampFIXUP/g; +$data =~ s/\@samp\{\@\}\}/FIXUPsampFIXUP\@\}FIXUPendsampFIXUP/g; +$data =~ s/\@samp\{\@\{n\@\}\}/FIXUPsampFIXUP\@\{n\@\}FIXUPendsampFIXUP/g; +$data =~ s/\@samp\{(.*?)\}/FIXUPsampFIXUP$1FIXUPendsampFIXUP/gs; + + +msg ("Write the data"); +print STDOUT $data; +exit; + +# +# Definitions for helper sub-routines +# + +sub msg { + print STDERR "docbook-prefix: ", shift, "\n"; +} + diff --git a/Docs/Support/make-docbook b/Docs/Support/make-docbook index bdca812d7ab..93dbc56c0f8 100755 --- a/Docs/Support/make-docbook +++ b/Docs/Support/make-docbook @@ -6,14 +6,19 @@ #create include.texi with version/port # echo "@c This file is autogenerated by the Makefile" > include.texi echo -n "@set mysql_version " >> include.texi +# grep "AM_INIT_AUTOMAKE(mysql, " ../configure.in | \ +# sed -e 's;AM_INIT_AUTOMAKE(mysql, ;;' -e 's;);;' >> include.texi +# 2002-04-26 arjen - the below just picks #.# instead of #.#.#-alpha +# (code by mwagner - tnx) grep "AM_INIT_AUTOMAKE(mysql, " ../configure.in | \ - sed -e 's;AM_INIT_AUTOMAKE(mysql, ;;' -e 's;);;' >> include.texi + perl -p -e 's/AM_INIT_AUTOMAKE\(mysql,\s(\d+\.\d+)\..+/$1/' >> include.texi echo -n "@set default_port " >> include.texi grep "MYSQL_TCP_PORT_DEFAULT=" ../configure.in | \ sed -e 's;MYSQL_TCP_PORT_DEFAULT=;;' >> include.texi # produce DocBook XML - makeinfo --force --no-ifinfo --docbook -o - manual.texi |\ + Support/docbook-prefix.pl < manual.texi |\ + makeinfo --force --no-ifinfo --docbook -o - |\ Support/docbook-fixup.pl > mysql.xml # See if the XML output is well-formed diff --git a/Docs/Support/trivial-makeinfo-4.0c.patch b/Docs/Support/trivial-makeinfo-4.0c.patch new file mode 100644 index 00000000000..b2446c0e8bb --- /dev/null +++ b/Docs/Support/trivial-makeinfo-4.0c.patch @@ -0,0 +1,11 @@ +--- alt-multi.c Sun Apr 14 10:03:19 2002 ++++ multi.c Tue May 22 20:52:33 2001 +@@ -287,7 +287,7 @@ + && *params != '\n' && *params != '@') + params++; + setup_output_environment (i, +- (int) ((columnfrac * 100.00) + 0.49)); ++ (int) (columnfrac * (fill_column - current_indent) + .5)); + } + } + diff --git a/Docs/Support/update-reserved-words.pl b/Docs/Support/update-reserved-words.pl index e7f8329009e..6164698943f 100755 --- a/Docs/Support/update-reserved-words.pl +++ b/Docs/Support/update-reserved-words.pl @@ -4,6 +4,8 @@ # Implemented in Perl by jeremy@mysql.com # 2001-11-20 Fixups by arjen@mysql.com, 2 keywords and 15 synonyms were missing # 2001-12-07 Fixup by arjen@mysql.com, add column headings for multitable. +# 2002-05-01 Fixup by arjen@mysql.com, use 3 columns instead of 4. +# 2002-05-03 Fixup by arjen@mysql.com, fill last row to full # of columns. print STDERR "Scanning lex.h for symbols..\n"; open LEX, "<../sql/lex.h"; @@ -27,11 +29,6 @@ while(($line = <YACC>) =~ /[\s|]+([A-Z_]+)/) { close YACC; -$list = sprintf("\@c Reserved word list updated %s by %s.\n". - "\@c To regenerate, use Support/update-reserved-words.pl.\n\n", - &pretty_date, $ENV{USER}); - - print STDERR "Copying reserved words to an array...\n"; foreach(keys %words) { push @words, $words{$_}; }; @@ -40,12 +37,16 @@ print STDERR "Sorting array...\n"; printf STDERR "There are %i reserved words.\n", scalar @words; -@pre = ("\@item", "\@tab", " \@tab", "\@tab"); -@post = ("", "\n", "", "\n"); +@pre = ("\@item", " \@tab", " \@tab"); +$list = ""; for($i=0; $word = shift(@words); $i++) { - $list .= sprintf "%s %-30s %s", $pre[$i%4], "\@code\{$word\}", $post[$i%4]; -}; $list .= "\n"; + $list .= sprintf "%s %s\n", $pre[$i%3], "\@code\{$word\}"; +} +# Fill last row to full # of columns. +for( ; $i%3; $i++) { + $list .= sprintf "%s\n", $pre[$i%3]; +} open OLD, "<manual.texi"; open NEW, ">manual-tmp.texi"; @@ -53,9 +54,14 @@ open NEW, ">manual-tmp.texi"; print STDERR "Copying beginning of manual.texi...\n"; while(($line = <OLD>) !~ /START_OF_RESERVED_WORDS/) { print NEW $line; }; print NEW "\@c START_OF_RESERVED_WORDS\n\n"; +printf NEW "\@c Reserved word list updated %s by %s.\n". + "\@c To regenerate, use Support/update-reserved-words.pl.\n\n", + &pretty_date, $ENV{USER}; + print STDERR "Inserting list of reserved words...\n"; -print NEW "\@multitable \@columnfractions .25 .25 .25 .25\n"; -print NEW "\@item \@strong{Word} \@tab \@strong{Word} \@tab \@strong{Word} \@tab \@strong{Word}\n"; +# Ensure the fractions add up to 100% otherwise it looks funny in print: +print NEW "\@multitable \@columnfractions .33 .33 .34\n"; +print NEW "\@item \@strong{Word}\n \@tab \@strong{Word}\n \@tab \@strong{Word}\n"; print NEW $list; print NEW "\@end multitable\n"; print STDERR "Skipping over old list...\n"; |