Permalink
Fetching contributors…
Cannot retrieve contributors at this time
executable file 4873 lines (4401 sloc) 125 KB
</
#! /usr/bin/env perl
'di ';
'ig 00 ';
#+##############################################################################
#
# texi2html: Program to transform Texinfo documents to HTML
#
# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
#
# This program 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 2 of the License, or
# (at your option) any later version.
#
# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
#-##############################################################################
# Summary of changes by Paolo Bonzini:
# - Extensive modifications to texi2html.init to produce a nicer navigation
# bar
# - Removed support for an external texi2html.init
# - Removed support for latex2html
# - Don't use latex2html to produce smallcaps (@sc)
# - Produce a navigation bar for each chapter
# - Split at sections only, not at every node, if `-split section' is given
# on the command line
# - Produce amp/lt/gt entities instead of #38/#60/#62
# - Produce lowercase html
# This requires perl version 5 or higher
require 5.0;
# Homepage:
$T2H_HOMEPAGE = <<EOT;
http://www.mathematik.uni-kl.de/~obachman/Texi2html
EOT
# Authors:
$T2H_AUTHORS = <<EOT;
Written by: Lionel Cons <Lionel.Cons\@cern.ch> (original author)
Karl Berry <karl\@freefriends.org>
Olaf Bachmann <obachman\@mathematik.uni-kl.de>
and many others.
Maintained by: Olaf Bachmann <obachman\@mathematik.uni-kl.de>
Adapted by: Paolo Bonzini <bonzini\@gnu.org>
EOT
# Version: set in configure.in
$THISVERSION = '1.64a';
$THISPROG = "texi2html $THISVERSION"; # program name and version
# The man page for this program is included at the end of this file and can be
# viewed using the command 'nroff -man texi2html'.
# Identity:
$T2H_TODAY = &pretty_date; # like "20 September 1993"
#+++############################################################################
# #
# Initialization #
# Pasted content of File $(srcdir)/texi2html.init: Default initializations #
# #
#---############################################################################
######################################################################
# File: texi2html.init
#
# Sets default values for command-line arguments and for various customizable
# procedures
#
# A copy of this file is pasted into the beginning of texi2html by
# 'make texi2html'
#
# Copy this file and make changes to it, if you like.
# Afterwards, either, load it with command-line option -init_file <your_init_file>
#
# $Id: texi2html.init,v 1.34 2000/07/27 14:09:02 obachman Exp $
######################################################################
# stuff which can also be set by command-line options
#
#
# Note: values set here, overwrite values set by the command-line
# options before -init_file and might still be overwritten by
# command-line arguments following the -init_file option
#
# T2H_OPTIONS is a hash whose keys are the (long) names of valid
# command-line options and whose values are a hash with the following keys:
# type ==> one of !|=i|:i|=s|:s (see GetOpt::Long for more info)
# linkage ==> ref to scalar, array, or subroutine (see GetOpt::Long for more info)
# verbose ==> short description of option (displayed by -h)
# noHelp ==> if 1 -> for "not so important options": only print description on -h 1
# 2 -> for obsolete options: only print description on -h 2
$T2H_DEBUG = 0;
$T2H_OPTIONS -> {debug} =
{
type => '=i',
linkage => \$main::T2H_DEBUG,
verbose => 'output HTML with debuging information',
};
$T2H_DOCTYPE = '<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">';
$T2H_OPTIONS -> {doctype} =
{
type => '=s',
linkage => \$main::T2H_DOCTYPE,
verbose => 'document type which is output in header of HTML files',
noHelp => 1
};
$T2H_CHECK = 0;
$T2H_OPTIONS -> {check} =
{
type => '!',
linkage => \$main::T2H_CHECK,
verbose => 'if set, only check files and output all things that may be Texinfo commands',
noHelp => 1
};
# -expand
# if set to "tex" (or, "info") expand @iftex and @tex (or, @ifinfo) sections
# else, neither expand @iftex, @tex, nor @ifinfo sections
$T2H_EXPAND = "none";
$T2H_OPTIONS -> {expand} =
{
type => '=s',
linkage => \$T2H_EXPAND,
verbose => 'Expand info|tex|none section of texinfo source',
};
# - glossary
#if set, uses section named `Footnotes' for glossary
$T2H_USE_GLOSSARY = 0;
T2H_OPTIONS -> {glossary} =
{
type => '!',
linkage => \$T2H_USE_GLOSSARY,
verbose => "if set, uses section named `Footnotes' for glossary",
noHelp => 1,
};
# -invisible
# $T2H_INVISIBLE_MARK is the text used to create invisible destination
# anchors for index links (you can for instance use the invisible.xbm
# file shipped with this program). This is a workaround for a known
# bug of many WWW browsers, including netscape.
# For me, it works fine without it -- on the contrary: if there, it
# inserts space between headers and start of text (obachman 3/99)
$T2H_INVISIBLE_MARK = '';
# $T2H_INVISIBLE_MARK = '&#160;';
$T2H_OPTIONS -> {invisible} =
{
type => '=s',
linkage => \$T2H_INVISIBLE_MARK,
verbose => 'use text in invisble anchot',
noHelp => 1,
};
# -iso
# if set, ISO8879 characters are used for special symbols (like copyright, etc)
$T2H_USE_ISO = 0;
$T2H_OPTIONS -> {iso} =
{
type => 'iso',
linkage => \$T2H_USE_ISO,
verbose => 'if set, ISO8879 characters are used for special symbols (like copyright, etc)',
noHelp => 1,
};
# -I
# list directories where @include files are searched for (besides the
# directory of the doc file) additional '-I' args add to this list
@T2H_INCLUDE_DIRS = (".");
$T2H_OPTIONS -> {I} =
{
type => '=s',
linkage => \@T2H_INCLUDE_DIRS,
verbose => 'append $s to the @include search path',
};
# -top_file
# uses file of this name for top-level file
# extension is manipulated appropriately, if necessary.
# If empty, <basename of document>.html is used
# Typically, you would set this to "index.html".
$T2H_TOP_FILE = '';
$T2H_OPTIONS -> {top_file} =
{
type => '=s',
linkage => \$T2H_TOP_FILE,
verbose => 'use $s as top file, instead of <docname>.html',
};
# -toc_file
# uses file of this name for table of contents file
# extension is manipulated appropriately, if necessary.
# If empty, <basename of document>_toc.html is used
$T2H_TOC_FILE = '';
$T2H_OPTIONS -> {toc_file} =
{
type => '=s',
linkage => \$T2H_TOC_FILE,
verbose => 'use $s as ToC file, instead of <docname>_toc.html',
};
# -frames
# if set, output two additional files which use HTML 4.0 "frames".
$T2H_FRAMES = 0;
$T2H_OPTIONS -> {frames} =
{
type => '!',
linkage => \$T2H_FRAMES,
verbose => 'output files which use HTML 4.0 frames (experimental)',
noHelp => 1,
};
# -menu | -nomenu
# if set, show the Texinfo menus
$T2H_SHOW_MENU = 1;
$T2H_OPTIONS -> {menu} =
{
type => '!',
linkage => \$T2H_SHOW_MENU,
verbose => 'ouput Texinfo menus',
};
# -number | -nonumber
# if set, number sections and show section names and numbers in references
# and menus
$T2H_NUMBER_SECTIONS = 1;
$T2H_OPTIONS -> {number} =
{
type => '!',
linkage => \$T2H_NUMBER_SECTIONS,
verbose => 'use numbered sections'
};
# if set, and T2H_NUMBER_SECTIONS is set, then use node names in menu
# entries, instead of section names
$T2H_NODE_NAME_IN_MENU = 0;
# if set and menu entry equals menu descr, then do not print menu descr.
# Likewise, if node name equals entry name, do not print entry name.
$T2H_AVOID_MENU_REDUNDANCY = 1;
# -split section|chapter|none
# if set to 'section' (resp. 'chapter') create one html file per (sub)section
# (resp. chapter) and separate pages for Top, ToC, Overview, Index,
# Glossary, About.
# otherwise, create monolithic html file which contains whole document
#$T2H_SPLIT = 'section';
$T2H_SPLIT = '';
$T2H_OPTIONS -> {split} =
{
type => '=s',
linkage => \$T2H_SPLIT,
verbose => 'split document on section|chapter else no splitting',
};
# -section_navigation|-no-section_navigation
# if set, then navigation panels are printed at the beginning of each section
# and, possibly at the end (depending on whether or not there were more than
# $T2H_WORDS_IN_PAGE words on page
# This is most useful if you do not want to have section navigation
# on -split chapter
$T2H_SECTION_NAVIGATION = 0;
# -subdir
# if set put result files in this directory
# if not set result files are put into current directory
#$T2H_SUBDIR = 'html';
$T2H_SUBDIR = '';
$T2H_OPTIONS -> {subdir} =
{
type => '=s',
linkage => \$T2H_SUBDIR,
verbose => 'put HTML files in directory $s, instead of $cwd',
};
# -short_extn
# If this is set all HTML file will have extension ".htm" instead of
# ".html". This is helpful when shipping the document to PC systems.
$T2H_SHORTEXTN = 0;
$T2H_OPTIONS -> {short_ext} =
{
type => '!',
linkage => \$T2H_SHORTEXTN,
verbose => 'use "htm" extension for output HTML files',
};
# -prefix
# Set the output file prefix, prepended to all .html, .gif and .pl files.
# By default, this is the basename of the document
$T2H_PREFIX = '';
$T2H_OPTIONS -> {prefix} =
{
type => '=s',
linkage => \$T2H_PREFIX,
verbose => 'use as prefix for output files, instead of <docname>',
};
# -o filename
# If set, generate monolithic document output html into $filename
$T2H_OUT = '';
$T2H_OPTIONS -> {out_file} =
{
type => '=s',
linkage => sub {$main::T2H_OUT = @_[1]; $T2H_SPLIT = '';},
verbose => 'if set, all HTML output goes into file $s',
};
# -short_ref
#if set cross-references are given without section numbers
$T2H_SHORT_REF = '';
$T2H_OPTIONS -> {short_ref} =
{
type => '!',
linkage => \$T2H_SHORT_REF,
verbose => 'if set, references are without section numbers',
};
# -idx_sum
# if value is set, then for each @prinindex $what
# $docu_name_$what.idx is created which contains lines of the form
# $key\t$ref sorted alphabetically (case matters)
$T2H_IDX_SUMMARY = 0;
$T2H_OPTIONS -> {idx_sum} =
{
type => '!',
linkage => \$T2H_IDX_SUMMARY,
verbose => 'if set, also output index summary',
noHelp => 1,
};
# -verbose
# if set, chatter about what we are doing
$T2H_VERBOSE = '';
$T2H_OPTIONS -> {Verbose} =
{
type => '!',
linkage => \$T2H_VERBOSE,
verbose => 'print progress info to stdout',
};
# -lang
# For page titles use $T2H_WORDS->{$T2H_LANG}->{...} as title.
# To add a new language, supply list of titles (see $T2H_WORDS below).
# and use ISO 639 language codes (see e.g. perl module Locale-Codes-1.02
# for definitions)
# Default's to 'en' if not set or no @documentlanguage is specified
$T2H_LANG = '';
$T2H_OPTIONS -> {lang} =
{
type => '=s',
linkage => sub {SetDocumentLanguage($_[1])},
verbose => 'use $s as document language (ISO 639 encoding)',
};
$T2H_OPTIONS -> {D} =
{
type => '=s',
linkage => sub {$main::value{@_[1]} = 1;},
verbose => 'equivalent to Texinfo "@set $s 1"',
noHelp => 1,
};
$T2H_OPTIONS -> {init_file} =
{
type => '=s',
linkage => \&LoadInitFile,
verbose => 'load init file $s'
};
##############################################################################
#
# The following can only be set in the init file
#
##############################################################################
# if set, center @image by default
# otherwise, do not center by default
$T2H_CENTER_IMAGE = 1;
# used as identation for block enclosing command @example, etc
# If not empty, must be enclosed in <td></td>
$T2H_EXAMPLE_INDENT_CELL = '<td>&nbsp;</td>';
# same as above, only for @small
$T2H_SMALL_EXAMPLE_INDENT_CELL = '<td>&nbsp;</td>';
# font size for @small
$T2H_SMALL_FONT_SIZE = '-1';
# if non-empty, and no @..heading appeared in Top node, then
# use this as header for top node/section, otherwise use value of
# @settitle or @shorttitle (in that order)
$T2H_TOP_HEADING = '';
# if set, use this chapter for 'Index' button, else
# use first chapter whose name matches 'index' (case insensitive)
$T2H_INDEX_CHAPTER = '';
# if set and $T2H_SPLIT is set, then split index pages at the next letter
# after they have more than that many entries
$T2H_SPLIT_INDEX = 100;
# if set (e.g., to index.html) replace hrefs to this file
# (i.e., to index.html) by ./
$T2H_HREF_DIR_INSTEAD_FILE = '';
########################################################################
# Language dependencies:
# To add a new language extend T2H_WORDS hash and create $T2H_<...>_WORDS hash
# To redefine one word, simply do:
# $T2H_WORDS->{<language>}->{<word>} = 'whatever' in your personal init file.
#
$T2H_WORDS_EN =
{
# titles of pages
'ToC_Title' => 'Table of Contents',
'Overview_Title' => 'Short Table of Contents',
'Index_Title' => 'Index',
'About_Title' => 'About this document',
'Footnotes_Title' => 'Footnotes',
'See' => 'See',
'see' => 'see',
'section' => 'section',
# If necessary, we could extend this as follows:
# # text for buttons
# 'Top_Button' => 'Top',
# 'ToC_Button' => 'Contents',
# 'Overview_Button' => 'Overview',
# 'Index_button' => 'Index',
# 'Back_Button' => 'Back',
# 'FastBack_Button' => 'FastBack',
# 'Prev_Button' => 'Prev',
# 'Up_Button' => 'Up',
# 'Next_Button' => 'Next',
# 'Forward_Button' =>'Forward',
# 'FastWorward_Button' => 'FastForward',
# 'First_Button' => 'First',
# 'Last_Button' => 'Last',
# 'About_Button' => 'About'
};
$T2H_WORD_DE =
{
'ToC_Title' => 'Inhaltsverzeichniss',
'Overview_Title' => 'Kurzes Inhaltsverzeichniss',
'Index_Title' => 'Index',
'About_Title' => '&Uuml;ber dieses Dokument',
'Footnotes_Title' => 'Fu&szlig;noten',
'See' => 'Siehe',
'see' => 'siehe',
'section' => 'Abschnitt',
};
$T2H_WORD_NL =
{
'ToC_Title' => 'Inhoudsopgave',
'Overview_Title' => 'Korte inhoudsopgave',
'Index_Title' => 'Index', #Not sure ;-)
'About_Title' => 'No translation available!', #No translation available!
'Footnotes_Title' => 'No translation available!', #No translation available!
'See' => 'Zie',
'see' => 'zie',
'section' => 'sectie',
};
$T2H_WORD_ES =
{
'ToC_Title' => '&iacute;ndice General',
'Overview_Title' => 'Resumen del Contenido',
'Index_Title' => 'Index', #Not sure ;-)
'About_Title' => 'No translation available!', #No translation available!
'Footnotes_Title' => 'Fu&szlig;noten',
'See' => 'V&eacute;ase',
'see' => 'v&eacute;ase',
'section' => 'secci&oacute;n',
};
$T2H_WORD_NO =
{
'ToC_Title' => 'Innholdsfortegnelse',
'Overview_Title' => 'Kort innholdsfortegnelse',
'Index_Title' => 'Indeks', #Not sure ;-)
'About_Title' => 'No translation available!', #No translation available!
'Footnotes_Title' => 'No translation available!',
'See' => 'Se',
'see' => 'se',
'section' => 'avsnitt',
};
$T2H_WORD_PT =
{
'ToC_Title' => 'Sum&aacute;rio',
'Overview_Title' => 'Breve Sum&aacute;rio',
'Index_Title' => '&Iacute;ndice', #Not sure ;-)
'About_Title' => 'No translation available!', #No translation available!
'Footnotes_Title' => 'No translation available!',
'See' => 'Veja',
'see' => 'veja',
'section' => 'Se&ccedil;&atilde;o',
};
$T2H_WORDS =
{
'en' => $T2H_WORDS_EN,
'de' => $T2H_WORDS_DE,
'nl' => $T2H_WORDS_NL,
'es' => $T2H_WORDS_ES,
'no' => $T2H_WORDS_NO,
'pt' => $T2H_WORDS_PT
};
@MONTH_NAMES_EN =
(
'January', 'February', 'March', 'April', 'May',
'June', 'July', 'August', 'September', 'October',
'November', 'December'
);
@MONTH_NAMES_DE =
(
'Januar', 'Februar', 'M&auml;rz', 'April', 'Mai',
'Juni', 'Juli', 'August', 'September', 'Oktober',
'November', 'Dezember'
);
@MONTH_NAMES_NL =
(
'Januari', 'Februari', 'Maart', 'April', 'Mei',
'Juni', 'Juli', 'Augustus', 'September', 'Oktober',
'November', 'December'
);
@MONTH_NAMES_ES =
(
'enero', 'febrero', 'marzo', 'abril', 'mayo',
'junio', 'julio', 'agosto', 'septiembre', 'octubre',
'noviembre', 'diciembre'
);
@MONTH_NAMES_NO =
(
'januar', 'februar', 'mars', 'april', 'mai',
'juni', 'juli', 'august', 'september', 'oktober',
'november', 'desember'
);
@MONTH_NAMES_PT =
(
'Janeiro', 'Fevereiro', 'Mar&ccedil;o', 'Abril', 'Maio',
'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro',
'Novembro', 'Dezembro'
);
$MONTH_NAMES =
{
'en' => \@MONTH_NAMES_EN,
'de' => \@MONTH_NAMES_DE,
'es' => \@MONTH_NAMES_ES,
'nl' => \@MONTH_NAMES_NL,
'no' => \@MONTH_NAMES_NO,
'pt' => \@MONTH_NAMES_PT
};
########################################################################
# Control of Page layout:
# You can make changes of the Page layout at two levels:
# 1.) For small changes, it is often enough to change the value of
# some global string/hash/array variables
# 2.) For larger changes, reimplement one of the T2H_DEFAULT_<fnc>* routines,
# give them another name, and assign them to the respective
# $T2H_<fnc> variable.
# As a general interface, the hashes T2H_HREF, T2H_NAME, T2H_NODE hold
# href, html-name, node-name of
# This -- current section (resp. html page)
# Top -- top page ($T2H_TOP_FILE)
# Contents -- Table of contents
# Overview -- Short table of contents
# Index -- Index page
# About -- page which explain "navigation buttons"
# First -- first node
# Last -- last node
#
# Whether or not the following hash values are set, depends on the context
# (all values are w.r.t. 'This' section)
# Next -- next node of texinfo
# Prev -- previous node of texinfo
# Up -- up node of texinfo
# Forward -- next node in reading order
# Back -- previous node in reading order
# FastForward -- if leave node, up and next, else next node
# FastBackward-- if leave node, up and prev, else prev node
#
# Furthermore, the following global variabels are set:
# $T2H_THISDOC{title} -- title as set by @setttile
# $T2H_THISDOC{fulltitle} -- full title as set by @title...
# $T2H_THISDOC{subtitle} -- subtitle as set by @subtitle
# $T2H_THISDOC{author} -- author as set by @author
#
# and pointer to arrays of lines which need to be printed by t2h_print_lines
# $T2H_OVERVIEW -- lines of short table of contents
# $T2H_TOC -- lines of table of contents
# $T2H_TOP -- lines of Top texinfo node
# $T2H_THIS_SECTION -- lines of 'This' section
#
# There are the following subs which control the layout:
#
$T2H_print_section = \&T2H_DEFAULT_print_section;
$T2H_print_Top_header = \&T2H_DEFAULT_print_Top_header;
$T2H_print_Top_footer = \&T2H_DEFAULT_print_Top_footer;
$T2H_print_Top = \&T2H_DEFAULT_print_Top;
$T2H_print_Toc = \&T2H_DEFAULT_print_Toc;
$T2H_print_Overview = \&T2H_DEFAULT_print_Overview;
$T2H_print_Footnotes = \&T2H_DEFAULT_print_Footnotes;
$T2H_print_About = \&T2H_DEFAULT_print_About;
$T2H_print_misc_header = \&T2H_DEFAULT_print_misc_header;
$T2H_print_misc_footer = \&T2H_DEFAULT_print_misc_footer;
$T2H_print_misc = \&T2H_DEFAULT_print_misc;
$T2H_print_chapter_header = \&T2H_DEFAULT_print_chapter_header;
$T2H_print_chapter_footer = \&T2H_DEFAULT_print_chapter_footer;
$T2H_print_page_head = \&T2H_DEFAULT_print_page_head;
$T2H_print_page_foot = \&T2H_DEFAULT_print_page_foot;
$T2H_print_head_navigation = \&T2H_DEFAULT_print_head_navigation;
$T2H_print_foot_navigation = \&T2H_DEFAULT_print_foot_navigation;
$T2H_button_icon_img = \&T2H_DEFAULT_button_icon_img;
$T2H_print_navigation = \&T2H_DEFAULT_print_navigation;
$T2H_about_body = \&T2H_DEFAULT_about_body;
$T2H_print_frame = \&T2H_DEFAULT_print_frame;
$T2H_print_toc_frame = \&T2H_DEFAULT_print_toc_frame;
########################################################################
# Layout for html for every sections
#
sub T2H_DEFAULT_print_section
{
my $fh = shift;
my $nw = t2h_print_lines($fh);
print $fh '<hr size="6">' . "\n";
}
###################################################################
# Layout of top-page I recommend that you use @ifnothtml, @ifhtml,
# @html within the Top texinfo node to specify content of top-level
# page.
#
# If you enclose everything in @ifnothtml, then title, subtitle,
# author and overview is printed
# T2H_HREF of Next, Prev, Up, Forward, Back are not defined
# if $T2H_SPLIT then Top page is in its own html file
sub T2H_DEFAULT_print_Top_header
{
&$T2H_print_page_head(@_) if $T2H_SPLIT;
t2h_print_label(@_); # this needs to be called, otherwise no label set
&$T2H_print_head_navigation(@_);
}
sub T2H_DEFAULT_print_Top_footer
{
&$T2H_print_foot_navigation(@_);
&$T2H_print_page_foot(@_) if $T2H_SPLIT;
}
sub T2H_DEFAULT_print_Top
{
my $fh = shift;
# for redefining navigation buttons use:
# local $T2H_BUTTONS = [...];
# as it is, 'Top', 'Contents', 'Index', 'About' are printed
local $T2H_BUTTONS = \@T2H_MISC_BUTTONS;
&$T2H_print_Top_header($fh);
if ($T2H_THIS_SECTION)
{
# if top-level node has content, then print it with extra header
print $fh "<h1>$T2H_NAME{Top}</h1>"
unless ($T2H_HAS_TOP_HEADING);
t2h_print_lines($fh, $T2H_THIS_SECTION)
}
else
{
# top-level node is fully enclosed in @ifnothtml
# print fulltitle, subtitle, author, Overview
print $fh
"<center>\n<h1>" .
join("</h1>\n<h1>", split(/\n/, $T2H_THISDOC{fulltitle})) .
"</h1>\n";
print $fh "<h2>$T2H_THISDOC{subtitle}</h2>\n" if $T2H_THISDOC{subtitle};
print $fh "$T2H_THISDOC{author}\n" if $T2H_THISDOC{author};
print $fh <<EOT;
</center>
<hr>
<p></p>
<h2> overview: </h2>
<blockquote>
EOT
t2h_print_lines($fh, $T2H_OVERVIEW);
print $fh "</blockquote>\n";
}
&$T2H_print_Top_footer($fh);
}
###################################################################
# Layout of Toc, Overview, and Footnotes pages
# By default, we use "normal" layout
# T2H_HREF of Next, Prev, Up, Forward, Back, etc are not defined
# use: local $T2H_BUTTONS = [...] to redefine navigation buttons
sub T2H_DEFAULT_print_Toc
{
return &$T2H_print_misc(@_);
}
sub T2H_DEFAULT_print_Overview
{
return &$T2H_print_misc(@_);
}
sub T2H_DEFAULT_print_Footnotes
{
return &$T2H_print_misc(@_);
}
sub T2H_DEFAULT_print_About
{
return &$T2H_print_misc(@_);
}
sub T2H_DEFAULT_print_misc_header
{
&$T2H_print_page_head(@_) if $T2H_SPLIT;
# this needs to be called, otherwise, no labels are set
t2h_print_label(@_);
&$T2H_print_head_navigation(@_);
}
sub T2H_DEFAULT_print_misc_footer
{
&$T2H_print_foot_navigation(@_);
&$T2H_print_page_foot(@_) if $T2H_SPLIT;
}
sub T2H_DEFAULT_print_misc
{
my $fh = shift;
local $T2H_BUTTONS = \@T2H_MISC_BUTTONS;
&$T2H_print_misc_header($fh);
print $fh "<h1>$T2H_NAME{This}</h1>\n";
t2h_print_lines($fh);
&$T2H_print_misc_footer($fh);
}
###################################################################
# chapter_header and chapter_footer are only called if
# T2H_SPLIT eq 'chapter'
# chapter_header: after print_page_header, before print_section
# chapter_footer: after print_section of last section, before print_page_footer
#
# If you want to get rid of navigation stuff after each section,
# redefine print_section such that it does not call print_navigation,
# and put print_navigation into print_chapter_header
@T2H_CHAPTER_BUTTONS =
(
'FastBack', 'FastForward', ' ',
'Top', 'Contents', 'Index', 'About',
);
@T2H_SECTION_BUTTONS =
(
'Back', 'Up', 'Forward', ' ',
'Top', 'Contents', 'Index', 'About',
);
sub T2H_DEFAULT_print_chapter_header
{
#if ($T2H_SPLIT)
#{
my $fh = shift;
local $T2H_BUTTONS = \@T2H_CHAPTER_BUTTONS if $T2H_SPLIT ne 'section';
local $T2H_BUTTONS = \@T2H_SECTION_BUTTONS if $T2H_SPLIT eq 'section';
&$T2H_print_head_navigation($fh);
#}
}
sub T2H_DEFAULT_print_chapter_footer
{
#if ($T2H_SPLIT)
#{
my $fh = shift;
local $T2H_BUTTONS = \@T2H_CHAPTER_BUTTONS if $T2H_SPLIT ne 'chapter';
local $T2H_BUTTONS = \@T2H_SECTION_BUTTONS if $T2H_SPLIT eq 'section';
&$T2H_print_foot_navigation($fh);
#}
}
###################################################################
$T2H_TODAY = &pretty_date; # like "20 September 1993"
sub pretty_date {
local($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
$year += ($year < 70) ? 2000 : 1900;
# obachman: Let's do it as the Americans do
return($MONTH_NAMES->{$T2H_LANG}[$mon] . ", " . $mday . " " . $year);
}
###################################################################
# Layout of standard header and footer
#
# Set the default body text, inserted between <BODY ... >
###$T2H_BODYTEXT = 'lang="en" bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000"';
$T2H_BODYTEXT = 'lang="' . $t2h_lang . '" bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000"';
# text inserted after <BODY ...>
$T2H_AFTER_BODY_OPEN = '';
#text inserted before </BODY>
$T2H_PRE_BODY_CLOSE = '';
# this is used in footer
$T2H_ADDRESS = "on <i>$T2H_TODAY</i>";
# this is added inside <HEAD></HEAD> after <TITLE> and some META NAME stuff
# can be used for <style> <script>, <meta> tags
$T2H_EXTRA_HEAD = '
<script language="Javascript">
<!--
// Check the browser version.
function checkVersion() {
if (navigator.appVersion.charAt(0)>=3) return true;
if (navigator.appVersion.charAt(0)>=4) return true;
else return false;
}
if (checkVersion()) {
homeon = new Image();
homeon.src = "images/homeon.png";
homeoff = new Image();
homeoff.src = "images/home.png";
tocon = new Image();
tocon.src = "images/tocon.png";
tocoff = new Image();
tocoff.src = "images/toc.png";
indexon = new Image();
indexon.src = "images/indexon.png";
indexoff = new Image();
indexoff.src = "images/index.png";
helpon = new Image();
helpon.src = "images/helpon.png";
helpoff = new Image();
helpoff.src = "images/help.png";
backon = new Image();
backon.src = "images/backon.png";
backoff = new Image();
backoff.src = "images/back.png";
forwardon = new Image();
forwardon.src = "images/forwardon.png";
forwardoff = new Image();
forwardoff.src = "images/forward.png";
prevon = new Image();
prevon.src = "images/prevon.png";
prevoff = new Image();
prevoff.src = "images/prev.png";
nexton = new Image();
nexton.src = "images/nexton.png";
nextoff = new Image();
nextoff.src = "images/next.png";
upon = new Image();
upon.src = "images/upon.png";
upoff = new Image();
upoff.src = "images/up.png";
}
function img_act(imgName) {
if (checkVersion()) {
imgOn = eval(imgName + "on.src");
document [imgName].src = imgOn;
}
}
function img_inact(imgName) {
if (checkVersion()) {
imgOff = eval(imgName + "off.src");
document [imgName].src = imgOff;
}
}
// -->
</script>
';
sub T2H_DEFAULT_print_page_head
{
my $fh = shift;
my $longtitle = "$T2H_THISDOC{title}: $T2H_NAME{This}";
print $fh <<EOT;
<html>
$T2H_DOCTYPE
<!-- Created on $T2H_TODAY by $THISPROG -->
<!--
$T2H_AUTHORS
-->
<head>
<title>$longtitle</title>
<meta name="description" content="$longtitle">
<meta name="keywords" content="$longtitle">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="generator" content="$THISPROG">
$T2H_EXTRA_HEAD
</head>
<body $T2H_BODYTEXT>
$T2H_AFTER_BODY_OPEN
EOT
}
sub T2H_DEFAULT_print_page_foot
{
my $fh = shift;
print $fh <<EOT;
</td>
</tr>
</table>
</tr></table>
<br>
<font size="-1">
This document was generated
$T2H_ADDRESS
using <a href="$t2h_homepage"><i>texi2html</i></a>
$T2H_PRE_BODY_CLOSE
</body>
</html>
EOT
}
###################################################################
# Layout of navigation panel
sub T2H_DEFAULT_print_head_navigation
{
my $fh = shift;
&$T2H_print_navigation($fh);
print $fh "<hr size=1>\n";
}
sub T2H_DEFAULT_print_foot_navigation
{
my $fh = shift;
my $nwords = shift;
print $fh "<hr size=1>\n";
&$T2H_print_navigation($fh);
print $fh "<hr size=1>\n";
}
######################################################################
# navigation panel
#
# specify in this array which "buttons" should appear in which order
# in the navigation panel for sections; use ' ' for empty buttons (space)
# buttons for misc stuff
@T2H_MISC_BUTTONS = ('Top', 'Contents', 'Index', 'About');
# insert here name of icon images for buttons
# Icons are used, if $T2H_ICONS and resp. value are set
%T2H_ACTIVE_ICONS =
(
'Top', 'home',
'Contents', 'toc',
'Overview', '',
'Index', 'index',
'Back', 'prev',
'FastBack', 'back',
'Prev', '',
'Up', 'up',
'Next', 'next',
'Forward', 'next',
'FastForward', 'forward',
'About' , 'help',
'First', '',
'Last', '',
' ', ''
);
# insert here name of icon images for these, if button is inactive
%T2H_PASSIVE_ICONS =
(
'Top', 'inactive',
'Contents', 'inactive',
'Overview', 'inactive',
'Index', 'inactive',
'Back', 'inactive',
'FastBack', 'inactive',
'Prev', 'inactive',
'Up', 'inactive',
'Next', 'inactive',
'Forward', 'inactive',
'FastForward', 'inactive',
'About', 'inactive',
'First', 'inactive',
'Last', 'inactive',
);
# how to create IMG tag
sub T2H_DEFAULT_button_icon_img
{
my $button = shift;
my $icon = shift;
my $name = shift;
return qq{<img src="images/$icon.png" border="0" alt="$button: $name" name="$icon" align="middle">};
}
# Names of text as alternative for icons
%T2H_NAVIGATION_TEXT =
(
'Top', 'Top',
'Contents', 'Contents',
'Overview', 'Overview',
'Index', 'Index',
' ', ' &nbsp; ',
'Back', ' &lt; ',
'FastBack', ' &lt;&lt; ',
'Prev', 'Prev',
'Up', ' Up ',
'Next', 'Next',
'Forward', ' &gt; ',
'FastForward', ' &gt;&gt; ',
'About', ' ? ',
'First', ' |&lt; ',
'Last', ' &gt;| '
);
sub T2H_DEFAULT_print_navigation
{
my $fh = shift;
my $spacing = 1;
print $fh "<table bgcolor=\"#e6e6e6\" cellpadding=$spacing cellspacing=$spacing border=0>\n";
print $fh "<tr valign=top>\n";
for $button (@$T2H_BUTTONS)
{
print $fh "<td valign=middle align=left>";
if (ref($button) eq 'CODE')
{
&$button($fh, 1);
}
elsif ($button eq ' ')
{ # handle space button
print $fh "&nbsp;";
}
elsif ($T2H_HREF{$button})
{ # button is active
print $fh
$T2H_ACTIVE_ICONS{$button} ? # use icon ?
t2h_anchor('', $T2H_HREF{$button}, # yes
&$T2H_button_icon_img($button,
$T2H_ACTIVE_ICONS{$button},
$T2H_NAME{$button}), 0,
"onMouseover=\"img_act('" . $T2H_ACTIVE_ICONS{$button} ."')\" " .
"onMouseout=\"img_inact('" . $T2H_ACTIVE_ICONS{$button} ."')\" ")
: "";
}
else
{ # button is passive
print $fh
$T2H_PASSIVE_ICONS{$button} ?
&$T2H_button_icon_img($button,
$T2H_PASSIVE_ICONS{$button},
$T2H_NAME{$button}) : "";
}
print $fh "</td>\n";
}
print $fh "</tr>\n";
print $fh "</table>\n";
}
######################################################################
# Frames: this is from "Richard Y. Kim" <ryk@coho.net>
# Should be improved to be more conforming to other _print* functions
sub T2H_DEFAULT_print_frame
{
my $fh = shift;
print $fh <<EOT;
<html>
<head><title>$T2H_THISDOC{title}</title></head>
<frameset cols="140,*">
<frame name=toc src="$docu_toc_frame_file">
<frame name=main src="$docu_doc">
</frameset>
</html>
EOT
}
sub T2H_DEFAULT_print_toc_frame
{
my $fh = shift;
&$T2H_print_page_head($fh);
print $fh <<EOT;
<h2>Content</h2>
EOT
print $fh map {s/href=/target=\"main\" href=/i; $_;} @stoc_lines;
print $fh "</body></html>\n";
}
######################################################################
# About page
#
# T2H_PRE_ABOUT might be a function
$T2H_PRE_ABOUT = <<EOT;
This document was generated $T2H_ADDRESS
using <a href="$T2H_HOMEPAGE"><i>texi2html</i></a>
<p></p>
EOT
$T2H_AFTER_ABOUT = '';
sub T2H_DEFAULT_about_body
{
my $about;
if (ref($T2H_PRE_ABOUT) eq 'CODE')
{
$about = &$T2H_PRE_ABOUT();
}
else
{
$about = $T2H_PRE_ABOUT;
}
$about .= <<EOT;
The buttons in the navigation panels have the following meaning:
<p></p>
<table border = "1">
<tr>
<th> Button </th>
<th> Name </th>
<th> Go to </th>
<th> From 1.2.3 go to</th>
</tr>
EOT
for $button (@T2H_SECTION_BUTTONS)
{
next if $button eq ' ' || ref($button) eq 'CODE';
$about .= <<EOT;
<tr>
<td align="center">
EOT
$about .=
($T2H_ICONS && $T2H_ACTIVE_ICONS{$button} ?
&$T2H_button_icon_img($button, $T2H_ACTIVE_ICONS{$button}) :
" [" . $T2H_NAVIGATION_TEXT{$button} . "] ");
$about .= <<EOT;
</td>
<td align="center">
$button
</td>
<td>
$T2H_BUTTONS_GOTO{$button}
</td>
</tr>
EOT
}
$about .= <<EOT;
</table>
<p></p>
where the <strong> Example </strong> assumes that the current position
is at <strong> Subsubsection One-Two-Three </strong> of a document of
the following structure:
<ul>
<li> 1. Section One </li>
<ul>
<li>1.1 Subsection One-One</li>
<ul>
<li> ... </li>
</ul>
<li>1.2 Subsection One-Two</li>
<ul>
<li>1.2.1 Subsubsection One-Two-One
</li><li>1.2.2 Subsubsection One-Two-Two
</li><li>1.2.3 Subsubsection One-Two-Three &nbsp; &nbsp; <strong>
&lt;== Current Position </strong>
</li><li>1.2.4 Subsubsection One-Two-Four
</li></ul>
<li>1.3 Subsection One-Three</li>
<ul>
<li> ... </li>
</ul>
<li>1.4 Subsection One-Four</li>
</ul>
</ul>
$T2H_AFTER_ABOUT
EOT
return $about;
}
%T2H_BUTTONS_GOTO =
(
'Top', 'cover (top) of document',
'Contents', 'table of contents',
'Overview', 'short table of contents',
'Index', 'concept index',
'Back', 'previous section in reading order',
'FastBack', 'previous or up-and-previous section ',
'Prev', 'previous section same level',
'Up', 'up section',
'Next', 'next section same level',
'Forward', 'next section in reading order',
'FastForward', 'next or up-and-next section',
'About' , 'this page',
'First', 'first section in reading order',
'Last', 'last section in reading order',
);
#
# Options controlling Titles, File-Names, Tracing and Sectioning
#
$TITLE = '';
$SHORTEXTN = 0;
$LONG_TITLES = 0;
$DESTDIR = ''; # should be overwritten by cmd-line argument
$NO_SUBDIR = 0;# should be overwritten by cmd-line argument
$PREFIX = ''; # should be overwritten by cmd-line argument
$AUTO_PREFIX = 0; # this is needed, so that prefix settings are used
$AUTO_LINK = 0;
$SPLIT = 0;
$MAX_LINK_DEPTH = 0;
$TMP = ''; # should be overwritten by cmd-line argument
$DEBUG = 0;
$VERBOSE = 1;
#
# Options controlling Extensions and Special Features
#
$HTML_VERSION = "3.2";
$TEXDEFS = 1; # we absolutely need that
$EXTERNAL_FILE = '';
$SCALABLE_FONTS = 1;
$NO_SIMPLE_MATH = 1;
$LOCAL_ICONS = 1;
$SHORT_INDEX = 0;
$NO_FOOTNODE = 1;
$ADDRESS = '';
$INFO = '';
#
# Switches controlling Image Generation
#
$ASCII_MODE = 0;
$NOLATEX = 0;
$EXTERNAL_IMAGES = 0;
$PS_IMAGES = 0;
$NO_IMAGES = 0;
$IMAGES_ONLY = 0;
$REUSE = 2;
$ANTI_ALIAS = 1;
$ANTI_ALIAS_TEXT = 1;
#
#Switches controlling Navigation Panels
#
$NO_NAVIGATION = 1;
$ADDRESS = '';
$INFO = 0; # 0 = do not make a "About this document..." section
#
#Switches for Linking to other documents
#
# actuall -- we don't care
$MAX_SPLIT_DEPTH = 0; # Stop making separate files at this depth
$MAX_LINK_DEPTH = 0; # Stop showing child nodes at this depth
$NOLATEX = 0; # 1 = do not pass unknown environments to Latex
$EXTERNAL_IMAGES = 0; # 1 = leave the images outside the document
$ASCII_MODE = 0; # 1 = do not use any icons or internal images
# 1 = use links to external postscript images rather than inlined bitmap
# images.
$PS_IMAGES = 0;
$SHOW_SECTION_NUMBERS = 0;
### Other global variables ###############################################
$CHILDLINE = "";
# This is the line width measured in pixels and it is used to right justify
# equations and equation arrays;
$LINE_WIDTH = 500;
# Used in conjunction with AUTO_NAVIGATION
$WORDS_IN_PAGE = 300;
# Affects ONLY the way accents are processed
$default_language = 'english';
# The value of this variable determines how many words to use in each
# title that is added to the navigation panel (see below)
#
$WORDS_IN_NAVIGATION_PANEL_TITLES = 0;
# This number will determine the size of the equations, special characters,
# and anything which will be converted into an inlined image
# *except* "image generating environments" such as "figure", "table"
# or "minipage".
# Effective values are those greater than 0.
# Sensible values are between 0.1 - 4.
$MATH_SCALE_FACTOR = 1.5;
# This number will determine the size of
# image generating environments such as "figure", "table" or "minipage".
# Effective values are those greater than 0.
# Sensible values are between 0.1 - 4.
$FIGURE_SCALE_FACTOR = 1.6;
# If both of the following two variables are set then the "Up" button
# of the navigation panel in the first node/page of a converted document
# will point to $EXTERNAL_UP_LINK. $EXTERNAL_UP_TITLE should be set
# to some text which describes this external link.
$EXTERNAL_UP_LINK = "";
$EXTERNAL_UP_TITLE = "";
# If this is set then the resulting HTML will look marginally better if viewed
# with Netscape.
$NETSCAPE_HTML = 1;
# Valid paper sizes are "letter", "legal", "a4","a3","a2" and "a0"
# Paper sizes has no effect other than in the time it takes to create inlined
# images and in whether large images can be created at all ie
# - larger paper sizes *MAY* help with large image problems
# - smaller paper sizes are quicker to handle
$PAPERSIZE = "a4";
# Replace "english" with another language in order to tell LaTeX2HTML that you
# want some generated section titles (eg "Table of Contents" or "References")
# to appear in a different language. Currently only "english" and "french"
# is supported but it is very easy to add your own. See the example in the
# file "latex2html.config"
$TITLES_LANGUAGE = "english";
1; # This must be the last non-comment line
# End File texi2html.init
######################################################################
#+++############################################################################
# #
# Initialization #
# Pasted content of File $(srcdir)/MySimple.pm: Command-line processing #
# #
#---############################################################################
# leave this within comments, and keep the require statement
# This way, you can directly run texi2html.pl, if $ENV{T2H_HOME}/texi2html.init
# exists.
#
package Getopt::MySimple;
# Name:
# Getopt::MySimple.
#
# Documentation:
# POD-style (incomplete) documentation is in file MySimple.pod
#
# Tabs:
# 4 spaces || die.
#
# Author:
# Ron Savage rpsavage@ozemail.com.au.
# 1.00 19-Aug-97 Initial version.
# 1.10 13-Oct-97 Add arrays of switches (eg '=s@').
# 1.20 3-Dec-97 Add 'Help' on a per-switch basis.
# 1.30 11-Dec-97 Change 'Help' to 'verbose'. Make all hash keys lowercase.
# 1.40 10-Nov-98 Change width of help report. Restructure tests.
# 1-Jul-00 Modifications for Texi2html
# --------------------------------------------------------------------------
# Locally modified by obachman (Display type instead of env, order by cmp)
# $Id: MySimple.pm,v 1.1 2000/07/03 08:44:13 obachman Exp $
# use strict;
# no strict 'refs';
use vars qw(@EXPORT @EXPORT_OK @ISA);
use vars qw($fieldWidth $opt $VERSION);
use Exporter();
use Getopt::Long;
@ISA = qw(Exporter);
@EXPORT = qw();
@EXPORT_OK = qw($opt); # An alias for $self -> {'opt'}.
# --------------------------------------------------------------------------
$fieldWidth = 20;
$VERSION = '1.41';
# --------------------------------------------------------------------------
sub byOrder
{
my($self) = @_;
return uc($a) cmp (uc($b));
}
# --------------------------------------------------------------------------
sub dumpOptions
{
my($self) = @_;
print 'Option', ' ' x ($fieldWidth - length('Option') ), "Value\n";
for (sort byOrder keys(%{$self -> {'opt'} }) )
{
print "-$_", ' ' x ($fieldWidth - (1 + length) ), "${$self->{'opt'} }{$_}\n";
}
print "\n";
} # End of dumpOptions.
# --------------------------------------------------------------------------
# Return:
# 0 -> Error.
# 1 -> Ok.
sub getOptions
{
push(@_, 0) if ($#_ == 2); # Default for $ignoreCase is 0.
push(@_, 1) if ($#_ == 3); # Default for $helpThenExit is 1.
my($self, $default, $helpText, $versionText,
$helpThenExit, $versionThenExit, $ignoreCase) = @_;
$helpThenExit = 1 unless (defined($helpThenExit));
$versionThenExit = 1 unless (defined($versionThenExit));
$ignoreCase = 0 unless (defined($ignoreCase));
$self -> {'default'} = $default;
$self -> {'helpText'} = $helpText;
$self -> {'versionText'} = $versionText;
$Getopt::Long::ignorecase = $ignoreCase;
unless (defined($self -> {'default'}{'help'}))
{
$self -> {'default'}{'help'} =
{
type => ':i',
default => '',
linkage => sub {$self->helpOptions($_[1]); exit (0) if $helpThenExit;},
verbose => "print help and exit"
};
}
unless (defined($self -> {'default'}{'version'}))
{
$self -> {'default'}{'version'} =
{
type => '',
default => '',
linkage => sub {print $self->{'versionText'}; exit (0) if versionTheExit;},
verbose => "print version and exit"
};
}
for (keys(%{$self -> {'default'} }) )
{
my $type = ${$self -> {'default'} }{$_}{'type'};
push(@{$self -> {'type'} }, "$_$type");
$self->{'opt'}->{$_} = ${$self -> {'default'} }{$_}{'linkage'}
if ${$self -> {'default'} }{$_}{'linkage'};
}
my($result) = &GetOptions($self -> {'opt'}, @{$self -> {'type'} });
return $result unless $result;
for (keys(%{$self -> {'default'} }) )
{
if (! defined(${$self -> {'opt'} }{$_})) #{
{
${$self -> {'opt'} }{$_} = ${$self -> {'default'} }{$_}{'default'};
}
}
$result;
} # End of getOptions.
# --------------------------------------------------------------------------
sub helpOptions
{
my($self) = shift;
my($noHelp) = shift;
$noHelp = 0 unless $noHelp;
my($optwidth, $typewidth, $defaultwidth, $maxlinewidth, $valind, $valwidth)
= (10, 5, 9, 78, 4, 11);
print "$self->{'helpText'}" if ($self -> {'helpText'});
print ' Option', ' ' x ($optwidth - length('Option') -1 ),
'Type', ' ' x ($typewidth - length('Type') + 1),
'Default', ' ' x ($defaultwidth - length('Default') ),
"Description\n";
for (sort byOrder keys(%{$self -> {'default'} }) )
{
my($line, $help, $option, $val);
$option = $_;
next if ${$self->{'default'} }{$_}{'noHelp'} && ${$self->{'default'} }{$_}{'noHelp'} > $noHelp;
$line = " -$_ " . ' ' x ($optwidth - (2 + length) ) .
"${$self->{'default'} }{$_}{'type'} ".
' ' x ($typewidth - (1+length(${$self -> {'default'} }{$_}{'type'}) ));
$val = ${$self->{'default'} }{$_}{'linkage'};
if ($val)
{
if (ref($val) eq 'SCALAR')
{
$val = $$val;
}
else
{
$val = '';
}
}
else
{
$val = ${$self->{'default'} }{$_}{'default'};
}
$line .= "$val ";
$line .= ' ' x ($optwidth + $typewidth + $defaultwidth + 1 - length($line));
if (defined(${$self -> {'default'} }{$_}{'verbose'}) &&
${$self -> {'default'} }{$_}{'verbose'} ne '')
{
$help = "${$self->{'default'} }{$_}{'verbose'}";
}
else
{
$help = ' ';
}
if ((length("$line") + length($help)) < $maxlinewidth)
{
print $line , $help, "\n";
}
else
{
print $line, "\n", ' ' x $valind, $help, "\n";
}
for $val (sort byOrder keys(%{${$self->{'default'}}{$option}{'values'}}))
{
print ' ' x ($valind + 2);
print $val, ' ', ' ' x ($valwidth - length($val) - 2);
print ${$self->{'default'}}{$option}{'values'}{$val}, "\n";
}
}
print <<EOT;
Note: 'Options' may be abbreviated. 'Type' specifications mean:
<none>| ! no argument: variable is set to 1 on -foo (or, to 0 on -nofoo)
=s | :s mandatory (or, optional) string argument
=i | :i mandatory (or, optional) integer argument
EOT
} # End of helpOptions.
#-------------------------------------------------------------------
sub new
{
my($class) = @_;
my($self) = {};
$self -> {'default'} = {};
$self -> {'helpText'} = '';
$self -> {'opt'} = {};
$opt = $self -> {'opt'}; # An alias for $self -> {'opt'}.
$self -> {'type'} = ();
return bless $self, $class;
} # End of new.
# --------------------------------------------------------------------------
1;
# End MySimple.pm
package main;
#+++############################################################################
# #
# Constants #
# #
#---############################################################################
$DEBUG_TOC = 1;
$DEBUG_INDEX = 2;
$DEBUG_BIB = 4;
$DEBUG_GLOSS = 8;
$DEBUG_DEF = 16;
$DEBUG_HTML = 32;
$DEBUG_USER = 64;
$BIBRE = '\[[\w\/-]+\]'; # RE for a bibliography reference
$FILERE = '[\/\w.+-]+'; # RE for a file name
$VARRE = '[^\s\{\}]+'; # RE for a variable name
$NODERE = '[^,:]+'; # RE for a node name
$NODESRE = '[^:]+'; # RE for a list of node names
$ERROR = "***"; # prefix for errors
$WARN = "**"; # prefix for warnings
# program home page
$PROTECTTAG = "_ThisIsProtected_"; # tag to recognize protected sections
$CHAPTEREND = "<!-- End chapter -->\n"; # to know where a chpater ends
$SECTIONEND = "<!-- End section -->\n"; # to know where section ends
$TOPEND = "<!-- End top -->\n"; # to know where top ends
#
# pre-defined indices
#
$index_properties =
{
'c' => { name => 'cp'},
'f' => { name => 'fn', code => 1},
'v' => { name => 'vr', code => 1},
'k' => { name => 'ky', code => 1},
'p' => { name => 'pg', code => 1},
't' => { name => 'tp', code => 1}
};
%predefined_index = (
'cp', 'c',
'fn', 'f',
'vr', 'v',
'ky', 'k',
'pg', 'p',
'tp', 't',
);
#
# valid indices
#
%valid_index = (
'c', 1,
'f', 1,
'v', 1,
'k', 1,
'p', 1,
't', 1,
);
#
# texinfo section names to level
#
%sec2level = (
'top', 0,
'chapter', 1,
'unnumbered', 1,
'majorheading', 1,
'chapheading', 1,
'appendix', 1,
'section', 2,
'unnumberedsec', 2,
'heading', 2,
'appendixsec', 2,
'appendixsection', 2,
'subsection', 3,
'unnumberedsubsec', 3,
'subheading', 3,
'appendixsubsec', 3,
'subsubsection', 4,
'unnumberedsubsubsec', 4,
'subsubheading', 4,
'appendixsubsubsec', 4,
);
#
# accent map, TeX command to ISO name
#
%accent_map = (
'"', 'uml',
'~', 'tilde',
'^', 'circ',
'`', 'grave',
'\'', 'acute',
);
#
# texinfo "simple things" (@foo) to HTML ones
#
%simple_map = (
# cf. makeinfo.c
"*", "<br>", # HTML+
" ", " ",
"\t", " ",
"-", "&#173;", # soft hyphen
"\n", "\n",
"|", "",
'tab', '<\/td><td>',
# spacing commands
":", "",
"!", "!",
"?", "?",
".", ".",
"-", "",
);
#
# texinfo "things" (@foo{}) to HTML ones
#
%things_map = (
'TeX', 'TeX',
'br', '<p>', # paragraph break
'bullet', '*',
'copyright', '(C)',
'dots', '<small>...<\/small>',
'enddots', '<small>....<\/small>',
'equiv', '==',
'error', 'error-->',
'expansion', '==>',
'minus', '-',
'point', '-!-',
'print', '-|',
'result', '=>',
'today', $T2H_TODAY,
'aa', '&aring;',
'AA', '&Aring;',
'ae', '&aelig;',
'oe', '&#156;',
'AE', '&AElig;',
'OE', '&#140;',
'o', '&oslash;',
'O', '&Oslash;',
'ss', '&szlig;',
'l', '\/l',
'L', '\/L',
'exclamdown', '&iexcl;',
'questiondown', '&iquest;',
'pounds', '&pound;'
);
#
# texinfo styles (@foo{bar}) to HTML ones
#
%style_map = (
'acronym', '&do_acronym',
'asis', '',
'b', 'B',
'cite', 'CITE',
'code', 'CODE',
'command', 'CODE',
'ctrl', '&do_ctrl', # special case
'dfn', 'EM', # DFN tag is illegal in the standard
'dmn', '', # useless
'email', '&do_email', # insert a clickable email address
'emph', 'EM',
'env', 'CODE',
'file', '"TT', # will put quotes, cf. &apply_style
'i', 'I',
'kbd', 'KBD',
'key', 'KBD',
'math', '&do_math',
'option', '"SAMP', # will put quotes, cf. &apply_style
'r', '', # unsupported
'samp', '"SAMP', # will put quotes, cf. &apply_style
'sc', '&do_sc', # special case
'strong', 'STRONG',
't', 'TT',
'titlefont', '', # useless
'uref', '&do_uref', # insert a clickable URL
'url', '&do_url', # insert a clickable URL
'var', 'VAR',
'w', '', # unsupported
'H', '&do_accent',
'dotaccent', '&do_accent',
'ringaccent','&do_accent',
'tieaccent', '&do_accent',
'u','&do_accent',
'ubaraccent','&do_accent',
'udotaccent','&do_accent',
'v', '&do_accent',
',', '&do_accent',
'dotless', '&do_accent'
);
#
# texinfo format (@foo/@end foo) to HTML ones
#
%format_map = (
'quotation', 'blockquote',
# lists
'itemize', 'ul',
'enumerate', 'ol',
# poorly supported
'flushleft', 'pre',
'flushright', 'pre',
);
#
# an eval of these $complex_format_map->{what}->[0] yields beginning
# an eval of these $complex_format_map->{what}->[1] yieleds end
$complex_format_map =
{
example =>
[
q{"<table><tr>$T2H_EXAMPLE_INDENT_CELL<td class=example><pre>"},
q{'</pre></td></tr></table>'}
],
smallexample =>
[
q{"<table><tr>$T2H_SMALL_EXAMPLE_INDENT_CELL<td class=smallexample><font size=$T2H_SMALL_FONT_SIZE><pre>"},
q{'</font></pre></td></tr></table>'}
],
display =>
[
q{"<table><tr>$T2H_EXAMPLE_INDENT_CELL<td class=display><pre " . 'style="font-family: serif">'},
q{'</pre></td></tr></table>'}
],
smalldisplay =>
[
q{"<table><tr>$T2H_SMALL_EXAMPLE_INDENT_CELL<td class=smalldisplay><font size=$T2H_SMALL_FONT_SIZE><pre " . 'style="font-family: serif">'},
q{'</pre></font></td></tr></table>'}
]
};
$complex_format_map->{lisp} = $complex_format_map->{example};
$complex_format_map->{smalllisp} = $complex_format_map->{smallexample};
$complex_format_map->{format} = $complex_format_map->{display};
$complex_format_map->{smallformat} = $complex_format_map->{smalldisplay};
#
# texinfo definition shortcuts to real ones
#
%def_map = (
# basic commands
'deffn', 0,
'defvr', 0,
'deftypefn', 0,
'deftypevr', 0,
'defcv', 0,
'defop', 0,
'deftp', 0,
# basic x commands
'deffnx', 0,
'defvrx', 0,
'deftypefnx', 0,
'deftypevrx', 0,
'defcvx', 0,
'defopx', 0,
'deftpx', 0,
# shortcuts
'defun', 'deffn Function',
'defmac', 'deffn Macro',
'defspec', 'deffn {Special Form}',
'defvar', 'defvr Variable',
'defopt', 'defvr {User Option}',
'deftypefun', 'deftypefn Function',
'deftypevar', 'deftypevr Variable',
'defivar', 'defcv {Instance Variable}',
'deftypeivar', 'defcv {Instance Variable}', # NEW: FIXME
'defmethod', 'defop Method',
'deftypemethod', 'defop Method', # NEW:FIXME
# x shortcuts
'defunx', 'deffnx Function',
'defmacx', 'deffnx Macro',
'defspecx', 'deffnx {Special Form}',
'defvarx', 'defvrx Variable',
'defoptx', 'defvrx {User Option}',
'deftypefunx', 'deftypefnx Function',
'deftypevarx', 'deftypevrx Variable',
'defivarx', 'defcvx {Instance Variable}',
'defmethodx', 'defopx Method',
);
#
# things to skip
#
%to_skip = (
# comments
'c', 1,
'comment', 1,
'ifhtml', 1,
'end ifhtml', 1,
# useless
'detailmenu', 1,
'direntry', 1,
'contents', 1,
'shortcontents', 1,
'summarycontents', 1,
'footnotestyle', 1,
'end ifclear', 1,
'end ifset', 1,
'titlepage', 1,
'end titlepage', 1,
# unsupported commands (formatting)
'afourpaper', 1,
'cropmarks', 1,
'finalout', 1,
'headings', 1,
'sp', 1,
'need', 1,
'page', 1,
'setchapternewpage', 1,
'everyheading', 1,
'everyfooting', 1,
'evenheading', 1,
'evenfooting', 1,
'oddheading', 1,
'oddfooting', 1,
'smallbook', 1,
'vskip', 1,
'filbreak', 1,
'paragraphindent', 1,
# unsupported formats
'cartouche', 1,
'end cartouche', 1,
'group', 1,
'end group', 1,
);
#+++############################################################################
# #
# Argument parsing, initialisation #
# #
#---############################################################################
#
# flush stdout and stderr after every write
#
select(STDERR);
$| = 1;
select(STDOUT);
$| = 1;
%value = (); # hold texinfo variables, see also -D
$use_bibliography = 1;
$use_acc = 1;
#
# called on -init-file
sub LoadInitFile
{
my $init_file = shift;
# second argument is value of options
$init_file = shift;
if (-f $init_file)
{
print "# reading initialization file from $init_file\n"
if ($T2H_VERBOSE);
require($init_file);
}
else
{
print "$ERROR Error: can't read init file $int_file\n";
$init_file = '';
}
}
#
# called on -lang
sub SetDocumentLanguage
{
my $lang = shift;
if (! exists($T2H_WORDS->{$lang}))
{
warn "$ERROR: Language specs for '$lang' do not exists. Reverting to '" .
($T2H_LANG ? T2H_LANG : "en") . "'\n";
}
else
{
print "# using '$lang' as document language\n" if ($T2H_VERBOSE);
$T2H_LANG = $lang;
}
}
##
## obsolete cmd line options
##
$T2H_OBSOLETE_OPTIONS -> {'no-section_navigation'} =
{
type => '!',
linkage => sub {$main::T2H_SECTION_NAVIGATION = 0;},
verbose => 'obsolete, use -nosec_nav',
noHelp => 2,
};
$T2H_OBSOLETE_OPTIONS -> {use_acc} =
{
type => '!',
linkage => \$use_acc,
verbose => 'obsolete',
noHelp => 2
};
$T2H_OBSOLETE_OPTIONS -> {expandinfo} =
{
type => '!',
linkage => sub {$main::T2H_EXPAND = 'info';},
verbose => 'obsolete, use "-expand info" instead',
noHelp => 2,
};
$T2H_OBSOLETE_OPTIONS -> {expandtex} =
{
type => '!',
linkage => sub {$main::T2H_EXPAND = 'tex';},
verbose => 'obsolete, use "-expand tex" instead',
noHelp => 2,
};
$T2H_OBSOLETE_OPTIONS -> {monolithic} =
{
type => '!',
linkage => sub {$main::T2H_SPLIT = '';},
verbose => 'obsolete, use "-split no" instead',
noHelp => 2
};
$T2H_OBSOLETE_OPTIONS -> {split_node} =
{
type => '!',
linkage => sub{$main::T2H_SPLIT = 'section';},
verbose => 'obsolete, use "-split section" instead',
noHelp => 2,
};
$T2H_OBSOLETE_OPTIONS -> {split_chapter} =
{
type => '!',
linkage => sub{$main::T2H_SPLIT = 'chapter';},
verbose => 'obsolete, use "-split chapter" instead',
noHelp => 2,
};
$T2H_OBSOLETE_OPTIONS -> {no_verbose} =
{
type => '!',
linkage => sub {$main::T2H_VERBOSE = 0;},
verbose => 'obsolete, use -noverbose instead',
noHelp => 2,
};
$T2H_OBSOLETE_OPTIONS -> {output_file} =
{
type => '=s',
linkage => sub {$main::T2H_OUT = @_[1]; $T2H_SPLIT = '';},
verbose => 'obsolete, use -out_file instead',
noHelp => 2
};
$T2H_OBSOLETE_OPTIONS -> {section_navigation} =
{
type => '!',
linkage => \$T2H_SECTION_NAVIGATION,
verbose => 'obsolete, use -sec_nav instead',
noHelp => 2,
};
$T2H_OBSOLETE_OPTIONS -> {verbose} =
{
type => '!',
linkage => \$T2H_VERBOSE,
verbose => 'obsolete, use -Verbose instead',
noHelp => 2
};
# read initialzation from $sysconfdir/texi2htmlrc or $HOME/.texi2htmlrc
my $home = $ENV{HOME};
defined($home) or $home = '';
foreach $i ('/usr/local/etc/texi2htmlrc', "$home/.texi2htmlrc") {
if (-f $i) {
print "# reading initialization file from $i\n"
if ($T2H_VERBOSE);
require($i);
}
}
#+++############################################################################
# #
# parse command-line options
# #
#---############################################################################
$T2H_USAGE_TEXT = <<EOT;
Usage: texi2html [OPTIONS] TEXINFO-FILE
Translates Texinfo source documentation to HTML.
EOT
$T2H_FAILURE_TEXT = <<EOT;
Try 'texi2html -help' for usage instructions.
EOT
$options = new Getopt::MySimple;
# some older version of GetOpt::Long don't have
# Getopt::Long::Configure("pass_through")
eval {Getopt::Long::Configure("pass_through");};
$Configure_failed = $@ && <<EOT;
**WARNING: Parsing of obsolete command-line options could have failed.
Consider to use only documented command-line options (run
'texi2html -help 2' for a complete list) or upgrade to perl
version 5.005 or higher.
EOT
if (! $options->getOptions($T2H_OPTIONS, $T2H_USAGE_TEXT, "$THISVERSION\n"))
{
print $Configure_failed if $Configure_failed;
die $T2H_FAILURE_TEXT;
}
if (@ARGV > 1)
{
eval {Getopt::Long::Configure("no_pass_through");};
if (! $options->getOptions($T2H_OBSOLETE_OPTIONS, $T2H_USAGE_TEXT, "$THISVERSION\n"))
{
print $Configure_failed if $Configure_failed;
die $T2H_FAILURE_TEXT;
}
}
if ($T2H_CHECK) {
die "Need file to check\n$T2H_FAILURE_TEXT" unless @ARGV > 0;
&check;
exit;
}
#+++############################################################################
# #
# evaluation of cmd line options
# #
#---############################################################################
$T2H_EXPAND = "html" if $T2H_EXPAND eq "none";
foreach $i ('info', 'html', 'tex') {
if ($T2H_EXPAND eq $i) {
$to_skip{"if$i"} = 1;
$to_skip{"end if$i"} = 1;
}
else {
$to_skip{"ifnot$i"} = 1;
$to_skip{"end ifnot$i"} = 1;
}
}
$T2H_INVISIBLE_MARK = '<img src="invisible.xbm">' if $T2H_INVISIBLE_MARK eq 'xbm';
#
# file name buisness
#
die "Need exactly one file to translate\n$T2H_FAILURE_TEXT" unless @ARGV == 1;
$docu = shift(@ARGV);
if ($docu =~ /.*\//) {
chop($docu_dir = $&);
$docu_name = $';
} else {
$docu_dir = '.';
$docu_name = $docu;
}
unshift(@T2H_INCLUDE_DIRS, $docu_dir);
$docu_name =~ s/\.te?x(i|info)?$//; # basename of the document
$docu_name = $T2H_PREFIX if ($T2H_PREFIX);
# subdir
if ($T2H_SUBDIR && ! $T2H_OUT)
{
$T2H_SUBDIR =~ s|/*$||;
unless (-d "$T2H_SUBDIR" && -w "$T2H_SUBDIR")
{
if ( mkdir($T2H_SUBDIR, oct(755)))
{
print "# created directory $T2H_SUBDIR\n" if ($T2H_VERBOSE);
}
else
{
warn "$ERROR can't create directory $T2H_SUBDIR. Put results into current directory\n";
$T2H_SUBDIR = '';
}
}
}
if ($T2H_SUBDIR && ! $T2H_OUT)
{
$docu_rdir = "$T2H_SUBDIR/";
print "# putting result files into directory $docu_rdir\n" if ($T2H_VERBOSE);
}
else
{
if ($T2H_OUT && $T2H_OUT =~ m|(.*)/|)
{
$docu_rdir = "$1/";
print "# putting result files into directory $docu_rdir\n" if ($T2H_VERBOSE);
}
else
{
print "# putting result files into current directory \n" if ($T2H_VERBOSE);
$docu_rdir = '';
}
}
# extension
if ($T2H_SHORTEXTN)
{
$docu_ext = "htm";
}
else
{
$docu_ext = "html";
}
if ($T2H_TOP_FILE =~ /\..*$/)
{
$T2H_TOP_FILE = $`.".$docu_ext";
}
# result files
if (! $T2H_OUT && ($T2H_SPLIT =~ /section/i || $T2H_SPLIT =~ /node/i))
{
$T2H_SPLIT = 'section';
}
elsif (! $T2H_OUT && $T2H_SPLIT =~ /chapter/i)
{
$T2H_SPLIT = 'chapter'
}
else
{
undef $T2H_SPLIT;
}
$docu_doc = "$docu_name.$docu_ext"; # document's contents
$docu_doc_file = "$docu_rdir$docu_doc";
if ($T2H_SPLIT)
{
$docu_toc = $T2H_TOC_FILE || "${docu_name}_toc.$docu_ext"; # document's table of contents
$docu_stoc = "${docu_name}_ovr.$docu_ext"; # document's short toc
$docu_foot = "${docu_name}_fot.$docu_ext"; # document's footnotes
$docu_about = "${docu_name}_abt.$docu_ext"; # about this document
$docu_top = $T2H_TOP_FILE || $docu_doc;
}
else
{
if ($T2H_OUT)
{
$docu_doc = $T2H_OUT;
$docu_doc =~ s|.*/||;
}
$docu_toc = $docu_foot = $docu_stoc = $docu_about = $docu_top = $docu_doc;
}
$docu_toc_file = "$docu_rdir$docu_toc";
$docu_stoc_file = "$docu_rdir$docu_stoc";
$docu_foot_file = "$docu_rdir$docu_foot";
$docu_about_file = "$docu_rdir$docu_about";
$docu_top_file = "$docu_rdir$docu_top";
$docu_frame_file = "$docu_rdir${docu_name}_frame.$docu_ext";
$docu_toc_frame_file = "$docu_rdir${docu_name}_toc_frame.$docu_ext";
#
# variables
#
$value{'html'} = 1; # predefine html (the output format)
$value{'texi2html'} = $THISVERSION; # predefine texi2html (the translator)
# _foo: internal to track @foo
foreach ('_author', '_title', '_subtitle',
'_settitle', '_setfilename', '_shorttitle') {
$value{$_} = ''; # prevent -w warnings
}
%node2sec = (); # node to section name
%sec2node = (); # section to node name
%sec2number = (); # section to number
%number2sec = (); # number to section
%idx2node = (); # index keys to node
%node2href = (); # node to HREF
%node2next = (); # node to next
%node2prev = (); # node to prev
%node2up = (); # node to up
%bib2href = (); # bibliography reference to HREF
%gloss2href = (); # glossary term to HREF
@sections = (); # list of sections
%tag2pro = (); # protected sections
#
# initial indexes
#
$bib_num = 0;
$foot_num = 0;
$gloss_num = 0;
$idx_num = 0;
$sec_num = 0;
$doc_num = 0;
$html_num = 0;
#
# can I use ISO8879 characters? (HTML+)
#
if ($T2H_USE_ISO) {
$things_map{'bullet'} = "&bull;";
$things_map{'copyright'} = "&copy;";
$things_map{'dots'} = "&hellip;";
$things_map{'equiv'} = "&equiv;";
$things_map{'expansion'} = "&rarr;";
$things_map{'point'} = "&lowast;";
$things_map{'result'} = "&rArr;";
}
print "# reading from $docu\n" if $T2H_VERBOSE;
#+++############################################################################
# #
# Pass 1: read source, handle command, variable, simple substitution #
# #
#---############################################################################
@lines = (); # whole document
@toc_lines = (); # table of contents
@stoc_lines = (); # table of contents
$curlevel = 0; # current level in TOC
$node = ''; # current node name
$node_next = ''; # current node next name
$node_prev = ''; # current node prev name
$node_up = ''; # current node up name
$in_table = 0; # am I inside a table
$table_type = ''; # type of table ('', 'f', 'v', 'multi')
@tables = (); # nested table support
$in_bibliography = 0; # am I inside a bibliography
$in_glossary = 0; # am I inside a glossary
$in_top = 0; # am I inside the top node
$has_top = 0; # did I see a top node?
$has_top_command = 0; # did I see @top for automatic pointers?
$in_pre = 0; # am I inside a preformatted section
$in_list = 0; # am I inside a list
$in_html = 0; # am I inside an HTML section
$first_line = 1; # is it the first line
$dont_html = 0; # don't protect HTML on this line
$deferred_ref = ''; # deferred reference for indexes
@html_stack = (); # HTML elements stack
$html_element = ''; # current HTML element
&html_reset;
%macros = (); # macros
# build code for simple substitutions
# the maps used (%simple_map and %things_map) MUST be aware of this
# watch out for regexps, / and escaped characters!
$subst_code = '';
foreach (keys(%simple_map)) {
($re = $_) =~ s/(\W)/\\$1/g; # protect regexp chars
$subst_code .= "s/\\\@$re/$simple_map{$_}/g;\n";
}
foreach (keys(%things_map)) {
$subst_code .= "s/\\\@$_\\{\\}/$things_map{$_}/g;\n";
}
if ($use_acc) {
# accentuated characters
foreach (keys(%accent_map)) {
if ($_ eq "`") {
$subst_code .= "s/$;3";
} elsif ($_ eq "'") {
$subst_code .= "s/$;4";
} else {
$subst_code .= "s/\\\@\\$_";
}
$subst_code .= "([a-z])/&\${1}$accent_map{$_};/gi;\n";
}
}
eval("sub simple_substitutions { $subst_code }");
&init_input;
INPUT_LINE: while ($_ = &next_line) {
#
# remove \input on the first lines only
#
if ($first_line) {
next if /^\\input/;
$first_line = 0;
}
# non-@ substitutions cf. texinfmt.el
#
# parse texinfo tags
#
$tag = '';
$end_tag = '';
if (/^\s*\@end\s+(\w+)\b/) {
$end_tag = $1;
} elsif (/^\s*\@(\w+)\b/) {
$tag = $1;
}
#
# handle @html / @end html
#
if ($in_html) {
if ($end_tag eq 'html') {
$in_html = 0;
} else {
$tag2pro{$in_html} .= $_;
}
next;
} elsif ($tag eq 'html') {
$in_html = $PROTECTTAG . ++$html_num;
push(@lines, $in_html);
next;
}
#
# try to remove inlined comments
# syntax from tex-mode.el comment-start-skip
#
s/((^|[^\@])(\@\@)*)\@c(omment | |\{|$).*/$1/;
# Sometimes I use @c right at the end of a line ( to suppress the line feed )
# s/((^|[^\@])(\@\@)*)\@c(omment)?$/$1/;
# s/((^|[^\@])(\@\@)*)\@c(omment)? .*/$1/;
# s/(.*)\@c{.*?}(.*)/$1$2/;
# s/(.*)\@comment{.*?}(.*)/$1$2/;
# s/^(.*)\@c /$1/;
# s/^(.*)\@comment /$1/;
#############################################################
# value substitution before macro expansion, so that
# it works in macro arguments
s/\@value{($VARRE)}/$value{$1}/eg;
#############################################################
# macro substitution
while (/\@(\w+)/g)
{
if (exists($macros->{$1}))
{
my $before = $`;
my $name = $1;
my $after = $';
my @args;
my $args;
if ($after =~ /^\s*{(.*?[^\\])}(.*)/)
{
$args = $1;
$after = $2;
}
elsif (@{$macros->{$name}->{Args}} == 1)
{
$args = $after;
$args =~ s/^\s*//;
$args =~ s/\s*$//;
$after = '';
}
$args =~ s|\\\\|\\|g;
$args =~ s|\\{|{|g;
$args =~ s|\\}|}|g;
if (@{$macros->{$name}->{Args}} > 1)
{
$args =~ s/(^|[^\\]),/$1$;/g ;
$args =~ s|\\,|,|g;
@args = split(/$;\s*/, $args) if (@{$macros->{$name}->{Args}} > 1);
}
else
{
$args =~ s|\\,|,|g;
@args = ($args);
}
my $macrobody = $macros->{$name}->{Body};
for ($i=0; $i<=$#args; $i++)
{
$macrobody =~ s|\\$macros->{$name}->{Args}->[$i]\\|$args[$i]|g;
}
$macrobody =~ s|\\\\|\\|g;
$_ = $before . $macrobody . $after;
unshift @input_spool, map {$_ = $_."\n"} split(/\n/, $_);
next INPUT_LINE;
}
} #
#
# try to skip the line
#
if ($end_tag) {
$in_titlepage = 0 if $end_tag eq 'titlepage';
next if $to_skip{"end $end_tag"};
} elsif ($tag) {
$in_titlepage = 1 if $tag eq 'titlepage';
next if $to_skip{$tag};
last if $tag eq 'bye';
}
if ($in_top) {
# parsing the top node
if ($tag eq 'node' ||
($sec2level{$tag} && $tag !~ /unnumbered/ && $tag !~ /heading/))
{
# no more in top
$in_top = 0;
push(@lines, $TOPEND);
}
}
unless ($in_pre) {
s/``/\"/g;
s/''/\"/g;
s/([\w ])---([\w ])/$1--$2/g;
}
#
# analyze the tag
#
if ($tag) {
# skip lines
&skip_until($tag), next if $tag eq 'ignore';
&skip_until($tag), next if $tag eq 'ifnothtml';
if ($tag eq 'ifinfo')
{
&skip_until($tag), next unless $T2H_EXPAND eq 'info';
}
if ($tag eq 'iftex')
{
&skip_until($tag), next unless $T2H_EXPAND eq 'tex';
}
if ($tag eq 'ifnotinfo')
{
&skip_until($tag), next if $T2H_EXPAND eq 'info';
}
if ($tag eq 'ifnottex')
{
&skip_until($tag), next if $T2H_EXPAND eq 'tex';
}
if ($tag eq 'ifhtml')
{
&skip_until($tag), next unless $T2H_EXPAND eq 'html';
}
if ($tag eq 'tex')
{
&skip_until($tag);
next;
}
if ($tag eq 'titlepage')
{
next;
}
# handle special tables
if ($tag =~ /^(|f|v|multi)table$/) {
$table_type = $1;
$tag = 'table';
}
# special cases
if ($tag eq 'top' || ($tag eq 'node' && /^\@node\s+top\s*,/i)) {
$in_top = 1;
$has_top = 1;
$has_top_command = 1 if $tag eq 'top';
@lines = (); # ignore all lines before top (title page garbage)
next;
} elsif ($tag eq 'node') {
if ($in_top)
{
$in_top = 0;
push(@lines, $TOPEND);
}
warn "$ERROR Bad node line: $_" unless $_ =~ /^\@node\s$NODESRE$/o;
# request of "Richard Y. Kim" <ryk@ap.com>
s/^\@node\s+//;
$_ = &protect_html($_); # if node contains '&' for instance
($node, $node_next, $node_prev, $node_up) = split(/,/);
&normalise_node($node);
&normalise_node($node_next);
&normalise_node($node_prev);
&normalise_node($node_up);
$node =~ /\"/ ?
push @lines, &html_debug("<a name='$node'></a>\n", __LINE__) :
push @lines, &html_debug("<a name=\"$node\"></a>\n", __LINE__);
next;
} elsif ($tag eq 'include') {
if (/^\@include\s+($FILERE)\s*$/o) {
$file = LocateIncludeFile($1);
if ($file && -e $file) {
&open($file);
print "# including $file\n" if $T2H_VERBOSE;
} else {
warn "$ERROR Can't find $1, skipping";
}
} else {
warn "$ERROR Bad include line: $_";
}
next;
} elsif ($tag eq 'ifclear') {
if (/^\@ifclear\s+($VARRE)\s*$/o) {
next unless defined($value{$1});
&skip_until($tag);
} else {
warn "$ERROR Bad ifclear line: $_";
}
next;
} elsif ($tag eq 'ifset') {
if (/^\@ifset\s+($VARRE)\s*$/o) {
next if defined($value{$1});
&skip_until($tag);
} else {
warn "$ERROR Bad ifset line: $_";
}
next;
} elsif ($tag eq 'menu') {
unless ($T2H_SHOW_MENU) {
&skip_until($tag);
next;
}
&html_push_if($tag);
push(@lines, &html_debug('', __LINE__));
} elsif ($format_map{$tag}) {
$in_pre = 1 if $format_map{$tag} eq 'pre';
&html_push_if($format_map{$tag});
push(@lines, &html_debug('', __LINE__));
$in_list++ if $format_map{$tag} eq 'ul' || $format_map{$tag} eq 'ol' ;
# push(@lines, &debug("<blockquote>\n", __LINE__))
# if $tag =~ /example/i;
# sunshine@sunshineco.com: <pre>bla</pre> looks better than
# <pre>\nbla</pre> (at least on NeXTstep browser
push(@lines, &debug("<$format_map{$tag}>" .
($in_pre ? '' : "\n"), __LINE__));
next;
}
elsif (exists $complex_format_map->{$tag})
{
my $start = eval $complex_format_map->{$tag}->[0];
if ($@)
{
print "$ERROR: eval of complex_format_map->{$tag}->[0] $complex_format_map->{$tag}->[0]: $@";
$start = '<pre>'
}
$in_pre = 1 if $start =~ /<pre/;
push(@lines, html_debug($start. ($in_pre ? '' : "\n"), __LINE__));
next;
} elsif ($tag eq 'table') {
# anorland@hem2.passagen.se
# if (/^\s*\@(|f|v|multi)table\s+\@(\w+)/) {
if (/^\s*\@(|f|v|multi)table\s+\@(\w+)|(\{[^\}]*\})/) {
$in_table = $2;
unshift(@tables, join($;, $table_type, $in_table));
if ($table_type eq "multi") {
# don't use borders -- gets confused by empty cells
push(@lines, &debug("<table>\n", __LINE__));
&html_push_if('table');
} else {
push(@lines, &debug("<dl compact>\n", __LINE__));
&html_push_if('dl');
}
push(@lines, &html_debug('', __LINE__));
} else {
warn "$ERROR Bad table line: $_";
}
next;
}
elsif ($tag eq 'synindex' || $tag eq 'syncodeindex')
{
if (/^\@$tag\s+(\w+)\s+(\w+)\s*$/)
{
my $from = $1;
my $to = $2;
my $prefix_from = IndexName2Prefix($from);
my $prefix_to = IndexName2Prefix($to);
warn("$ERROR unknown from index name $from ind syn*index line: $_"), next
unless $prefix_from;
warn("$ERROR unknown to index name $to ind syn*index line: $_"), next
unless $prefix_to;
if ($tag eq 'syncodeindex')
{
$index_properties->{$prefix_to}->{'from_code'}->{$prefix_from} = 1;
}
else
{
$index_properties->{$prefix_to}->{'from'}->{$prefix_from} = 1;
}
}
else
{
warn "$ERROR Bad syn*index line: $_";
}
next;
}
elsif ($tag eq 'defindex' || $tag eq 'defcodeindex')
{
if (/^\@$tag\s+(\w+)\s*$/)
{
my $name = $1;
$index_properties->{$name}->{name} = $name;
$index_properties->{$name}->{code} = 1 if $tag eq 'defcodeindex';
}
else
{
warn "$ERROR Bad defindex line: $_";
}
next;
}
elsif (/^\@printindex/)
{
push (@lines, "<!--::${section}::-->$_");
next;
}
elsif ($tag eq 'sp') {
push(@lines, &debug("<p>\n", __LINE__));
next;
} elsif ($tag eq 'center') {
push(@lines, &debug("<center>\n", __LINE__));
s/\@center//;
} elsif ($tag eq 'setref') {
&protect_html; # if setref contains '&' for instance
if (/^\@$tag\s*{($NODERE)}\s*$/) {
$setref = $1;
$setref =~ s/\s+/ /g; # normalize
$setref =~ s/ $//;
$node2sec{$setref} = $name;
$sec2node{$name} = $setref;
$node2href{$setref} = "$docu_doc#$docid";
} else {
warn "$ERROR Bad setref line: $_";
}
next;
} elsif ($tag eq 'lowersections') {
local ($sec, $level);
while (($sec, $level) = each %sec2level) {
$sec2level{$sec} = $level + 1;
}
next;
} elsif ($tag eq 'raisesections') {
local ($sec, $level);
while (($sec, $level) = each %sec2level) {
$sec2level{$sec} = $level - 1;
}
next;
}
elsif ($tag eq 'macro' || $tag eq 'rmacro')
{
if (/^\@$tag\s*(\w+)\s*(.*)/)
{
my $name = $1;
my @args;
@args = split(/\s*,\s*/ , $1)
if ($2 =~ /^\s*{(.*)}\s*/);
$macros->{$name}->{Args} = \@args;
$macros->{$name}->{Body} = '';
while (($_ = &next_line) && $_ !~ /\@end $tag/)
{
$macros->{$name}->{Body} .= $_;
}
die "ERROR: No closing '\@end $tag' found for macro definition of '$name'\n"
unless (/\@end $tag/);
chomp $macros->{$name}->{Body};
}
else
{
warn "$ERROR: Bad macro defintion $_"
}
next;
}
elsif ($tag eq 'unmacro')
{
delete $macros->{$1} if (/^\@unmacro\s*(\w+)/);
next;
}
elsif ($tag eq 'documentlanguage')
{
SetDocumentLanguage($1) if (!$T2H_LANG && /documentlanguage\s*(\w+)/);
}
elsif (defined($def_map{$tag})) {
if ($def_map{$tag}) {
s/^\@$tag\s+//;
$tag = $def_map{$tag};
$_ = "\@$tag $_";
$tag =~ s/\s.*//;
}
} elsif (defined($user_sub{$tag})) {
s/^\@$tag\s+//;
$sub = $user_sub{$tag};
print "# user $tag = $sub, arg: $_" if $T2H_DEBUG & $DEBUG_USER;
if (defined(&$sub)) {
chop($_);
&$sub($_);
} else {
warn "$ERROR Bad user sub for $tag: $sub\n";
}
next;
}
if (defined($def_map{$tag})) {
s/^\@$tag\s+//;
if ($tag =~ /x$/) {
# extra definition line
$tag = $`;
$is_extra = 1;
} else {
$is_extra = 0;
}
while (/\{([^\{\}]*)\}/) {
# this is a {} construct
($before, $contents, $after) = ($`, $1, $');
# protect spaces
$contents =~ s/\s+/$;9/g;
# restore $_ protecting {}
$_ = "$before$;7$contents$;8$after";
}
@args = split(/\s+/, &protect_html($_));
foreach (@args) {
s/$;9/ /g; # unprotect spaces
s/$;7/\{/g; # ... {
s/$;8/\}/g; # ... }
}
$type = shift(@args);
$type =~ s/^\{(.*)\}$/$1/;
print "# def ($tag): {$type} ", join(', ', @args), "\n"
if $T2H_DEBUG & $DEBUG_DEF;
$type .= ':'; # it's nicer like this
my $name = shift(@args);
$name =~ s/^\{(.*)\}$/$1/;
if ($is_extra) {
$_ = &debug("<dt>", __LINE__);
} else {
$_ = &debug("<dl>\n<dt>", __LINE__);
}
if ($tag eq 'deffn' || $tag eq 'defvr' || $tag eq 'deftp') {
$_ .= "<u>$type</u> <b>$name</b>";
$_ .= " <i>@args</i>" if @args;
} elsif ($tag eq 'deftypefn' || $tag eq 'deftypevr'
|| $tag eq 'defcv' || $tag eq 'defop') {
$ftype = $name;
$name = shift(@args);
$name =~ s/^\{(.*)\}$/$1/;
$_ .= "<u>$type</u> $ftype <b>$name</b>";
$_ .= " <i>@args</i>" if @args;
} else {
warn "$ERROR Unknown definition type: $tag\n";
$_ .= "<u>$type</u> <b>$name</b>";
$_ .= " <i>@args</i>" if @args;
}
$_ .= &debug("\n<dd>", __LINE__);
$name = &unprotect_html($name);
if ($tag eq 'deffn' || $tag eq 'deftypefn') {
EnterIndexEntry('f', $name, $docu_doc, $section, \@lines);
# unshift(@input_spool, "\@findex $name\n");
} elsif ($tag eq 'defop') {
EnterIndexEntry('f', "$name on $ftype", $docu_doc, $section, \@lines);
# unshift(@input_spool, "\@findex $name on $ftype\n");
} elsif ($tag eq 'defvr' || $tag eq 'deftypevr' || $tag eq 'defcv') {
EnterIndexEntry('v', $name, $docu_doc, $section, \@lines);
# unshift(@input_spool, "\@vindex $name\n");
} else {
EnterIndexEntry('t', $name, $docu_doc, $section, \@lines);
# unshift(@input_spool, "\@tindex $name\n");
}
$dont_html = 1;
}
} elsif ($end_tag) {
if ($format_map{$end_tag}) {
$in_pre = 0 if $format_map{$end_tag} eq 'pre';
$in_list-- if $format_map{$end_tag} eq 'ul' || $format_map{$end_tag} eq 'ol' ;
&html_pop_if('p');
&html_pop_if('li');
&html_pop_if();
push(@lines, &debug("</$format_map{$end_tag}>\n", __LINE__));
push(@lines, &html_debug('', __LINE__));
}
elsif (exists $complex_format_map->{$end_tag})
{
my $end = eval $complex_format_map->{$end_tag}->[1];
if ($@)
{
print "$ERROR: eval of complex_format_map->{$end_tag}->[1] $complex_format_map->{$end_tag}->[0]: $@";
$end = '</pre>'
}
$in_pre = 0 if $end =~ m|</pre>|;
push(@lines, html_debug($end, __LINE__));
} elsif ($end_tag =~ /^(|f|v|multi)table$/) {
unless (@tables) {
warn "$ERROR \@end $end_tag without \@*table\n";
next;
}
&html_pop_if('p');
($table_type, $in_table) = split($;, shift(@tables));
unless ($1 eq $table_type) {
warn "$ERROR \@end $end_tag without matching \@$end_tag\n";
next;
}
if ($table_type eq "multi") {
push(@lines, "</tr></table>\n");
&html_pop_if('tr');
} else {
push(@lines, "</dl>\n");
&html_pop_if('dd');
}
&html_pop_if();
if (@tables) {
($table_type, $in_table) = split($;, $tables[0]);
} else {
$in_table = 0;
}
} elsif (defined($def_map{$end_tag})) {
push(@lines, &debug("</dl>\n", __LINE__));
} elsif ($end_tag eq 'menu') {
&html_pop_if();
push(@lines, $_); # must keep it for pass 2
}
next;
}
#############################################################
# anchor insertion
while (/\@anchor\s*\{(.*?)\}/)
{
$_ = $`.$';
my $anchor = $1;
$anchor = &normalise_node($anchor);
push @lines, &html_debug("<a name=\"$anchor\"></a>\n");
$node2href{$anchor} = "$docu_doc#$anchor";
next INPUT_LINE if $_ =~ /^\s*$/;
}
#############################################################
# index entry generation, after value substitutions
if (/^\@(\w+?)index\s+/)
{
EnterIndexEntry($1, $', $docu_doc, $section, \@lines);
next;
}
#
# protect texi and HTML things
&protect_texi;
$_ = &protect_html($_) unless $dont_html;
$dont_html = 0;
# substitution (unsupported things)
s/^\@exdent\s+//g;
s/\@noindent\s+//g;
s/\@refill\s+//g;
# other substitutions
&simple_substitutions;
s/\@footnote\{/\@footnote$docu_doc\{/g; # mark footnotes, cf. pass 4
#
# analyze the tag again
#
if ($tag) {
if (defined($sec2level{$tag}) && $sec2level{$tag} > 0) {
if (/^\@$tag\s+(.+)$/) {
$name = $1;
$name = &normalise_node($name);
$level = $sec2level{$tag};
# check for index
$first_index_chapter = $name
if ($level == 1 && !$first_index_chapter &&
$name =~ /index/i);
if ($in_top && /heading/){
$T2H_HAS_TOP_HEADING = 1;
$_ = &debug("<h$level>$name</h$level>\n", __LINE__);
&html_push_if('body');
print "# top heading, section $name, level $level\n"
if $T2H_DEBUG & $DEBUG_TOC;
}
else
{
unless (/^\@\w*heading/)
{
my $here_split = 0;
unless (/^\@unnumbered/)
{
my $number = &update_sec_num($tag, $level);
$name = $number. ' ' . $name if $T2H_NUMBER_SECTIONS;
$sec2number{$name} = $number;
$number2sec{$number} = $name;
}
if (defined($toplevel))
{
if ($level==$toplevel)
{
$here_split = $T2H_SPLIT;
push @lines, $CHAPTEREND;
} else
{
$here_split = $T2H_SPLIT eq 'section' &&
$level==$toplevel+1;
push @lines, $SECTIONEND;
}
}
else
{
# first time we see a "section"
unless ($level == 1)
{
warn "$WARN The first section found is not of level 1: $_";
}
$toplevel = $level;
$here_split = $T2H_SPLIT;
}
push(@sections, $name);
if ($here_split) {
next_doc();
}
}
$sec_num++;
$docid = "SEC$sec_num";
$tocid = (/^\@\w*heading/ ? undef : "TOC$sec_num");
# check biblio and glossary
$in_bibliography = ($name =~ /^([A-Z]|\d+)?(\.\d+)*\s*bibliography$/i);
$in_glossary = ($name =~ /^([A-Z]|\d+)?(\.\d+)*\s*glossary$/i);
# check node
if ($node)
{
warn "$ERROR Duplicate node found: $node\n"
if ($node2sec{$node});
}
else
{
$name .= ' ' while ($node2sec{$name});
$node = $name;
}
$name .= ' ' while ($sec2node{$name});
$section = $name;
$node2sec{$node} = $name;
$sec2node{$name} = $node;
$node2href{$node} = "$docu_doc#$docid";
$node2next{$node} = $node_next;
$node2prev{$node} = $node_prev;
$node2up{$node} = $node_up;
print "# section $name, level $level, file $docu_doc\n"
if $T2H_DEBUG & $DEBUG_TOC;
$node = '';
$node_next = '';
$node_prev = '';
$node_next = '';
if ($tocid)
{
# update TOC
while ($level > $curlevel) {
$curlevel++;
push(@toc_lines, "<ul>\n");
}
while ($level < $curlevel) {
$curlevel--;
push(@toc_lines, "</ul>\n");
}
$_ = &t2h_anchor($tocid, "$docu_doc#$docid", $name, 1);
$_ = &substitute_style($_);
push(@stoc_lines, "$_<br>\n") if ($level == 1);
if ($T2H_NUMBER_SECTIONS)
{
push(@toc_lines, $_ . "<br>\n")
}
else
{
push(@toc_lines, "<li>" . $_ ."</li>");
}
}
else
{
push(@lines, &html_debug("<a name=\"$docid\"></a>\n",
__LINE__));
}
# update DOC
push(@lines, &html_debug('', __LINE__));
&html_reset;
$_ = "<h$level> $name </h$level>\n<!--docid::${docid}::-->\n";
$_ = &debug($_, __LINE__);
push(@lines, &html_debug('', __LINE__));
}
# update DOC
foreach $line (split(/\n+/, $_)) {
push(@lines, "$line\n");
}
next;
} else {
warn "$ERROR Bad section line: $_";
}
} else {
# track variables
$value{$1} = Unprotect_texi($2), next if /^\@set\s+($VARRE)\s+(.*)$/o;
delete $value{$1}, next if /^\@clear\s+($VARRE)\s*$/o;
# store things
$value{'_shorttitle'} = Unprotect_texi($1), next if /^\@shorttitle\s+(.*)$/;
$value{'_setfilename'} = Unprotect_texi($1), next if /^\@setfilename\s+(.*)$/;
$value{'_settitle'} = Unprotect_texi($1), next if /^\@settitle\s+(.*)$/;
$value{'_author'} .= Unprotect_texi($1)."\n", next if /^\@author\s+(.*)$/;
$value{'_subtitle'} .= Unprotect_texi($1)."\n", next if /^\@subtitle\s+(.*)$/;
$value{'_title'} .= Unprotect_texi($1)."\n", next if /^\@title\s+(.*)$/;
# list item
if (/^\s*\@itemx?\s+/) {
$what = $';
$what =~ s/\s+$//;
if ($in_bibliography && $use_bibliography) {
if ($what =~ /^$BIBRE$/o) {
$id = 'BIB' . ++$bib_num;
$bib2href{$what} = "$docu_doc#$id";
print "# found bibliography for '$what' id $id\n"
if $T2H_DEBUG & $DEBUG_BIB;
$what = &t2h_anchor($id, '', $what);
}
} elsif ($in_glossary && $T2H_USE_GLOSSARY) {
$id = 'GLOSS' . ++$gloss_num;
$entry = $what;
$entry =~ tr/A-Z/a-z/ unless $entry =~ /^[A-Z\s]+$/;
$gloss2href{$entry} = "$docu_doc#$id";
print "# found glossary for '$entry' id $id\n"
if $T2H_DEBUG & $DEBUG_GLOSS;
$what = &t2h_anchor($id, '', $what);
}
elsif ($in_table && ($table_type eq 'f' || $table_type eq 'v'))
{
EnterIndexEntry($table_type, $what, $docu_doc, $section, \@lines);
}
&html_pop_if('p');
if ($html_element eq 'dl' || $html_element eq 'dd') {
if ($things_map{$in_table} && !$what) {
# special case to allow @table @bullet for instance
push(@lines, &debug("<dt>$things_map{$in_table}\n", __LINE__));
} else {
push(@lines, &debug("<dt>\@$in_table\{$what\}\n", __LINE__));
}
push(@lines, "<dd>");
&html_push('dd') unless $html_element eq 'dd';
if ($table_type) { # add also an index
unshift(@input_spool, "\@${table_type}index $what\n");
}
} elsif ($html_element eq 'table') {
push(@lines, &debug("<tr><td>$what</td>\n", __LINE__));
&html_push('tr');
} elsif ($html_element eq 'tr') {
push(@lines, &debug("</tr>\n", __LINE__));
push(@lines, &debug("<tr><td>$what</td>\n", __LINE__));
} else {
push(@lines, &debug("<li>$what\n", __LINE__));
&html_push('li') unless $html_element eq 'li';
}
push(@lines, &html_debug('', __LINE__));
if ($deferred_ref) {
push(@lines, &debug("$deferred_ref\n", __LINE__));
$deferred_ref = '';
}
next;
} elsif (/^\@tab\s+(.*)$/) {
push(@lines, "<td>$1</td>\n");
next;
}
}
}
# paragraph separator
if ($_ eq "\n" && ! $in_pre) {
next if $#lines >= 0 && $lines[$#lines] eq "\n";
if ($html_element eq 'p') {
push (@lines, &debug("</p><p>\n", __LINE__));
}
# else
# {
# push(@lines, "<p></p>\n");
# $_ = &debug("<p></p>\n", __LINE__);
# }
elsif ($html_element eq 'body' || $html_element eq 'blockquote' || $html_element eq 'dd' || $html_element eq 'li')
{
&html_push('p');
push(@lines, &debug("<p>\n", __LINE__));
}
}
# otherwise
push(@lines, $_) unless $in_titlepage;
push(@lines, &debug("</center>\n", __LINE__)) if ($tag eq 'center');
}
# finish TOC
$level = 0;
while ($level < $curlevel) {
$curlevel--;
push(@toc_lines, "</ul>\n");
}
print "# end of pass 1\n" if $T2H_VERBOSE;
SetDocumentLanguage('en') unless ($T2H_LANG);
#+++############################################################################
# #
# Stuff related to Index generation #
# #
#---############################################################################
sub EnterIndexEntry
{
my $prefix = shift;
my $key = shift;
my $docu_doc = shift;
my $section = shift;
my $lines = shift;
local $_;
warn "$ERROR Undefined index command: $_", next
unless (exists ($index_properties->{$prefix}));
$key =~ s/\s+$//;
$_ = $key;
&protect_texi;
$key = $_;
$_ = &protect_html($_);
my $html_key = substitute_style($_);
my $id;
$key = remove_style($key);
$key = remove_things($key);
$_ = $key;
&unprotect_texi;
$key = $_;
while (exists $index->{$prefix}->{$key}) {$key .= ' '};
if ($lines->[$#lines] =~ /^<!--docid::(.+)::-->$/)
{
$id = $1;
}
else
{
$id = 'IDX' . ++$idx_num;
push(@$lines, &t2h_anchor($id, '', $T2H_INVISIBLE_MARK, !$in_pre));
}
$index->{$prefix}->{$key}->{html_key} = $html_key;
$index->{$prefix}->{$key}->{section} = $section;
$index->{$prefix}->{$key}->{href} = "$docu_doc#$id";
print "# found ${prefix}index for '$key' with id $id\n"
if $T2H_DEBUG & $DEBUG_INDEX;
}
sub IndexName2Prefix
{
my $name = shift;
my $prefix;
for $prefix (keys %$index_properties)
{
return $prefix if ($index_properties->{$prefix}->{name} eq $name);
}
return undef;
}
sub GetIndexEntries
{
my $normal = shift;
my $code = shift;
my ($entries, $prefix, $key) = ({});