From 8388e2dced146e17e63b0166f2df684b4a2c70a3 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 23 Apr 2015 18:25:11 +0300 Subject: Fix doc generation. Default Config file applied to all output formats, which is wrong. Use a dedicated configuration file for html output formats, and defaults for the rest. * doc/Makefile.am (GENDOCS): Add html-specific configuration file. * doc/Config: Rename to doc/html.init (with changes). * doc/gendocs.sh: New option --no-copy-images --- doc/Config | 171 -------------------------------------------------------- doc/Makefile.am | 7 +-- doc/gendocs.sh | 15 +++-- doc/html.init | 171 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 183 insertions(+), 181 deletions(-) delete mode 100644 doc/Config create mode 100644 doc/html.init diff --git a/doc/Config b/doc/Config deleted file mode 100644 index 8ee754b..0000000 --- a/doc/Config +++ /dev/null @@ -1,171 +0,0 @@ -# Texi2any configuration for Dico documentation. -*- perl -*- -# Copyright (C) 2009-2010, 2012, 2015 Sergey Poznyakoff -# -# Dico is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3, or (at your option) -# any later version. -# -# Dico is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Dico. If not, see . -use strict; - -my $top_html_dir="/software/dico"; -my $graphics_dir="$top_html_dir/graphics"; - -## texi2html configuration - -# Show TOC in place of the @contents directive. -set_from_init_file('INLINE_CONTENTS', 1); -# Do not show Texinfo menus. -set_from_init_file('SHOW_MENU', 0); -# Inhibit output of CSS lines in page headers. -set_from_init_file('CSS_LINES', ''); - -set_from_init_file('BODYTEXT', ""); - -set_from_init_file('EXTRA_HEAD', - ''. - "\n\ - \ - \ - "); - -set_from_init_file('AFTER_BODY_OPEN', qq{ - - -
-}); - -sub gray_end_file($) -{ - my $self = shift; - my $program_text = ''; - if ($self->get_conf('PROGRAM_NAME_IN_FOOTER')) { - my $program_string = &{$self->{'format_program_string'}}($self); - $program_text = "

- $program_string -

"; - } - my $pre_body_close = $self->get_conf('PRE_BODY_CLOSE'); - $pre_body_close = '' if (!defined($pre_body_close)); - return "
-
-$program_text - -$pre_body_close -
- - - -"; -} - -texinfo_register_formatting_function('end_file', \&gray_end_file); - -set_from_init_file('PRE_BODY_CLOSE', - 'Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.'); - -# Print generating program name at the bottom of a page. -set_from_init_file('PROGRAM_NAME_IN_FOOTER',1); - -# Disable horizontal bars -set_from_init_file('DEFAULT_RULE', ''); -set_from_init_file('BIG_RULE', ''); - -# Turn off footer buttons in section split -set_from_init_file('SECTION_FOOTER_BUTTONS', undef); -#set_from_init_file('SECTION_BUTTONS', undef); -# Turn off navigation bars at the bottom of each section in chapter split mode -set_from_init_file('HEADERS', undef) - if (get_conf('SPLIT') and (get_conf('SPLIT') eq 'chapter')); -# Use navigation icons - -set_from_init_file('ICONS', 1); - -set_from_init_file('ACTIVE_ICONS', - { - 'Top' => "$graphics_dir/top.png", - 'Contents' => "$graphics_dir/ctx.png", - 'Overview' => '', - 'Index' => "$graphics_dir/idx.png", - 'This' => '', - 'Back' => "$graphics_dir/left.png", - 'FastBack' => "$graphics_dir/bwd.png", - 'Prev' => "", - 'Up' => "$graphics_dir/up.png", - 'Next' => "$graphics_dir/right.png", - 'NodeUp' => "$graphics_dir/left.png", - 'NodeNext' => "$graphics_dir/up.png", - 'NodePrev' => "$graphics_dir/right.png", - 'Following' => "$graphics_dir/right.png", - 'Forward' => "$graphics_dir/right.png", - 'FastForward' => "$graphics_dir/fwd.png", - 'About' => '', - 'First' => '', - 'Last' => '', - ' ' => '' - }); - -sub gray_split_status() -{ - my $split = get_conf('SPLIT'); - if ($split eq '') { - return ''; - } elsif ($split eq 'node') { - return ' (split by node)'; - } elsif ($split eq 'section') { - return ' (split by section)'; - } elsif ($split eq 'chapter') { - return ' (split by chapter)'; - } -} - -sub gray_document_title($$) -{ - my $self = shift; - my $direction = shift; - my $status = gray_split_status(); - - return q{} . $self->{title_string} . '' .$status . q{:}; -} - -sub gray_sec_ref($$) -{ - return q{Section:}; -} - -sub gray_chap_ref($$) -{ - return q{Chapter:}; -} - - -my @gray_buttons = (\&gray_document_title, ' ', - \&gray_sec_ref, 'Back', 'Forward', ' ', - \&gray_chap_ref, - 'FastBack', ' ', 'Up', ' ', 'FastForward', ' ', - 'Contents', 'Index' ); - -set_from_init_file('SECTION_BUTTONS', \@gray_buttons); -set_from_init_file('CHAPTER_BUTTONS', \@gray_buttons); -set_from_init_file('NODE_FOOTER_BUTTONS', \@gray_buttons); -set_from_init_file('MISC_BUTTONS', - [\&gray_document_title, - 'Contents', - 'Index', - ' ', - 'About' - ]); diff --git a/doc/Makefile.am b/doc/Makefile.am index 0e02104..084bba9 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -1,5 +1,5 @@ # This file is part of GNU Dico -# Copyright (C) 2008, 2010, 2012, 2014 Sergey Poznyakoff +# Copyright (C) 2008-2015 Sergey Poznyakoff # # GNU Dico is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -76,10 +76,9 @@ master-menu: imprimatur-master-menu untabify: imprimatur-untabify final: imprimatur-final -GENDOCS=gendocs.sh +GENDOCS=$(srcdir)/gendocs.sh --no-copy-images --html '--init-file=$(abs_srcdir)/html.init' -#FIXME: -E -TEXI2DVI=texi2dvi -t '@set $(RENDITION)' -I $(top_srcdir)/imprimatur +TEXI2DVI=texi2dvi -t '@set $(RENDITION)' -E .PHONY: manual man-tar # Make sure you set TEXINPUTS. diff --git a/doc/gendocs.sh b/doc/gendocs.sh index cd130d0..8ac3a06 100755 --- a/doc/gendocs.sh +++ b/doc/gendocs.sh @@ -78,6 +78,8 @@ Options: --html ARG pass ARG to makeinfo or texi2html for HTML targets. --info ARG pass ARG to makeinfo for Info, instead of --no-split. --no-ascii skip generating the plain text output. + --no-copy-images + don't try to copy images referenced by img HTML tags, --source ARG include ARG in tar archive of sources. --split HOW make split HTML by node, section, chapter; default node. @@ -147,6 +149,7 @@ outdir=manual source_extra= split=default srcfile= +no_copy_images= while test $# -gt 0; do case $1 in @@ -162,7 +165,7 @@ while test $# -gt 0; do --source) shift; source_extra=$1;; --split) shift; split=$1;; --texi2html) use_texi2html=1;; - + --no-copy-images) no_copy_images=1;; --help) echo "$usage"; exit 0;; --version) echo "$version"; exit 0;; -*) @@ -225,6 +228,7 @@ calcsize() # for them in the -I directories. copy_images() { + test -n "$no_copy_images" && return local odir odir=$1 shift @@ -343,19 +347,18 @@ if test -z "$use_texi2html"; then html_mono_size=`calcsize $PACKAGE.html` gzip -f -9 -c $PACKAGE.html >"$outdir/$PACKAGE.html.gz" html_mono_gz_size=`calcsize "$outdir/$PACKAGE.html.gz"` -## FIXME -# copy_images "$outdir/" $PACKAGE.html + copy_images "$outdir/" $PACKAGE.html mv $PACKAGE.html "$outdir/" ls -l "$outdir/$PACKAGE.html" "$outdir/$PACKAGE.html.gz" - # Before Texinfo 5.0, makeinfo did not accept a --split=HOW option, - # it just always split by node. So if we're splitting by node anyway, - # leave it out. version=`makeinfo --version|sed -n '1s/.* \([0-9][0-9]*\)\.[0-9.]*/\1/p'` case $version in [0-9]*) ;; *) version=4;; esac + # Before Texinfo 5.0, makeinfo did not accept a --split=HOW option, + # it just always split by node. So if we're splitting by node anyway, + # leave it out. if test $version -lt 5 -o "x$split" != xdefault; then split_arg=--split=$split opt="--html -o $PACKAGE.html $split_arg $commonarg $htmlarg" diff --git a/doc/html.init b/doc/html.init new file mode 100644 index 0000000..d312e6a --- /dev/null +++ b/doc/html.init @@ -0,0 +1,171 @@ +# Texi2any configuration for Dico documentation. -*- perl -*- +# Copyright (C) 2009-2010, 2012, 2015 Sergey Poznyakoff +# +# Dico is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3, or (at your option) +# any later version. +# +# Dico is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Dico. If not, see . +use strict; + +my $top_html_dir="/software/dico"; +my $graphics_dir="$top_html_dir/graphics"; + +## texi2html configuration + +# Show TOC in place of the @contents directive. +set_from_init_file('INLINE_CONTENTS', 1); +# Do not show Texinfo menus. +set_from_init_file('SHOW_MENU', 0); +# Inhibit output of CSS lines in page headers. +set_from_init_file('CSS_LINES', ''); + +set_from_init_file('BODYTEXT', ""); + +set_from_init_file('EXTRA_HEAD', + ''. + "\n\ + \ + \ + "); + +set_from_init_file('AFTER_BODY_OPEN', qq{ + + +
+}); + +sub gray_end_file($) +{ + my $self = shift; + my $program_text = ''; + if ($self->get_conf('PROGRAM_NAME_IN_FOOTER')) { + my $program_string = &{$self->{'format_program_string'}}($self); + $program_text = "

+ $program_string +

"; + } + my $pre_body_close = $self->get_conf('PRE_BODY_CLOSE'); + $pre_body_close = '' if (!defined($pre_body_close)); + return "
+
+$program_text + +$pre_body_close +
+ + + +"; +} + +texinfo_register_formatting_function('end_file', \&gray_end_file); + +set_from_init_file('PRE_BODY_CLOSE', + 'Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.'); + +# Print generating program name at the bottom of a page. +set_from_init_file('PROGRAM_NAME_IN_FOOTER',1); + +# Disable horizontal bars +set_from_init_file('DEFAULT_RULE', ''); +set_from_init_file('BIG_RULE', ''); + +# Turn off navigation bars at the bottom of each section in chapter split mode, +# or subsection in section split mode. +set_from_init_file('HEADERS', undef) + if ((get_conf('SPLIT') eq 'chapter') or (get_conf('SPLIT') eq 'section')); +# Use navigation icons + +set_from_init_file('ICONS', 1); + +set_from_init_file('ACTIVE_ICONS', + { + 'Top' => "$graphics_dir/top.png", + 'Contents' => "$graphics_dir/ctx.png", + 'Overview' => '', + 'Index' => "$graphics_dir/idx.png", + 'This' => '', + 'Back' => "$graphics_dir/left.png", + 'FastBack' => "$graphics_dir/bwd.png", + 'Prev' => "", + 'Up' => "$graphics_dir/up.png", + 'Next' => "$graphics_dir/right.png", + 'NodeUp' => "$graphics_dir/left.png", + 'NodeNext' => "$graphics_dir/up.png", + 'NodePrev' => "$graphics_dir/right.png", + 'Following' => "$graphics_dir/right.png", + 'Forward' => "$graphics_dir/right.png", + 'FastForward' => "$graphics_dir/fwd.png", + 'About' => '', + 'First' => '', + 'Last' => '', + ' ' => '' + }); + +sub gray_split_status() +{ + my $split = get_conf('SPLIT'); + if ($split eq '') { + return ''; + } elsif ($split eq 'node') { + return ' (split by node)'; + } elsif ($split eq 'section') { + return ' (split by section)'; + } elsif ($split eq 'chapter') { + return ' (split by chapter)'; + } +} + +sub gray_document_title($$) +{ + my $self = shift; + my $direction = shift; + my $status = gray_split_status(); + + return q{} . $self->{title_string} . '' .$status . q{:}; +} + +sub gray_sec_ref($$) +{ + return q{Section:}; +} + +sub gray_chap_ref($$) +{ + return q{Chapter:}; +} + + +my @gray_buttons = (\&gray_document_title, ' ', + \&gray_sec_ref, 'Back', 'Forward', ' ', + \&gray_chap_ref, + 'FastBack', ' ', 'Up', ' ', 'FastForward', ' ', + 'Contents', 'Index' ); + +set_from_init_file('TOP_BUTTONS', undef); +set_from_init_file('SECTION_BUTTONS', \@gray_buttons); +set_from_init_file('CHAPTER_BUTTONS', \@gray_buttons); +set_from_init_file('NODE_FOOTER_BUTTONS', \@gray_buttons); +set_from_init_file('SECTION_FOOTER_BUTTONS', \@gray_buttons); +set_from_init_file('MISC_BUTTONS', + [\&gray_document_title, + 'Contents', + 'Index', + ' ', + 'About' + ]); -- cgit v1.2.1