4 #+##############################################################################
6 # texi2html: Program to transform Texinfo documents to HTML
8 # Copyright (C) 1999, 2000 Free Software Foundation, Inc.
10 # This program is free software; you can redistribute it and/or modify
11 # it under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 2 of the License, or
13 # (at your option) any later version.
15 # This program is distributed in the hope that it will be useful,
16 # but WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with this program; if not, write to the Free Software
22 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #-##############################################################################
26 # This requires perl version 5 or higher
29 # Perl pragma to restrict unsafe constructs
33 # larry.jones@sdrc.com (Larry Jones)
34 # this pragma is not present in perl5.004_02:
36 # Perl pragma to control optional warnings
109 $T2H_OBSOLETE_OPTIONS
128 $WORDS_IN_NAVIGATION_PANEL_TITLES
336 #++##############################################################################
338 # NOTE FOR DEBUGGING THIS SCRIPT:
339 # You can run 'perl texi2html.pl' directly, provided you have
340 # the environment variable T2H_HOME set to the directory containing
341 # the texi2html.init file
343 #--##############################################################################
346 # $Id: texi2html,v 1.3 2005-06-19 03:20:26 blp Exp $
349 $T2H_HOMEPAGE = "http://texi2html.cvshome.org";
352 $T2H_AUTHORS = <<EOT;
353 Written by: Lionel Cons <Lionel.Cons\@cern.ch> (original author)
354 Karl Berry <karl\@freefriends.org>
355 Olaf Bachmann <obachman\@mathematik.uni-kl.de>
357 Maintained by: Many creative people <dev\@texi2html.cvshome.org>
358 Send bugs and suggestions to <users\@texi2html.cvshome.org>
361 # Version: set in configure.in
362 $THISVERSION = '1.66';
363 $THISPROG = "texi2html $THISVERSION"; # program name and version
365 # The man page for this program is included at the end of this file and can be
366 # viewed using the command 'nroff -man texi2html'.
368 #+++############################################################################
371 # Pasted content of File $(srcdir)/texi2html.init: Default initializations #
373 #---############################################################################
375 # leave this within comments, and keep the require statement
376 # This way, you can directly run texi2html.pl, if $ENV{T2H_HOME}/texi2html.init
381 ######################################################################
382 # File: texi2html.init
384 # Sets default values for command-line arguments and for various customizable
387 # A copy of this file is pasted into the beginning of texi2html by
390 # Copy this file and make changes to it, if you like.
391 # Afterwards, either, load it with command-line option -init_file <your_init_file>
393 # $Id: texi2html,v 1.3 2005-06-19 03:20:26 blp Exp $
395 ######################################################################
396 # stuff which can also be set by command-line options
399 # Note: values set here, overwrite values set by the command-line
400 # options before -init_file and might still be overwritten by
401 # command-line arguments following the -init_file option
404 # T2H_OPTIONS is a hash whose keys are the (long) names of valid
405 # command-line options and whose values are a hash with the following keys:
406 # type ==> one of !|=i|:i|=s|:s (see GetOpt::Long for more info)
407 # linkage ==> ref to scalar, array, or subroutine (see GetOpt::Long for more info)
408 # verbose ==> short description of option (displayed by -h)
409 # noHelp ==> if 1 -> for "not so important options": only print description on -h 1
410 # 2 -> for obsolete options: only print description on -h 2
414 $T2H_OPTIONS -> {debug
} =
417 linkage
=> \
$T2H_DEBUG,
418 verbose
=> 'output HTML with debuging information',
421 # APA: Add SystemLiteral to identify the canonical DTD.
422 # [Definition:] The SystemLiteral is called the entity's system
423 # identifier. It is a URI, which may be used to retrieve the entity.
424 # See http://www.xml.com/axml/target.html#NT-ExternalID
425 my $T2H_DOCTYPE = '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
426 "http://www.w3.org/TR/html40/loose.dtd">';
427 $T2H_OPTIONS -> {doctype
} =
430 linkage
=> \
$T2H_DOCTYPE,
431 verbose
=> 'document type which is output in header of HTML files',
436 $T2H_OPTIONS -> {check
} =
439 linkage
=> \
$T2H_CHECK,
440 verbose
=> 'if set, only check files and output all things that may be Texinfo commands',
445 # if set to "tex" (or, "info") expand @iftex and @tex (or, @ifinfo) sections
446 # else, neither expand @iftex, @tex, nor @ifinfo sections
447 my $T2H_EXPAND = "info";
448 $T2H_OPTIONS -> {expand
} =
451 linkage
=> \
$T2H_EXPAND,
452 verbose
=> 'Expand info|tex|none section of texinfo source',
456 # If set, uses section named `Footnotes' for glossary.
457 my $T2H_USE_GLOSSARY = 0;
458 $T2H_OPTIONS -> {glossary
} =
461 linkage
=> \
$T2H_USE_GLOSSARY,
462 verbose
=> "if set, uses section named `Footnotes' for glossary",
468 # $T2H_INVISIBLE_MARK is the text used to create invisible destination
469 # anchors for index links (you can for instance use the invisible.xbm
470 # file shipped with this program). This is a workaround for a known
471 # bug of many WWW browsers, including netscape.
472 # For me, it works fine without it -- on the contrary: if there, it
473 # inserts space between headers and start of text (obachman 3/99)
474 my $T2H_INVISIBLE_MARK = '';
475 # $T2H_INVISIBLE_MARK = ' ';
476 $T2H_OPTIONS -> {invisible
} =
479 linkage
=> \
$T2H_INVISIBLE_MARK,
480 verbose
=> 'use text in invisble anchot',
485 # if set, ISO8859 characters are used for special symbols (like copyright, etc)
487 $T2H_OPTIONS -> {iso
} =
490 linkage
=> \
$T2H_USE_ISO,
491 verbose
=> 'if set, ISO8859 characters are used for special symbols (like copyright, etc)',
496 # list directories where @include files are searched for (besides the
497 # directory of the doc file) additional '-I' args add to this list
498 # APA: Don't implicitely search ., to conform with the docs!
499 # my @T2H_INCLUDE_DIRS = (".");
500 my @T2H_INCLUDE_DIRS = ();
501 $T2H_OPTIONS -> {I
} =
504 linkage
=> \
@T2H_INCLUDE_DIRS,
505 verbose
=> 'append $s to the @include search path',
509 # uses file of this name for top-level file
510 # extension is manipulated appropriately, if necessary.
511 # If empty, <basename of document>.html is used.
512 # Typically, you would set this to "index.html".
513 my $T2H_TOP_FILE = '';
514 $T2H_OPTIONS -> {top_file
} =
517 linkage
=> \
$T2H_TOP_FILE,
518 verbose
=> 'use $s as top file, instead of <docname>.html',
523 # uses file of this name for table of contents. File
524 # extension is manipulated appropriately, if necessary.
525 # If empty, <basename of document>_toc.html is used.
526 my $T2H_TOC_FILE = '';
527 $T2H_OPTIONS -> {toc_file
} =
530 linkage
=> \
$T2H_TOC_FILE,
531 verbose
=> 'use $s as ToC file, instead of <docname>_toc.html',
535 # if set, output two additional files which use HTML 4.0 "frames".
537 $T2H_OPTIONS -> {frames
} =
540 linkage
=> \
$T2H_FRAMES,
541 verbose
=> 'output files which use HTML 4.0 frames (experimental)',
547 # if set, show the Texinfo menus
548 my $T2H_SHOW_MENU = 1;
549 $T2H_OPTIONS -> {menu
} =
552 linkage
=> \
$T2H_SHOW_MENU,
553 verbose
=> 'ouput Texinfo menus',
556 # -number | -nonumber
557 # if set, number sections and show section names and numbers in references
559 my $T2H_NUMBER_SECTIONS = 1;
560 $T2H_OPTIONS -> {number
} =
563 linkage
=> \
$T2H_NUMBER_SECTIONS,
564 verbose
=> 'use numbered sections'
567 # if set, and T2H_NUMBER_SECTIONS is set, then use node names in menu
568 # entries, instead of section names
569 my $T2H_NODE_NAME_IN_MENU = 0;
571 # if set and menu entry equals menu descr, then do not print menu descr.
572 # Likewise, if node name equals entry name, do not print entry name.
573 my $T2H_AVOID_MENU_REDUNDANCY = 1;
575 # -split section|chapter|none
576 # if set to 'section' (resp. 'chapter') create one html file per (sub)section
577 # (resp. chapter) and separate pages for Top, ToC, Overview, Index,
579 # Otherwise, create a monolithic html file that contains the whole document.
580 #$T2H_SPLIT = 'section';
582 $T2H_OPTIONS -> {split} =
585 linkage
=> \
$T2H_SPLIT,
586 verbose
=> 'split document on section|chapter else no splitting',
589 # -section_navigation|-no-section_navigation
590 # if set, then navigation panels are printed at the beginning of each section
591 # and, possibly at the end (depending on whether or not there were more than
592 # $T2H_WORDS_IN_PAGE words on page
593 # This is most useful if you do not want to have section navigation
595 my $T2H_SECTION_NAVIGATION = 1;
596 $T2H_OPTIONS -> {sec_nav
} =
599 linkage
=> \
$T2H_SECTION_NAVIGATION,
600 verbose
=> 'output navigation panels for each section',
604 # If set, then put result files into the specified directory.
605 # If not set, then result files are put into the current directory.
606 #$T2H_SUBDIR = 'html';
608 $T2H_OPTIONS -> {subdir
} =
611 linkage
=> \
$T2H_SUBDIR,
612 verbose
=> 'put HTML files in directory $s, instead of $cwd',
616 # If this is set, then all HTML files will have extension ".htm" instead of
617 # ".html". This is helpful when shipping the document to DOS-based systems.
618 my $T2H_SHORTEXTN = 0;
619 $T2H_OPTIONS -> {short_ext
} =
622 linkage
=> \
$T2H_SHORTEXTN,
623 verbose
=> 'use "htm" extension for output HTML files',
628 # Set the output file prefix, prepended to all .html, .gif and .pl files.
629 # By default, this is the basename of the document
631 $T2H_OPTIONS -> {prefix
} =
634 linkage
=> \
$T2H_PREFIX,
635 verbose
=> 'use as prefix for output files, instead of <docname>',
639 # If set, generate monolithic document output html into $filename
641 $T2H_OPTIONS -> {out_file
} =
644 linkage
=> sub {$T2H_OUT = $_[1]; $T2H_SPLIT = '';},
645 verbose
=> 'if set, all HTML output goes into file $s',
649 #if set cross-references are given without section numbers
650 my $T2H_SHORT_REF = '';
651 $T2H_OPTIONS -> {short_ref
} =
654 linkage
=> \
$T2H_SHORT_REF,
655 verbose
=> 'if set, references are without section numbers',
659 # if value is set, then for each @prinindex $what
660 # $docu_name_$what.idx is created which contains lines of the form
661 # $key\t$ref sorted alphabetically (case matters)
662 my $T2H_IDX_SUMMARY = 0;
663 $T2H_OPTIONS -> {idx_sum
} =
666 linkage
=> \
$T2H_IDX_SUMMARY,
667 verbose
=> 'if set, also output index summary',
672 # Use a table construction for @def .... stuff instead
673 # New Option: 27.07.2000 Karl Heinz Marbaise
674 my $T2H_DEF_TABLE = 0;
675 $T2H_OPTIONS -> {def_table
} =
678 linkage
=> \
$T2H_DEF_TABLE,
679 verbose
=> 'if set, \@def.. are converted using tables.',
684 # if set, chatter about what we are doing
685 my $T2H_VERBOSE = '';
686 $T2H_OPTIONS -> {Verbose
} =
689 linkage
=> \
$T2H_VERBOSE,
690 verbose
=> 'print progress info to stdout',
694 # For page titles use $T2H_WORDS->{$T2H_LANG}->{...} as title.
695 # To add a new language, supply list of titles (see $T2H_WORDS below).
696 # and use ISO 639 language codes (see e.g. perl module Locale-Codes-1.02
698 # Default's to 'en' if not set or no @documentlanguage is specified
700 $T2H_OPTIONS -> {lang
} =
703 linkage
=> sub {SetDocumentLanguage
($_[1])},
704 verbose
=> 'use $s as document language (ISO 639 encoding)',
708 # if set, uses latex2html for generation of math content
710 $T2H_OPTIONS -> {l2h
} =
713 linkage
=> \
$T2H_L2H,
714 verbose
=> 'if set, uses latex2html for @math and @tex',
717 ######################
718 # The following options are only relevant if $T2H_L2H is set
721 # name/location of latex2html program
722 my $T2H_L2H_L2H = "latex2html";
723 $T2H_OPTIONS -> {l2h_l2h
} =
726 linkage
=> \
$T2H_L2H_L2H,
727 verbose
=> 'program to use for latex2html translation',
732 # If set, skips actual call to latex2html: tries to reuse previously generated
734 my $T2H_L2H_SKIP = '';
735 $T2H_OPTIONS -> {l2h_skip
} =
738 linkage
=> \
$T2H_L2H_SKIP,
739 verbose
=> 'if set, tries to reuse previously latex2html output',
744 # If set, l2h uses the specified directory for temporary files. The path
745 # leading to this directory may not contain a dot (i.e., a ".");
746 # otherwise, l2h will fail.
747 my $T2H_L2H_TMP = '';
748 $T2H_OPTIONS -> {l2h_tmp
} =
751 linkage
=> \
$T2H_L2H_TMP,
752 verbose
=> 'if set, uses $s as temporary latex2html directory',
756 # if set, cleans intermediate files (they all have the prefix $doc_l2h_)
758 my $T2H_L2H_CLEAN = 1;
759 $T2H_OPTIONS -> {l2h_clean
} =
762 linkage
=> \
$T2H_L2H_CLEAN,
763 verbose
=> 'if set, do not keep intermediate latex2html files for later reuse',
767 $T2H_OPTIONS -> {D
} =
770 linkage
=> sub {$main::value
{$_[1]} = 1;},
771 verbose
=> 'equivalent to Texinfo "@set $s 1"',
775 $T2H_OPTIONS -> {init_file
} =
778 linkage
=> \
&LoadInitFile
,
779 verbose
=> 'load init file $s'
783 ##############################################################################
785 # The following can only be set in the init file
787 ##############################################################################
789 # if set, center @image by default
790 # otherwise, do not center by default
791 my $T2H_CENTER_IMAGE = 1;
793 # used as identation for block enclosing command @example, etc
794 # If not empty, must be enclosed in <td></td>
795 my $T2H_EXAMPLE_INDENT_CELL = '<td> </td>';
796 # same as above, only for @small
797 my $T2H_SMALL_EXAMPLE_INDENT_CELL = '<td> </td>';
798 # font size for @small
799 my $T2H_SMALL_FONT_SIZE = '-1';
801 # if non-empty, and no @..heading appeared in Top node, then
802 # use this as header for top node/section, otherwise use value of
803 # @settitle or @shorttitle (in that order)
804 my $T2H_TOP_HEADING = '';
806 # if set, use this chapter for 'Index' button, else
807 # use first chapter whose name matches 'index' (case insensitive)
808 my $T2H_INDEX_CHAPTER = '';
810 # if set and $T2H_SPLIT is set, then split index pages at the next letter
811 # after they have more than that many entries
812 my $T2H_SPLIT_INDEX = 100;
814 # if set (e.g., to index.html) replace hrefs to this file
815 # (i.e., to index.html) by ./
816 my $T2H_HREF_DIR_INSTEAD_FILE = '';
818 ########################################################################
819 # Language dependencies:
820 # To add a new language extend T2H_WORDS hash and create $T2H_<...>_WORDS hash
821 # To redefine one word, simply do:
822 # $T2H_WORDS->{<language>}->{<word>} = 'whatever' in your personal init file.
827 'ToC_Title' => 'Table of Contents',
828 'Overview_Title' => 'Short Table of Contents',
829 'Index_Title' => 'Index',
830 'About_Title' => 'About this document',
831 'Footnotes_Title' => 'Footnotes',
834 'section' => 'section',
835 # If necessary, we could extend this as follows:
837 # 'Top_Button' => 'Top',
838 # 'ToC_Button' => 'Contents',
839 # 'Overview_Button' => 'Overview',
840 # 'Index_button' => 'Index',
841 # 'Back_Button' => 'Back',
842 # 'FastBack_Button' => 'FastBack',
843 # 'Prev_Button' => 'Prev',
844 # 'Up_Button' => 'Up',
845 # 'Next_Button' => 'Next',
846 # 'Forward_Button' =>'Forward',
847 # 'FastWorward_Button' => 'FastForward',
848 # 'First_Button' => 'First',
849 # 'Last_Button' => 'Last',
850 # 'About_Button' => 'About'
855 'ToC_Title' => 'Inhaltsverzeichniss',
856 'Overview_Title' => 'Kurzes Inhaltsverzeichniss',
857 'Index_Title' => 'Index',
858 'About_Title' => 'Über dieses Dokument',
859 'Footnotes_Title' => 'Fußnoten',
862 'section' => 'Abschnitt',
867 'ToC_Title' => 'Inhoudsopgave',
868 'Overview_Title' => 'Korte inhoudsopgave',
869 'Index_Title' => 'Index', #Not sure ;-)
870 'About_Title' => 'No translation available!', #No translation available!
871 'Footnotes_Title' => 'No translation available!', #No translation available!
874 'section' => 'sectie',
879 'ToC_Title' => 'índice General',
880 'Overview_Title' => 'Resumen del Contenido',
881 'Index_Title' => 'Index', #Not sure ;-)
882 'About_Title' => 'No translation available!', #No translation available!
883 'Footnotes_Title' => 'Fußnoten',
884 'See' => 'Véase',
885 'see' => 'véase',
886 'section' => 'sección',
891 'ToC_Title' => 'Innholdsfortegnelse',
892 'Overview_Title' => 'Kort innholdsfortegnelse',
893 'Index_Title' => 'Indeks', #Not sure ;-)
894 'About_Title' => 'No translation available!', #No translation available!
895 'Footnotes_Title' => 'No translation available!',
898 'section' => 'avsnitt',
903 'ToC_Title' => 'Sumário',
904 'Overview_Title' => 'Breve Sumário',
905 'Index_Title' => 'Índice', #Not sure ;-)
906 'About_Title' => 'No translation available!', #No translation available!
907 'Footnotes_Title' => 'No translation available!',
910 'section' => 'Seção',
915 'ToC_Title' => 'Table des mati&egrav;res',
916 'Overview_Title' => 'Résumée du contenu',
917 'Index_Title' => 'Index',
918 'About_Title' => 'A propos de ce document',
919 'Footnotes_Title' => 'Notes de bas de page',
922 'section' => 'section',
927 'en' => $T2H_WORDS_EN,
928 'de' => $T2H_WORDS_DE,
929 'nl' => $T2H_WORDS_NL,
930 'es' => $T2H_WORDS_ES,
931 'no' => $T2H_WORDS_NO,
932 'pt' => $T2H_WORDS_PT,
933 'fr' => $T2H_WORDS_FR
938 'January', 'February', 'March', 'April', 'May',
939 'June', 'July', 'August', 'September', 'October',
940 'November', 'December'
945 'Januar', 'Februar', 'März', 'April', 'Mai',
946 'Juni', 'Juli', 'August', 'September', 'Oktober',
947 'November', 'Dezember'
952 'Januari', 'Februari', 'Maart', 'April', 'Mei',
953 'Juni', 'Juli', 'Augustus', 'September', 'Oktober',
954 'November', 'December'
959 'enero', 'febrero', 'marzo', 'abril', 'mayo',
960 'junio', 'julio', 'agosto', 'septiembre', 'octubre',
961 'noviembre', 'diciembre'
967 'januar', 'februar', 'mars', 'april', 'mai',
968 'juni', 'juli', 'august', 'september', 'oktober',
969 'november', 'desember'
974 'Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio',
975 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro',
976 'Novembro', 'Dezembro'
981 'Janvier', 'Février', 'Mars', 'Avril', 'Mai',
982 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre',
983 'Novembre', 'Décembre'
990 'en' => \
@MONTH_NAMES_EN,
991 'de' => \
@MONTH_NAMES_DE,
992 'es' => \
@MONTH_NAMES_ES,
993 'nl' => \
@MONTH_NAMES_NL,
994 'no' => \
@MONTH_NAMES_NO,
995 'pt' => \
@MONTH_NAMES_PT,
996 'fr' => \
@MONTH_NAMES_FR
999 ########################################################################
1000 # Control of Page layout:
1001 # You can make changes of the Page layout at two levels:
1002 # 1.) For small changes, it is often enough to change the value of
1003 # some global string/hash/array variables
1004 # 2.) For larger changes, reimplement one of the T2H_DEFAULT_<fnc>* routines,
1005 # give them another name, and assign them to the respective
1006 # $T2H_<fnc> variable.
1008 # As a general interface, the hashes T2H_HREF, T2H_NAME, T2H_NODE hold
1009 # href, html-name, node-name of
1010 # This -- current section (resp. html page)
1011 # Top -- top page ($T2H_TOP_FILE)
1012 # Contents -- Table of contents
1013 # Overview -- Short table of contents
1014 # Index -- Index page
1015 # About -- page which explain "navigation buttons"
1016 # First -- first node
1019 # Whether or not the following hash values are set, depends on the context
1020 # (all values are w.r.t. 'This' section)
1021 # Next -- next node of texinfo
1022 # Prev -- previous node of texinfo
1023 # Up -- up node of texinfo
1024 # Forward -- next node in reading order
1025 # Back -- previous node in reading order
1026 # FastForward -- if leave node, up and next, else next node
1027 # FastBackward-- if leave node, up and prev, else prev node
1029 # Furthermore, the following global variabels are set:
1030 # $T2H_THISDOC{title} -- title as set by @setttile
1031 # $T2H_THISDOC{fulltitle} -- full title as set by @title...
1032 # $T2H_THISDOC{subtitle} -- subtitle as set by @subtitle
1033 # $T2H_THISDOC{author} -- author as set by @author
1035 # and pointer to arrays of lines which need to be printed by t2h_print_lines
1036 # $T2H_OVERVIEW -- lines of short table of contents
1037 # $T2H_TOC -- lines of table of contents
1038 # $T2H_TOP -- lines of Top texinfo node
1039 # $T2H_THIS_SECTION -- lines of 'This' section
1042 # There are the following subs which control the layout:
1044 my $T2H_print_section = \
&T2H_DEFAULT_print_section
;
1045 my $T2H_print_Top_header = \
&T2H_DEFAULT_print_Top_header
;
1046 my $T2H_print_Top_footer = \
&T2H_DEFAULT_print_Top_footer
;
1047 my $T2H_print_Top = \
&T2H_DEFAULT_print_Top
;
1048 my $T2H_print_Toc = \
&T2H_DEFAULT_print_Toc
;
1049 my $T2H_print_Overview = \
&T2H_DEFAULT_print_Overview
;
1050 my $T2H_print_Footnotes = \
&T2H_DEFAULT_print_Footnotes
;
1051 my $T2H_print_About = \
&T2H_DEFAULT_print_About
;
1052 my $T2H_print_misc_header = \
&T2H_DEFAULT_print_misc_header
;
1053 my $T2H_print_misc_footer = \
&T2H_DEFAULT_print_misc_footer
;
1054 my $T2H_print_misc = \
&T2H_DEFAULT_print_misc
;
1055 my $T2H_print_chapter_header = \
&T2H_DEFAULT_print_chapter_header
;
1056 my $T2H_print_chapter_footer = \
&T2H_DEFAULT_print_chapter_footer
;
1057 my $T2H_print_page_head = \
&T2H_DEFAULT_print_page_head
;
1058 my $T2H_print_page_foot = \
&T2H_DEFAULT_print_page_foot
;
1059 my $T2H_print_head_navigation = \
&T2H_DEFAULT_print_head_navigation
;
1060 my $T2H_print_foot_navigation = \
&T2H_DEFAULT_print_foot_navigation
;
1061 my $T2H_button_icon_img = \
&T2H_DEFAULT_button_icon_img
;
1062 my $T2H_print_navigation = \
&T2H_DEFAULT_print_navigation
;
1063 my $T2H_about_body = \
&T2H_DEFAULT_about_body
;
1064 my $T2H_print_frame = \
&T2H_DEFAULT_print_frame
;
1065 my $T2H_print_toc_frame = \
&T2H_DEFAULT_print_toc_frame
;
1067 ########################################################################
1068 # Layout for html for every sections
1070 sub T2H_DEFAULT_print_section
1073 local $T2H_BUTTONS = \
@T2H_SECTION_BUTTONS;
1074 &$T2H_print_head_navigation($fh) if $T2H_SECTION_NAVIGATION;
1075 my $nw = t2h_print_lines
($fh);
1076 if (defined $T2H_SPLIT
1077 and ($T2H_SPLIT eq 'section' && $T2H_SECTION_NAVIGATION))
1079 &$T2H_print_foot_navigation($fh, $nw);
1083 print $fh '<HR SIZE="6">' . "\n";
1087 ###################################################################
1088 # Layout of top-page I recommend that you use @ifnothtml, @ifhtml,
1089 # @html within the Top texinfo node to specify content of top-level
1092 # If you enclose everything in @ifnothtml, then title, subtitle,
1093 # author and overview is printed
1094 # T2H_HREF of Next, Prev, Up, Forward, Back are not defined
1095 # if $T2H_SPLIT then Top page is in its own html file
1096 sub T2H_DEFAULT_print_Top_header
1098 &$T2H_print_page_head(@_) if $T2H_SPLIT;
1099 t2h_print_label
(@_); # this needs to be called, otherwise no label set
1100 &$T2H_print_head_navigation(@_);
1102 sub T2H_DEFAULT_print_Top_footer
1104 &$T2H_print_foot_navigation(@_);
1105 &$T2H_print_page_foot(@_) if $T2H_SPLIT;
1107 sub T2H_DEFAULT_print_Top
1111 # for redefining navigation buttons use:
1112 # local $T2H_BUTTONS = [...];
1113 # as it is, 'Top', 'Contents', 'Index', 'About' are printed
1114 local $T2H_BUTTONS = \
@T2H_MISC_BUTTONS;
1115 &$T2H_print_Top_header($fh);
1116 if ($T2H_THIS_SECTION)
1118 # if top-level node has content, then print it with extra header
1119 print $fh "<H1>$T2H_NAME{Top}</H1>\n"
1120 unless ($T2H_HAS_TOP_HEADING);
1121 t2h_print_lines
($fh, $T2H_THIS_SECTION)
1125 # top-level node is fully enclosed in @ifnothtml
1126 # print fulltitle, subtitle, author, Overview
1129 join("</H1>\n<H1>", split(/\n/, $T2H_THISDOC{fulltitle
})) .
1131 print $fh "<H2>$T2H_THISDOC{subtitle}</H2>\n" if $T2H_THISDOC{subtitle
};
1132 print $fh "$T2H_THISDOC{author}\n" if $T2H_THISDOC{author
};
1137 <H2> Overview: </H2>
1140 t2h_print_lines
($fh, $T2H_OVERVIEW);
1141 print $fh "</BLOCKQUOTE>\n";
1143 &$T2H_print_Top_footer($fh);
1146 ###################################################################
1147 # Layout of Toc, Overview, and Footnotes pages
1148 # By default, we use "normal" layout
1149 # T2H_HREF of Next, Prev, Up, Forward, Back, etc are not defined
1150 # use: local $T2H_BUTTONS = [...] to redefine navigation buttons
1151 sub T2H_DEFAULT_print_Toc
1153 return &$T2H_print_misc(@_);
1155 sub T2H_DEFAULT_print_Overview
1157 return &$T2H_print_misc(@_);
1159 sub T2H_DEFAULT_print_Footnotes
1161 return &$T2H_print_misc(@_);
1163 sub T2H_DEFAULT_print_About
1165 return &$T2H_print_misc(@_);
1168 sub T2H_DEFAULT_print_misc_header
1170 &$T2H_print_page_head(@_) if $T2H_SPLIT;
1171 # this needs to be called, otherwise, no labels are set
1172 t2h_print_label
(@_);
1173 &$T2H_print_head_navigation(@_);
1175 sub T2H_DEFAULT_print_misc_footer
1177 &$T2H_print_foot_navigation(@_);
1178 &$T2H_print_page_foot(@_) if $T2H_SPLIT;
1180 sub T2H_DEFAULT_print_misc
1183 local $T2H_BUTTONS = \
@T2H_MISC_BUTTONS;
1184 &$T2H_print_misc_header($fh);
1185 print $fh "<H1>$T2H_NAME{This}</H1>\n";
1186 t2h_print_lines
($fh);
1187 &$T2H_print_misc_footer($fh);
1190 ###################################################################
1191 # chapter_header and chapter_footer are only called if
1192 # T2H_SPLIT eq 'chapter'
1193 # chapter_header: after print_page_head, before print_section
1194 # chapter_footer: after print_section of last section, before print_page_foot
1196 # If you want to get rid of navigation stuff after each section,
1197 # redefine print_section such that it does not call print_navigation,
1198 # and put print_navigation into print_chapter_header
1199 @T2H_CHAPTER_BUTTONS =
1201 'FastBack', 'FastForward', ' ',
1203 'Top', 'Contents', 'Index', 'About',
1206 sub T2H_DEFAULT_print_chapter_header
1208 # nothing to do there, by default
1209 if (! $T2H_SECTION_NAVIGATION)
1212 local $T2H_BUTTONS = \
@T2H_CHAPTER_BUTTONS;
1213 &$T2H_print_navigation($fh);
1214 print $fh "\n<HR SIZE=2>\n";
1218 sub T2H_DEFAULT_print_chapter_footer
1220 local $T2H_BUTTONS = \
@T2H_CHAPTER_BUTTONS;
1221 &$T2H_print_navigation(@_);
1223 ###################################################################
1226 my($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
1228 ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
1229 $year += ($year < 70) ?
2000 : 1900;
1230 # obachman: Let's do it as the Americans do
1231 return($MONTH_NAMES->{$T2H_LANG}[$mon] . ", " . $mday . " " . $year);
1235 ###################################################################
1236 # Layout of standard header and footer
1239 # This init routine is called at the beginning of pass5 before first
1240 # output is generated.
1243 # Set the default body text, inserted between <BODY ... >
1244 $T2H_BODYTEXT = 'LANG="' . $T2H_LANG . '" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#800080" ALINK="#FF0000"';
1245 # text inserted after <BODY ...>
1246 $T2H_AFTER_BODY_OPEN = '';
1247 #text inserted before </BODY>
1248 $T2H_PRE_BODY_CLOSE = '';
1249 # this is used in footer
1250 $T2H_ADDRESS = "<I>$T2H_USER</I> " if $T2H_USER;
1251 $T2H_ADDRESS .= "on <I>$T2H_TODAY</I>";
1252 # this is added inside <HEAD></HEAD> after <TITLE> and some META NAME stuff
1253 # can be used for <style> <script>, <meta> tags
1254 $T2H_EXTRA_HEAD = '';
1257 sub T2H_DEFAULT_print_page_head
1260 my $longtitle = "$T2H_THISDOC{title}";
1261 $longtitle .= ": $T2H_NAME{This}" if exists $T2H_NAME{This
};
1265 <!-- Created on $T2H_TODAY by $THISPROG -->
1270 <TITLE>$longtitle</TITLE>
1272 <META NAME="description" CONTENT="$longtitle">
1273 <META NAME="keywords" CONTENT="$longtitle">
1274 <META NAME="resource-type" CONTENT="document">
1275 <META NAME="distribution" CONTENT="global">
1276 <META NAME="Generator" CONTENT="$THISPROG">
1280 <BODY $T2H_BODYTEXT>
1281 $T2H_AFTER_BODY_OPEN
1285 sub T2H_DEFAULT_print_page_foot
1291 This document was generated
1293 using <A HREF="$T2H_HOMEPAGE"><I>texi2html</I></A>
1301 ###################################################################
1302 # Layout of navigation panel
1304 # if this is set, then a vertical navigation panel is used
1305 my $T2H_VERTICAL_HEAD_NAVIGATION = 0;
1306 sub T2H_DEFAULT_print_head_navigation
1309 if ($T2H_VERTICAL_HEAD_NAVIGATION)
1312 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="0">
1317 &$T2H_print_navigation($fh, $T2H_VERTICAL_HEAD_NAVIGATION);
1318 if ($T2H_VERTICAL_HEAD_NAVIGATION)
1325 elsif (defined $T2H_SPLIT
1326 and ($T2H_SPLIT eq 'section'))
1328 print $fh "<HR SIZE=1>\n";
1332 # Specifies the minimum page length required before a navigation panel
1333 # is placed at the bottom of a page (the default is that of latex2html)
1334 # T2H_THIS_WORDS_IN_PAGE holds number of words of current page
1335 my $T2H_WORDS_IN_PAGE = 300;
1336 sub T2H_DEFAULT_print_foot_navigation
1340 if ($T2H_VERTICAL_HEAD_NAVIGATION)
1348 print $fh "<HR SIZE=1>\n";
1349 &$T2H_print_navigation($fh) if (defined $nwords
1350 and $nwords >= $T2H_WORDS_IN_PAGE)
1353 ######################################################################
1356 # specify in this array which "buttons" should appear in which order
1357 # in the navigation panel for sections; use ' ' for empty buttons (space)
1358 @T2H_SECTION_BUTTONS =
1360 'Back', 'Forward', ' ', 'FastBack', 'Up', 'FastForward',
1362 'Top', 'Contents', 'Index', 'About',
1365 # buttons for misc stuff
1366 @T2H_MISC_BUTTONS = ('Top', 'Contents', 'Index', 'About');
1368 # insert here name of icon images for buttons
1369 # Icons are used, if $T2H_ICONS and resp. value are set
1389 # insert here name of icon images for these, if button is inactive
1390 %T2H_PASSIVE_ICONS =
1408 # how to create IMG tag
1409 sub T2H_DEFAULT_button_icon_img
1414 return qq{<IMG SRC
="$icon" BORDER
="0" ALT
="$button: $name" ALIGN
="MIDDLE">};
1417 # Names of text as alternative for icons
1418 %T2H_NAVIGATION_TEXT =
1421 'Contents', 'Contents',
1422 'Overview', 'Overview',
1426 'FastBack', ' << ',
1430 'Forward', ' > ',
1431 'FastForward', ' >> ',
1437 sub T2H_DEFAULT_print_navigation
1440 my $vertical = shift;
1442 print $fh "<TABLE CELLPADDING=$spacing CELLSPACING=$spacing BORDER=0>\n";
1444 print $fh "<TR>" unless $vertical;
1445 for $button (@
$T2H_BUTTONS)
1447 print $fh qq{<TR VALIGN
="TOP" ALIGN
="LEFT">\n} if $vertical;
1448 print $fh qq{<TD VALIGN
="MIDDLE" ALIGN
="LEFT">};
1450 if (ref($button) eq 'CODE')
1452 &$button($fh, $vertical);
1454 elsif ($button eq ' ')
1455 { # handle space button
1457 $T2H_ICONS && $T2H_ACTIVE_ICONS{' '} ?
1458 &$T2H_button_icon_img($button, $T2H_ACTIVE_ICONS{' '}) :
1459 $T2H_NAVIGATION_TEXT{' '};
1462 elsif ($T2H_HREF{$button})
1463 { # button is active
1465 $T2H_ICONS && $T2H_ACTIVE_ICONS{$button} ?
# use icon ?
1466 t2h_anchor
('', $T2H_HREF{$button}, # yes
1467 &$T2H_button_icon_img($button,
1468 $T2H_ACTIVE_ICONS{$button},
1469 $T2H_NAME{$button}))
1472 t2h_anchor
('', $T2H_HREF{$button}, $T2H_NAVIGATION_TEXT{$button}) .
1476 { # button is passive
1478 $T2H_ICONS && $T2H_PASSIVE_ICONS{$button} ?
1479 &$T2H_button_icon_img($button,
1480 $T2H_PASSIVE_ICONS{$button},
1481 $T2H_NAME{$button}) :
1483 "[" . $T2H_NAVIGATION_TEXT{$button} . "]";
1485 print $fh "</TD>\n";
1486 print $fh "</TR>\n" if $vertical;
1488 print $fh "</TR>" unless $vertical;
1489 print $fh "</TABLE>\n";
1492 ######################################################################
1493 # Frames: this is from "Richard Y. Kim" <ryk@coho.net>
1494 # Should be improved to be more conforming to other _print* functions
1496 sub T2H_DEFAULT_print_frame
1501 <HEAD><TITLE>$T2H_THISDOC{title}</TITLE></HEAD>
1502 <FRAMESET cols="140,*">
1503 <FRAME name=toc src="$docu_toc_frame_file">
1504 <FRAME name=main src="$docu_doc">
1510 sub T2H_DEFAULT_print_toc_frame
1513 &$T2H_print_page_head($fh);
1517 print $fh map {s/HREF=/target=\"main\" HREF=/; $_;} @stoc_lines;
1518 print $fh "</BODY></HTML>\n";
1521 ######################################################################
1525 # T2H_PRE_ABOUT might be a function
1526 my $T2H_PRE_ABOUT = <<EOT;
1527 This document was generated
1529 using <A HREF=\"$T2H_HOMEPAGE\"><I>texi2html</I></A>
1532 my $T2H_AFTER_ABOUT = '';
1534 sub T2H_DEFAULT_about_body
1537 if (ref($T2H_PRE_ABOUT) eq 'CODE')
1539 $about = &$T2H_PRE_ABOUT();
1543 $about = $T2H_PRE_ABOUT;
1546 The buttons in the navigation panels have the following meaning:
1548 <table border = "1">
1553 <TH> From 1.2.3 go to</TH>
1557 for $button (@T2H_SECTION_BUTTONS)
1559 next if $button eq ' ' || ref($button) eq 'CODE';
1565 ($T2H_ICONS && $T2H_ACTIVE_ICONS{$button} ?
1566 &$T2H_button_icon_img($button, $T2H_ACTIVE_ICONS{$button}) :
1567 " [" . $T2H_NAVIGATION_TEXT{$button} . "] ");
1574 $T2H_BUTTONS_GOTO{$button}
1577 $T2H_BUTTONS_EXAMPLE{$button}
1586 where the <STRONG> Example </STRONG> assumes that the current position
1587 is at <STRONG> Subsubsection One-Two-Three </STRONG> of a document of
1588 the following structure:</P>
1592 <LI>1.1 Subsection One-One
1596 <LI>1.2 Subsection One-Two
1598 <LI>1.2.1 Subsubsection One-Two-One</LI>
1599 <LI>1.2.2 Subsubsection One-Two-Two</LI>
1600 <LI>1.2.3 Subsubsection One-Two-Three
1601 <STRONG><== Current Position </STRONG></LI>
1602 <LI>1.2.4 Subsubsection One-Two-Four</LI>
1605 <LI>1.3 Subsection One-Three
1610 <LI>1.4 Subsection One-Four</LI>
1622 'Top', 'cover (top) of document',
1623 'Contents', 'table of contents',
1624 'Overview', 'short table of contents',
1625 'Index', 'concept index',
1626 'Back', 'previous section in reading order',
1627 'FastBack', 'beginning of this chapter or previous chapter',
1628 'Prev', 'previous section same level',
1630 'Next', 'next section same level',
1631 'Forward', 'next section in reading order',
1632 'FastForward', 'next chapter',
1633 'About' , 'this page',
1634 'First', 'first section in reading order',
1635 'Last', 'last section in reading order',
1638 %T2H_BUTTONS_EXAMPLE =
1641 'Contents', ' ',
1642 'Overview', ' ',
1643 'Index', ' ',
1651 'About', ' ',
1657 ######################################################################
1658 # from here on, its l2h init stuff
1661 ## initialization for latex2html as for Singular manual generation
1665 # Options controlling Titles, File-Names, Tracing and Sectioning
1673 $DESTDIR = ''; # should be overwritten by cmd-line argument
1675 $NO_SUBDIR = 0; # should be overwritten by cmd-line argument
1677 $PREFIX = ''; # should be overwritten by cmd-line argument
1679 $AUTO_PREFIX = 0; # this is needed, so that prefix settings are used
1685 $MAX_LINK_DEPTH = 0;
1687 $TMP = ''; # should be overwritten by cmd-line argument
1694 # Options controlling Extensions and Special Features
1696 $HTML_VERSION = "3.2";
1698 $TEXDEFS = 1; # we absolutely need that
1700 $EXTERNAL_FILE = '';
1702 $SCALABLE_FONTS = 1;
1704 $NO_SIMPLE_MATH = 1;
1717 # Switches controlling Image Generation
1723 $EXTERNAL_IMAGES = 0;
1735 $ANTI_ALIAS_TEXT = 1;
1738 #Switches controlling Navigation Panels
1742 $INFO = 0; # 0 = do not make a "About this document..." section
1745 #Switches for Linking to other documents
1747 # currently -- we don't care
1749 $MAX_SPLIT_DEPTH = 0; # Stop making separate files at this depth
1751 $MAX_LINK_DEPTH = 0; # Stop showing child nodes at this depth
1753 $NOLATEX = 0; # 1 = do not pass unknown environments to Latex
1755 $EXTERNAL_IMAGES = 0; # 1 = leave the images outside the document
1757 $ASCII_MODE = 0; # 1 = do not use any icons or internal images
1759 # 1 = use links to external postscript images rather than inlined bitmap
1762 $SHOW_SECTION_NUMBERS = 0;
1764 ### Other global variables ###############################################
1767 # This is the line width measured in pixels and it is used to right justify
1768 # equations and equation arrays;
1771 # Used in conjunction with AUTO_NAVIGATION
1772 $WORDS_IN_PAGE = 300;
1774 # Affects ONLY the way accents are processed
1775 $default_language = 'english';
1777 # The value of this variable determines how many words to use in each
1778 # title that is added to the navigation panel (see below)
1780 $WORDS_IN_NAVIGATION_PANEL_TITLES = 0;
1782 # This number will determine the size of the equations, special characters,
1783 # and anything which will be converted into an inlined image
1784 # *except* "image generating environments" such as "figure", "table"
1786 # Effective values are those greater than 0.
1787 # Sensible values are between 0.1 - 4.
1788 $MATH_SCALE_FACTOR = 1.5;
1790 # This number will determine the size of
1791 # image generating environments such as "figure", "table" or "minipage".
1792 # Effective values are those greater than 0.
1793 # Sensible values are between 0.1 - 4.
1794 $FIGURE_SCALE_FACTOR = 1.6;
1797 # If both of the following two variables are set then the "Up" button
1798 # of the navigation panel in the first node/page of a converted document
1799 # will point to $EXTERNAL_UP_LINK. $EXTERNAL_UP_TITLE should be set
1800 # to some text which describes this external link.
1801 $EXTERNAL_UP_LINK = "";
1802 $EXTERNAL_UP_TITLE = "";
1804 # If this is set then the resulting HTML will look marginally better if viewed
1808 # Valid paper sizes are "letter", "legal", "a4","a3","a2" and "a0"
1809 # Paper sizes has no effect other than in the time it takes to create inlined
1810 # images and in whether large images can be created at all ie
1811 # - larger paper sizes *MAY* help with large image problems
1812 # - smaller paper sizes are quicker to handle
1815 # Replace "english" with another language in order to tell LaTeX2HTML that you
1816 # want some generated section titles (eg "Table of Contents" or "References")
1817 # to appear in a different language. Currently only "english" and "french"
1818 # is supported but it is very easy to add your own. See the example in the
1819 # file "latex2html.config"
1820 $TITLES_LANGUAGE = "english";
1822 1; # This must be the last non-comment line
1824 # End File texi2html.init
1825 ######################################################################
1828 require "$ENV{T2H_HOME}/texi2html.init"
1829 if ($0 =~ /\.pl$/ &&
1830 -e
"$ENV{T2H_HOME}/texi2html.init" && -r
"$ENV{T2H_HOME}/texi2html.init");
1832 #+++############################################################################
1835 # Pasted content of File $(srcdir)/MySimple.pm: Command-line processing #
1837 #---############################################################################
1839 # leave this within comments, and keep the require statement
1840 # This way, you can directly run texi2html.pl, if $ENV{T2H_HOME}/texi2html.init
1844 package Getopt
::MySimple
;
1850 # POD-style (incomplete) documentation is in file MySimple.pod
1856 # Ron Savage rpsavage@ozemail.com.au.
1857 # 1.00 19-Aug-97 Initial version.
1858 # 1.10 13-Oct-97 Add arrays of switches (eg '=s@').
1859 # 1.20 3-Dec-97 Add 'Help' on a per-switch basis.
1860 # 1.30 11-Dec-97 Change 'Help' to 'verbose'. Make all hash keys lowercase.
1861 # 1.40 10-Nov-98 Change width of help report. Restructure tests.
1862 # 1-Jul-00 Modifications for Texi2html
1864 # --------------------------------------------------------------------------
1865 # Locally modified by obachman (Display type instead of env, order by cmp)
1866 # $Id: texi2html,v 1.3 2005-06-19 03:20:26 blp Exp $
1871 use vars
qw(@EXPORT @EXPORT_OK @ISA);
1872 use vars qw($fieldWidth $opt $VERSION);
1877 @ISA = qw(Exporter);
1879 @EXPORT_OK = qw($opt); # An alias for $self -> {'opt'}.
1881 # --------------------------------------------------------------------------
1886 # --------------------------------------------------------------------------
1892 return uc($a) cmp (uc($b));
1895 # --------------------------------------------------------------------------
1901 print 'Option', ' ' x ($fieldWidth - length('Option') ), "Value\n";
1903 for (sort byOrder keys(%{$self -> {'opt'} }) )
1905 print "-$_", ' ' x ($fieldWidth - (1 + length) ), "${$self->{'opt'} }{$_}\n";
1910 } # End of dumpOptions.
1912 # --------------------------------------------------------------------------
1919 push(@_, 0) if ($#_ == 2); # Default for $ignoreCase is 0.
1920 push(@_, 1) if ($#_ == 3); # Default for $helpThenExit is 1.
1922 my($self, $default, $helpText, $versionText,
1923 $helpThenExit, $versionThenExit, $ignoreCase) = @_;
1925 $helpThenExit = 1 unless (defined($helpThenExit));
1926 $versionThenExit = 1 unless (defined($versionThenExit));
1927 $ignoreCase = 0 unless (defined($ignoreCase));
1929 $self -> {'default'} = $default;
1930 $self -> {'helpText'} = $helpText;
1931 $self -> {'versionText'} = $versionText;
1932 $Getopt::Long::ignorecase = $ignoreCase;
1934 unless (defined($self -> {'default'}{'help'}))
1936 $self -> {'default'}{'help'} =
1940 linkage => sub {$self->helpOptions($_[1]); exit (0) if $helpThenExit;},
1941 verbose => "print help and exit"
1945 unless (defined($self -> {'default'}{'version'}))
1947 $self -> {'default'}{'version'} =
1951 linkage => sub {print $self->{'versionText'}; exit (0) if $versionThenExit;},
1952 verbose => "print version and exit"
1956 for (keys(%{$self -> {'default'} }) )
1958 my $type = ${$self -> {'default'} }{$_}{'type'};
1959 push(@{$self -> {'type'} }, "$_$type");
1960 $self->{'opt'}->{$_} = ${$self -> {'default'} }{$_}{'linkage'}
1961 if ${$self -> {'default'} }{$_}{'linkage'};
1964 my($result) = &GetOptions($self -> {'opt'}, @{$self -> {'type'} });
1966 return $result unless $result;
1968 for (keys(%{$self -> {'default'} }) )
1970 if (! defined(${$self -> {'opt'} }{$_})) #{
1972 ${$self -> {'opt'} }{$_} = ${$self -> {'default'} }{$_}{'default'};
1977 } # End of getOptions.
1979 # --------------------------------------------------------------------------
1984 my($noHelp) = shift;
1985 $noHelp = 0 unless $noHelp;
1986 my($optwidth, $typewidth, $defaultwidth, $maxlinewidth, $valind, $valwidth)
1987 = (10, 5, 9, 78, 4, 11);
1989 print "$self->{'helpText'}" if ($self -> {'helpText'});
1991 print ' Option', ' ' x ($optwidth - length('Option') -1 ),
1992 'Type', ' ' x ($typewidth - length('Type') + 1),
1993 'Default', ' ' x ($defaultwidth - length('Default') ),
1996 for (sort byOrder keys(%{$self -> {'default'} }) )
1998 my($line, $help, $option, $val);
2000 next if ${$self->{'default'} }{$_}{'noHelp'} && ${$self->{'default'} }{$_}{'noHelp'} > $noHelp;
2001 #$line = " -$_" . ' ' x ($optwidth - (2 + length) ) .
2002 # "${$self->{'default'} }{$_}{'type'} ".
2003 # ' ' x ($typewidth - (1+length(${$self -> {'default'} }{$_}{'type'}) ));
2004 $line = " -$_" . "${$self->{'default'} }{$_}{'type'}".
2005 ' ' x ($typewidth - (1+length(${$self -> {'default'} }{$_}{'type'}) ));
2007 $val = ${$self->{'default'} }{$_}{'linkage'};
2010 if (ref($val) eq 'SCALAR')
2021 $val = ${$self->{'default'} }{$_}{'default'};
2024 $line .= ' ' x ($optwidth + $typewidth + $defaultwidth + 1 - length($line));
2026 if (defined(${$self -> {'default'} }{$_}{'verbose'}) &&
2027 ${$self -> {'default'} }{$_}{'verbose'} ne '')
2029 $help = "${$self->{'default'} }{$_}{'verbose'}";
2035 if ((length("$line") + length($help)) < $maxlinewidth)
2037 print $line , $help, "\n";
2041 print $line, "\n", ' ' x $valind, $help, "\n";
2043 for $val (sort byOrder keys(%{${$self->{'default'}}{$option}{'values'}}))
2045 print ' ' x ($valind + 2);
2046 print $val, ' ', ' ' x ($valwidth - length($val) - 2);
2047 print ${$self->{'default'}}{$option}{'values'}{$val}, "\n";
2052 Note: 'Options' may be abbreviated. 'Type' specifications mean:
2053 <none>| ! no argument: variable is set to 1 on -foo (or, to 0 on -nofoo)
2054 =s | :s mandatory (or, optional) string argument
2055 =i | :i mandatory (or, optional) integer argument
2057 } # End of helpOptions.
2059 #-------------------------------------------------------------------
2065 $self -> {'default'} = {};
2066 $self -> {'helpText'} = '';
2067 $self -> {'opt'} = {};
2068 $opt = $self -> {'opt'}; # An alias for $self -> {'opt'}.
2069 $self -> {'type'} = ();
2071 return bless $self, $class;
2075 # --------------------------------------------------------------------------
2081 require "$ENV{T2H_HOME}/MySimple.pm"
2082 if ($0 =~ /\.pl$/ &&
2083 -e
"$ENV{T2H_HOME}/MySimple.pm" && -r
"$ENV{T2H_HOME}/MySimple.pm");
2087 #+++############################################################################
2091 #---############################################################################
2103 $BIBRE = '\[[\w\/-]+\]'; # RE for a bibliography reference
2104 $FILERE = '[\/\w.+-]+'; # RE for a file name
2105 $VARRE = '[^\s\{\}]+'; # RE for a variable name
2106 $NODERE = '[^,:]+'; # RE for a node name
2107 $NODESRE = '[^:]+'; # RE for a list of node names
2109 $ERROR = "***"; # prefix for errors
2110 $WARN = "**"; # prefix for warnings
2113 $PROTECTTAG = "_ThisIsProtected_"; # tag to recognize protected sections
2115 $CHAPTEREND = "<!-- End chapter -->\n"; # to know where a chpater ends
2116 $SECTIONEND = "<!-- End section -->\n"; # to know where section ends
2117 $TOPEND = "<!-- End top -->\n"; # to know where top ends
2122 # pre-defined indices
2126 'c' => { name
=> 'cp'},
2127 'f' => { name
=> 'fn', code
=> 1},
2128 'v' => { name
=> 'vr', code
=> 1},
2129 'k' => { name
=> 'ky', code
=> 1},
2130 'p' => { name
=> 'pg', code
=> 1},
2131 't' => { name
=> 'tp', code
=> 1}
2135 %predefined_index = (
2157 # texinfo section names to level
2170 'appendixsection', 2,
2172 'unnumberedsubsec', 3,
2174 'appendixsubsec', 3,
2176 'unnumberedsubsubsec', 4,
2178 'appendixsubsubsec', 4,
2182 # accent map, TeX command to ISO name
2193 # texinfo "simple things" (@foo) to HTML ones
2197 "*", "<BR>", # HTML+
2200 "-", "­", # soft hyphen
2203 'tab', '<\/TD><TD>',
2214 # texinfo "things" (@foo{}) to HTML ones
2218 'br', '<P>', # paragraph break
2220 #'copyright', '(C)',
2221 'copyright', '©',
2222 'dots', '<small>...<\/small>',
2223 'enddots', '<small>....<\/small>',
2225 'error', 'error-->',
2231 # APA: &pretty_date requires $MONTH_NAMES and $T2H_LANG
2232 # to be initialized. The latter gets initialized by
2233 # &SetDocumentLanguage in &main.
2234 # We set following hash entry in &main afterwards.
2235 # 'today', &pretty_date,
2247 'exclamdown', '¡',
2248 'questiondown', '¿',
2253 # texinfo styles (@foo{bar}) to HTML ones
2256 'acronym', 'ACRONYM',
2262 'ctrl', '&do_ctrl', # special case
2263 'dfn', 'EM', # DFN tag is illegal in the standard
2264 'dmn', '', # useless
2265 'email', '&do_email', # insert a clickable email address
2268 'file', '"TT', # will put quotes, cf. &apply_style
2273 'option', '"SAMP', # will put quotes, cf. &apply_style
2274 'r', '', # unsupported
2275 'samp', '"SAMP', # will put quotes, cf. &apply_style
2276 'sc', '&do_sc', # special case
2279 'titlefont', '', # useless
2280 'uref', '&do_uref', # insert a clickable URL
2281 'url', '&do_url', # insert a clickable URL
2283 'w', '', # unsupported
2285 'dotaccent', '&do_accent',
2286 'ringaccent','&do_accent',
2287 'tieaccent', '&do_accent',
2289 'ubaraccent','&do_accent',
2290 'udotaccent','&do_accent',
2293 'dotless', '&do_accent'
2297 # texinfo format (@foo/@end foo) to HTML ones
2300 'quotation', 'BLOCKQUOTE',
2306 'flushright', 'PRE',
2310 # an eval of these $complex_format_map->{what}->[0] yields beginning
2311 # an eval of these $complex_format_map->{what}->[1] yieleds end
2312 $complex_format_map =
2316 q{"<TABLE><tr>$T2H_EXAMPLE_INDENT_CELL<td class=example><pre>"},
2317 q{'</pre></td></tr></table>'}
2321 q{"<TABLE><tr>$T2H_EXAMPLE_INDENT_CELL<td class=example><pre>"},
2322 q{'</pre></td></tr></table>'}
2326 q{"<TABLE><tr>$T2H_SMALL_EXAMPLE_INDENT_CELL<td class=smallexample><pre><FONT SIZE=$T2H_SMALL_FONT_SIZE>"},
2327 q{'</FONT></pre></td></tr></table>'}
2331 q{"<TABLE><tr>$T2H_EXAMPLE_INDENT_CELL<td class=display><pre " . 'style="font-family: serif">'},
2332 q{'</pre></td></tr></table>'}
2336 q{"<TABLE><tr>$T2H_SMALL_EXAMPLE_INDENT_CELL<td class=smalldisplay><pre " . 'style="font-family: serif"><FONT SIZE=$T2H_SMALL_FONT_SIZE>'},
2337 q{'</FONT></pre></td></tr></table>'}
2341 $complex_format_map->{lisp
} = $complex_format_map->{example
};
2342 $complex_format_map->{smalllisp
} = $complex_format_map->{smallexample
};
2343 $complex_format_map->{format
} = $complex_format_map->{display
};
2344 $complex_format_map->{smallformat
} = $complex_format_map->{smalldisplay
};
2347 # texinfo definition shortcuts to real ones
2371 'defun', 'deffn Function',
2372 'defmac', 'deffn Macro',
2373 'defspec', 'deffn {Special Form}',
2374 'defvar', 'defvr Variable',
2375 'defopt', 'defvr {User Option}',
2376 'deftypefun', 'deftypefn Function',
2377 'deftypevar', 'deftypevr Variable',
2378 'defivar', 'defcv {Instance Variable}',
2379 'deftypeivar', 'defcv {Instance Variable}', # NEW: FIXME
2380 'defmethod', 'defop Method',
2381 'deftypemethod', 'defop Method', # NEW:FIXME
2383 'defunx', 'deffnx Function',
2384 'defmacx', 'deffnx Macro',
2385 'defspecx', 'deffnx {Special Form}',
2386 'defvarx', 'defvrx Variable',
2387 'defoptx', 'defvrx {User Option}',
2388 'deftypefunx', 'deftypefnx Function',
2389 'deftypevarx', 'deftypevrx Variable',
2390 'defivarx', 'defcvx {Instance Variable}',
2391 'defmethodx', 'defopx Method',
2412 'summarycontents', 1,
2418 # unsupported commands (formatting)
2426 'setchapternewpage', 1,
2436 'paragraphindent', 1,
2437 # unsupported formats
2444 #+++############################################################################
2446 # Argument parsing, initialisation #
2448 #---############################################################################
2451 # flush stdout and stderr after every write
2459 %value = (); # hold texinfo variables, see also -D
2460 $use_bibliography = 1;
2464 # called on -init-file
2467 my $init_file = shift;
2468 # second argument is value of options
2472 print "# reading initialization file from $init_file\n"
2474 require($init_file);
2478 print "$ERROR Error: can't read init file $int_file\n";
2485 sub SetDocumentLanguage
2488 if (! exists($T2H_WORDS->{$lang}))
2490 warn "$ERROR: Language specs for '$lang' do not exists. Reverting to '" .
2491 ($T2H_LANG ?
$T2H_LANG : "en") . "'\n";
2495 print "# using '$lang' as document language\n" if ($T2H_VERBOSE);
2501 ## obsolete cmd line options
2503 $T2H_OBSOLETE_OPTIONS -> {'no-section_navigation'} =
2506 linkage
=> sub {$T2H_SECTION_NAVIGATION = 0;},
2507 verbose
=> 'obsolete, use -nosec_nav',
2510 $T2H_OBSOLETE_OPTIONS -> {use_acc
} =
2513 linkage
=> \
$use_acc,
2514 verbose
=> 'obsolete',
2517 $T2H_OBSOLETE_OPTIONS -> {expandinfo
} =
2520 linkage
=> sub {$T2H_EXPAND = 'info';},
2521 verbose
=> 'obsolete, use "-expand info" instead',
2524 $T2H_OBSOLETE_OPTIONS -> {expandtex
} =
2527 linkage
=> sub {$T2H_EXPAND = 'tex';},
2528 verbose
=> 'obsolete, use "-expand tex" instead',
2531 $T2H_OBSOLETE_OPTIONS -> {monolithic
} =
2534 linkage
=> sub {$T2H_SPLIT = '';},
2535 verbose
=> 'obsolete, use "-split no" instead',
2538 $T2H_OBSOLETE_OPTIONS -> {split_node
} =
2541 linkage
=> sub{$T2H_SPLIT = 'section';},
2542 verbose
=> 'obsolete, use "-split section" instead',
2545 $T2H_OBSOLETE_OPTIONS -> {split_chapter
} =
2548 linkage
=> sub{$T2H_SPLIT = 'chapter';},
2549 verbose
=> 'obsolete, use "-split chapter" instead',
2552 $T2H_OBSOLETE_OPTIONS -> {no_verbose
} =
2555 linkage
=> sub {$T2H_VERBOSE = 0;},
2556 verbose
=> 'obsolete, use -noverbose instead',
2559 $T2H_OBSOLETE_OPTIONS -> {output_file
} =
2562 linkage
=> sub {$T2H_OUT = $_[1]; $T2H_SPLIT = '';},
2563 verbose
=> 'obsolete, use -out_file instead',
2567 $T2H_OBSOLETE_OPTIONS -> {section_navigation
} =
2570 linkage
=> \
$T2H_SECTION_NAVIGATION,
2571 verbose
=> 'obsolete, use -sec_nav instead',
2575 $T2H_OBSOLETE_OPTIONS -> {verbose
} =
2578 linkage
=> \
$T2H_VERBOSE,
2579 verbose
=> 'obsolete, use -Verbose instead',
2583 # read initialzation from $sysconfdir/texi2htmlrc or $HOME/.texi2htmlrc
2584 my $home = $ENV{HOME
};
2585 defined($home) or $home = '';
2586 foreach $i ('/etc/texi2htmlrc', "$home/.texi2htmlrc")
2590 print "# reading initialization file from $i\n"
2597 #+++############################################################################
2599 # parse command-line options
2601 #---############################################################################
2602 $T2H_USAGE_TEXT = <<EOT;
2603 Usage: texi2html [OPTIONS] TEXINFO-FILE
2604 Translates Texinfo source documentation to HTML.
2606 $T2H_FAILURE_TEXT = <<EOT;
2607 Try 'texi2html -help' for usage instructions.
2609 $options = new Getopt
::MySimple
;
2611 # some older version of GetOpt::Long don't have
2612 # Getopt::Long::Configure("pass_through")
2613 eval {Getopt
::Long
::Configure
("pass_through");};
2614 $Configure_failed = $@
&& <<EOT;
2615 **WARNING: Parsing of obsolete command-line options could have failed.
2616 Consider to use only documented command-line options (run
2617 'texi2html -help 2' for a complete list) or upgrade to perl
2618 version 5.005 or higher.
2621 if (! $options->getOptions($T2H_OPTIONS, $T2H_USAGE_TEXT, "$THISVERSION\n"))
2623 print $Configure_failed if $Configure_failed;
2624 die $T2H_FAILURE_TEXT;
2629 eval {Getopt
::Long
::Configure
("no_pass_through");};
2630 if (! $options->getOptions($T2H_OBSOLETE_OPTIONS, $T2H_USAGE_TEXT, "$THISVERSION\n"))
2632 print $Configure_failed if $Configure_failed;
2633 die $T2H_FAILURE_TEXT;
2639 die "Need file to check\n$T2H_FAILURE_TEXT" unless @ARGV > 0;
2644 #+++############################################################################
2646 # evaluation of cmd line options
2648 #---############################################################################
2650 if ($T2H_EXPAND eq 'info')
2652 $to_skip{'ifinfo'} = 1;
2653 $to_skip{'end ifinfo'} = 1;
2655 elsif ($T2H_EXPAND eq 'tex')
2657 $to_skip{'iftex'} = 1;
2658 $to_skip{'end iftex'} = 1;
2662 $T2H_INVISIBLE_MARK = '<IMG SRC="invisible.xbm">' if $T2H_INVISIBLE_MARK eq 'xbm';
2665 # file name buisness
2667 die "Need exactly one file to translate\n$T2H_FAILURE_TEXT" unless @ARGV == 1;
2668 $docu = shift(@ARGV);
2669 if ($docu =~ /.*\//)
2671 chop($docu_dir = $&);
2679 unshift(@T2H_INCLUDE_DIRS, $docu_dir);
2680 $docu_name =~ s/\.te?x(i|info)?$//; # basename of the document
2681 $docu_name = $T2H_PREFIX if ($T2H_PREFIX);
2684 if ($T2H_SUBDIR && ! $T2H_OUT)
2686 $T2H_SUBDIR =~ s|/*$||;
2687 unless (-d "$T2H_SUBDIR" && -w "$T2H_SUBDIR")
2689 if ( mkdir($T2H_SUBDIR, oct(755)))
2691 print "# created directory $T2H_SUBDIR\n" if ($T2H_VERBOSE);
2695 warn "$ERROR can't create directory
$T2H_SUBDIR. Put results into current directory
\n";
2701 if ($T2H_SUBDIR && ! $T2H_OUT)
2703 $docu_rdir = "$T2H_SUBDIR/";
2704 print "# putting result files into directory $docu_rdir\n" if ($T2H_VERBOSE);
2708 if ($T2H_OUT && $T2H_OUT =~ m
|(.*)/|)
2711 print "# putting result files into directory $docu_rdir\n" if ($T2H_VERBOSE);
2715 print "# putting result files into current directory \n" if ($T2H_VERBOSE);
2729 if ($T2H_TOP_FILE =~ /\..*$/)
2731 $T2H_TOP_FILE = $`.".$docu_ext";
2735 if (! $T2H_OUT && ($T2H_SPLIT =~ /section/i || $T2H_SPLIT =~ /node/i))
2737 $T2H_SPLIT = 'section';
2739 elsif (! $T2H_OUT && $T2H_SPLIT =~ /chapter/i)
2741 $T2H_SPLIT = 'chapter'
2748 $docu_doc = "$docu_name.$docu_ext"; # document's contents
2749 $docu_doc_file = "$docu_rdir$docu_doc";
2752 $docu_toc = $T2H_TOC_FILE || "${docu_name}_toc.$docu_ext"; # document's table of contents
2753 $docu_stoc = "${docu_name}_ovr.$docu_ext"; # document's short toc
2754 $docu_foot = "${docu_name}_fot.$docu_ext"; # document's footnotes
2755 $docu_about = "${docu_name}_abt.$docu_ext"; # about this document
2756 $docu_top = $T2H_TOP_FILE || $docu_doc;
2762 $docu_doc = $T2H_OUT;
2763 $docu_doc =~ s|.*/||;
2765 $docu_toc = $docu_foot = $docu_stoc = $docu_about = $docu_top = $docu_doc;
2768 $docu_toc_file = "$docu_rdir$docu_toc";
2769 $docu_stoc_file = "$docu_rdir$docu_stoc";
2770 $docu_foot_file = "$docu_rdir$docu_foot";
2771 $docu_about_file = "$docu_rdir$docu_about";
2772 $docu_top_file = "$docu_rdir$docu_top";
2774 $docu_frame_file = "$docu_rdir${docu_name}_frame.$docu_ext";
2775 $docu_toc_frame_file = "$docu_rdir${docu_name}_toc_frame.$docu_ext";
2780 $value{'html'} = 1; # predefine html (the output format)
2781 $value{'texi2html'} = $THISVERSION; # predefine texi2html (the translator)
2782 # _foo: internal to track @foo
2783 foreach ('_author', '_title', '_subtitle',
2784 '_settitle', '_setfilename', '_shorttitle')
2786 $value{$_} = ''; # prevent -w warnings
2788 %node2sec = (); # node to section name
2789 %sec2node = (); # section to node name
2790 %sec2seccount = (); # section to section count
2791 %seccount2sec = (); # section count to section
2792 %sec2number = (); # section to number
2793 # $number =~ ^[\dA-Z]+\.(\d+(\.\d+)*)?$
2794 %number2sec = (); # number to section
2795 %idx2node = (); # index keys to node
2796 %node2href = (); # node to HREF
2797 %node2next = (); # node to next
2798 %node2prev = (); # node to prev
2799 %node2up = (); # node to up
2800 %bib2href = (); # bibliography reference to HREF
2801 %gloss2href = (); # glossary term to HREF
2802 @sections = (); # list of sections
2803 %tag2pro = (); # protected sections
2817 # can I use ISO8859 characters? (HTML+)
2821 $things_map{'bullet'} = "•";
2822 $things_map{'copyright'} = "©";
2823 $things_map{'dots'} = "…";
2824 $things_map{'equiv'} = "≡";
2825 $things_map{'expansion'} = "→";
2826 $things_map{'point'} = "∗";
2827 $things_map{'result'} = "⇒";
2831 # read texi2html extensions (if any)
2833 $extensions = 'texi2html.ext'; # extensions in working directory
2836 print "# reading extensions from $extensions\n" if $T2H_VERBOSE;
2837 require($extensions);
2839 ($progdir = $0) =~ s/[^\/]+$//;
2840 if ($progdir && ($progdir ne './'))
2842 $extensions = "${progdir}texi2html.ext"; # extensions in texi2html directory
2845 print "# reading extensions from $extensions\n" if $T2H_VERBOSE;
2846 require($extensions);
2851 print "# reading from $docu\n" if $T2H_VERBOSE;
2853 #########################################################################
2857 # latex2html conversions consist of three stages:
2858 # 1) ToLatex: Put "latex" code into a latex file
2859 # 2) ToHtml: Use latex2html to generate corresponding html code and images
2860 # 3) FromHtml: Extract generated code and images from latex2html run
2863 ##########################
2867 # defaults for files and names
2872 return 0 unless ($root);
2873 $l2h_name = "${root}_l2h";
2874 $l2h_latex_file = "$docu_rdir${l2h_name}.tex";
2875 $l2h_cache_file = "${docu_rdir}l2h_cache.pm";
2876 $T2H_L2H_L2H = "latex2html" unless ($T2H_L2H_L2H);
2877 # destination dir -- generated images are put there, should be the same
2878 # as dir of enclosing html document --
2879 $l2h_html_file = "$docu_rdir${l2h_name}.html";
2880 $l2h_prefix = "${l2h_name}_";
2885 ##########################
2887 # First stage: Generation of Latex file
2888 # Initialize with: l2h_InitToLatex
2889 # Add content with: l2h_ToLatex($text) --> HTML placeholder comment
2890 # Finish with: l2h_FinishToLatex
2893 $l2h_latex_preample = <<EOT;
2894 % This document was automatically generated by the l2h extenstion of texi2html
2896 \\documentclass{article}
2901 $l2h_latex_closing = <<EOT;
2905 # return used latex 1, if l2h could be initalized properly, 0 otherwise
2909 unless ($T2H_L2H_SKIP)
2911 unless (open(L2H_LATEX
, ">$l2h_latex_file"))
2913 warn "$ERROR Error l2h: Can't open latex file '$latex_file' for writing\n";
2916 print "# l2h: use ${l2h_latex_file} as latex file\n" if ($T2H_VERBOSE);
2917 print L2H_LATEX
$l2h_latex_preample;
2919 # open database for caching
2921 $l2h_latex_count = 0;
2922 $l2h_to_latex_count = 0;
2923 $l2h_cached_count = 0;
2927 # print text (1st arg) into latex file (if not already there), return
2928 # HTML commentary which can be later on replaced by the latex2html
2934 $l2h_to_latex_count++;
2935 $text =~ s/(\s*)$//;
2936 # try whether we can cache it
2937 my $cached_text = l2h_FromCache
($text);
2940 $l2h_cached_count++;
2941 return $cached_text;
2943 # try whether we have text already on things to do
2944 unless ($count = $l2h_to_latex{$text})
2946 $count = $l2h_latex_count;
2948 $l2h_to_latex{$text} = $count;
2949 $l2h_to_latex[$count] = $text;
2950 unless ($T2H_L2H_SKIP)
2952 print L2H_LATEX
"\\begin{rawhtml}\n";
2953 print L2H_LATEX
"<!-- l2h_begin ${l2h_name} ${count} -->\n";
2954 print L2H_LATEX
"\\end{rawhtml}\n";
2956 print L2H_LATEX
"$text\n";
2958 print L2H_LATEX
"\\begin{rawhtml}\n";
2959 print L2H_LATEX
"<!-- l2h_end ${l2h_name} ${count} -->\n";
2960 print L2H_LATEX
"\\end{rawhtml}\n";
2963 return "<!-- l2h_replace ${l2h_name} ${count} -->";
2966 # print closing into latex file and close it
2967 sub l2h_FinishToLatex
2970 $reused = $l2h_to_latex_count - $l2h_latex_count - $l2h_cached_count;
2971 unless ($T2H_L2H_SKIP)
2973 print L2H_LATEX
$l2h_latex_closing;
2976 print "# l2h: finished to latex ($l2h_cached_count cached, $reused reused, $l2h_latex_count contents)\n" if ($T2H_VERBOSE);
2977 unless ($l2h_latex_count)
2985 ###################################
2986 # Second stage: Use latex2html to generate corresponding html code and images
2988 # l2h_ToHtml([$l2h_latex_file, [$l2h_html_dir]]):
2989 # Call latex2html on $l2h_latex_file
2990 # Put images (prefixed with $l2h_name."_") and html file(s) in $l2h_html_dir
2991 # Return 1, on success
2996 local($call, $ext, $root, $dotbug);
2999 print "# l2h: skipping latex2html run\n" if ($T2H_VERBOSE);
3002 # Check for dot in directory where dvips will work
3005 if ($T2H_L2H_TMP =~ /\./)
3007 warn "$ERROR Warning l2h: l2h_tmp dir contains a dot. Use /tmp, instead\n";
3013 if (&getcwd
=~ /\./)
3015 warn "$ERROR Warning l2h: current dir contains a dot. Use /tmp as l2h_tmp dir \n";
3019 # fix it, if necessary and hope that it works
3020 $T2H_L2H_TMP = "/tmp" if ($dotbug);
3022 $call = $T2H_L2H_L2H;
3023 # use init file, if specified
3024 $call = $call . " -init_file " . $init_file if ($init_file && -f
$init_file);
3026 $call .= ($docu_rdir ?
" -dir $docu_rdir" : " -no_subdir");
3027 # use l2h_tmp, if specified
3028 $call = $call . " -tmp $T2H_L2H_TMP" if ($T2H_L2H_TMP);
3029 # options we want to be sure of
3030 $call = $call ." -address 0 -info 0 -split 0 -no_navigation -no_auto_link";
3031 $call = $call ." -prefix ${l2h_prefix} $l2h_latex_file";
3033 print "# l2h: executing '$call'\n" if ($T2H_VERBOSE);
3036 warn "l2h ***Error: '${call}' did not succeed\n";
3041 print "# l2h: latex2html finished successfully\n" if ($T2H_VERBOSE);
3046 # this is directly pasted over from latex2html
3051 die "'pwd' failed (out of memory?)\n"
3058 ##########################
3059 # Third stage: Extract generated contents from latex2html run
3060 # Initialize with: l2h_InitFromHtml
3061 # open $l2h_html_file for reading
3062 # reads in contents into array indexed by numbers
3063 # return 1, on success -- 0, otherwise
3064 # Extract Html code with: l2h_FromHtml($text)
3065 # replaces in $text all previosuly inserted comments by generated html code
3066 # returns (possibly changed) $text
3067 # Finish with: l2h_FinishFromHtml
3068 # closes $l2h_html_dir/$l2h_name.".$docu_ext"
3070 sub l2h_InitFromHtml
3072 local($h_line, $h_content, $count, %l2h_img);
3074 if (! open(L2H_HTML
, "<${l2h_html_file}"))
3076 print "$ERROR Error l2h: Can't open ${l2h_html_file} for reading\n";
3079 print "# l2h: use ${l2h_html_file} as html file\n" if ($T2H_VERBOSE);
3081 $l2h_html_count = 0;
3082 while ($h_line = <L2H_HTML
>)
3084 if ($h_line =~ /^<!-- l2h_begin $l2h_name ([0-9]+) -->/)
3088 while ($h_line = <L2H_HTML
>)
3090 if ($h_line =~ /^<!-- l2h_end $l2h_name $count -->/)
3095 $h_content = l2h_ToCache
($count, $h_content);
3096 $l2h_from_html[$count] = $h_content;
3100 $h_content = $h_content.$h_line;
3104 print "$ERROR Warning l2h: l2h_end $l2h_name $count not found\n"
3111 print "# l2h: Got $l2h_html_count of $l2h_latex_count html contents\n"
3121 my($done, $to_do, $count);
3123 while ($to_do =~ /([^\000]*)<!-- l2h_replace $l2h_name ([0-9]+) -->([^\000]*)/)
3128 $done = "<!-- l2h_end $l2h_name $count -->".$done
3129 if ($T2H_DEBUG & $DEBUG_L2H);
3131 $done = &l2h_ExtractFromHtml
($count) . $done;
3133 $done = "<!-- l2h_begin $l2h_name $count -->".$done
3134 if ($T2H_DEBUG & $DEBUG_L2H);
3136 return $to_do.$done;
3140 sub l2h_ExtractFromHtml
3143 return $l2h_from_html[$count] if ($l2h_from_html[$count]);
3144 if ($count >= 0 && $count < $l2h_latex_count)
3146 # now we are in trouble
3149 $l2h_extract_error++;
3150 print "$ERROR l2h: can't extract content $count from html\n"
3152 # try simple (ordinary) substition (without l2h)
3155 $_ = $l2h_to_latex{$count};
3156 $_ = &substitute_style
($_);
3158 $_ = "<!-- l2h: ". __LINE__
. " use texi2html -->" . $_
3159 if ($T2H_DEBUG & $DEBUG_L2H);
3165 # now we have been incorrectly called
3167 print "$ERROR l2h: Request of $count content which is out of valide range [0,$l2h_latex_count)\n";
3168 return "<!-- l2h: ". __LINE__
. " out of range count $count -->"
3169 if ($T2H_DEBUG & $DEBUG_L2H);
3170 return "<!-- l2h: out of range count $count -->";
3174 sub l2h_FinishFromHtml
3178 if ($l2h_extract_error + $l2h_range_error)
3180 print "# l2h: finished from html ($l2h_extract_error extract and $l2h_range_error errors)\n";
3184 print "# l2h: finished from html (no errors)\n";
3194 print "# l2h: removing temporary files generated by l2h extension\n"
3196 while (<"$docu_rdir$l2h_name"*>)
3201 print "# l2h: Finished\n" if $T2H_VERBOSE;
3205 ##############################
3206 # stuff for l2h caching
3209 # I tried doing this with a dbm data base, but it did not store all
3210 # keys/values. Hence, I did as latex2html does it
3213 if (-r
"$l2h_cache_file")
3215 my $rdo = do "$l2h_cache_file";
3216 warn("$ERROR l2h Error: could not load $docu_rdir$l2h_cache_file: $@\n")
3223 return unless $l2h_latex_count;
3225 open(FH
, ">$l2h_cache_file") || return warn"$ERROR l2h Error: could not open $docu_rdir$l2h_cache_file for writing: $!\n";
3226 while (($key, $value) = each %l2h_cache)
3230 $key =~ s
|\\\\/|\\/|g
;
3231 # weird, a \ at the end of the key results in an error
3232 # maybe this also broke the dbm database stuff
3233 $key =~ s
|\\$|\\\\|;
3234 $value =~ s/\|/\\\|/go;
3235 $value =~ s/\\\\\|/\\\|/go;
3236 $value =~ s
|\\\\|\\\\\\\\|g
;
3237 print FH
"\n\$l2h_cache_key = q/$key/;\n";
3238 print FH
"\$l2h_cache{\$l2h_cache_key} = q|$value|;\n";
3244 # return cached html, if it exists for text, and if all pictures
3245 # are there, as well
3249 my $cached = $l2h_cache{$text};
3252 while ($cached =~ m/SRC="(.*?)"/g)
3254 unless (-e
"$docu_rdir$1")
3264 # insert generated html into cache, move away images,
3265 # return transformed html
3270 my $content = shift;
3271 my @images = ($content =~ /SRC="(.*?)"/g);
3276 $dest = $l2h_img{$src};
3280 if ($src =~ /.*\.(.*)$/ && $1 ne $docu_ext)
3286 warn "$ERROR: L2h image $src has invalid extension\n";
3289 while (-e
"$docu_rdir${docu_name}_$maximage.$ext")
3293 $dest = "${docu_name}_$maximage.$ext";
3294 system("cp -f $docu_rdir$src $docu_rdir$dest");
3295 $l2h_img{$src} = $dest;
3296 unlink "$docu_rdir$src" unless ($DEBUG & $DEBUG_L2H);
3298 $content =~ s/$src/$dest/g;
3300 $l2h_cache{$l2h_to_latex[$count]} = $content;
3305 #+++############################################################################
3307 # Pass 1: read source, handle command, variable, simple substitution #
3309 #---############################################################################
3314 @lines = (); # whole document
3315 @toc_lines = (); # table of contents
3316 @stoc_lines = (); # table of contents
3317 $curlevel = 0; # current level in TOC
3318 $node = ''; # current node name
3319 $node_next = ''; # current node next name
3320 $node_prev = ''; # current node prev name
3321 $node_up = ''; # current node up name
3322 $in_table = 0; # am I inside a table
3323 $table_type = ''; # type of table ('', 'f', 'v', 'multi')
3324 @tables = (); # nested table support
3325 $in_bibliography = 0; # am I inside a bibliography
3326 $in_glossary = 0; # am I inside a glossary
3327 $in_top = 0; # am I inside the top node
3328 $has_top = 0; # did I see a top node?
3329 $has_top_command = 0; # did I see @top for automatic pointers?
3330 $in_pre = 0; # am I inside a preformatted section
3331 $in_list = 0; # am I inside a list
3332 $in_html = 0; # am I inside an HTML section
3333 $first_line = 1; # is it the first line
3334 $dont_html = 0; # don't protect HTML on this line
3335 $deferred_ref = ''; # deferred reference for indexes
3336 @html_stack = (); # HTML elements stack
3337 $html_element = ''; # current HTML element
3339 %macros = (); # macros
3340 $toc_indent = # used for identation in TOC's
3341 ($T2H_NUMBER_SECTIONS ?
'BLOCKQUOTE' : 'UL');
3344 $T2H_L2H = &l2h_Init
($docu_name) if ($T2H_L2H);
3345 $T2H_L2H = &l2h_InitToLatex
if ($T2H_L2H);
3347 # build code for simple substitutions
3348 # the maps used (%simple_map and %things_map) MUST be aware of this
3349 # watch out for regexps, / and escaped characters!
3351 foreach (keys(%simple_map))
3353 ($re = $_) =~ s/(\W)/\\$1/g; # protect regexp chars
3354 $subst_code .= "s/\\\@$re/$simple_map{$_}/g;\n";
3356 foreach (keys(%things_map))
3358 $subst_code .= "s/\\\@$_\\{\\}/$things_map{$_}/g;\n";
3362 # accentuated characters
3363 foreach (keys(%accent_map))
3367 $subst_code .= "s/$;3";
3371 $subst_code .= "s/$;4";
3375 $subst_code .= "s/\\\@\\$_";
3377 $subst_code .= "([a-z])/&\${1}$accent_map{$_};/gi;\n";
3380 eval("sub simple_substitutions { $subst_code }");
3383 INPUT_LINE
: while ($_ = &next_line
)
3386 # remove \input on the first lines only
3393 # non-@ substitutions cf. texinfmt.el
3395 # parse texinfo tags
3399 if (/^\s*\@end\s+(\w+)\b/)
3403 elsif (/^\s*\@(\w+)\b/)
3408 # handle @html / @end html
3412 if ($end_tag eq 'html')
3418 $tag2pro{$in_html} .= $_;
3422 elsif ($tag eq 'html')
3424 $in_html = $PROTECTTAG . ++$html_num;
3425 push(@lines, $in_html);
3430 # try to remove inlined comments
3431 # syntax from tex-mode.el comment-start-skip
3433 s/((^|[^\@])(\@\@)*)\@(c( |\{)|comment ).*$/$1/;
3435 # Sometimes I use @c right at the end of a line ( to suppress the line feed )
3436 # s/((^|[^\@])(\@\@)*)\@c(omment)?$/$1/;
3437 # s/((^|[^\@])(\@\@)*)\@c(omment)? .*/$1/;
3438 # s/(.*)\@c{.*?}(.*)/$1$2/;
3439 # s/(.*)\@comment{.*?}(.*)/$1$2/;
3441 # s/^(.*)\@comment /$1/;
3443 #############################################################
3444 # value substitution before macro expansion, so that
3445 # it works in macro arguments
3446 s/\@value{($VARRE)}/$value{$1}/eg;
3448 #############################################################
3449 # macro substitution
3452 if (exists($macros->{$1}))
3459 #####################################################
3460 # Support for multi-line macro invocations and nested
3461 # '{' and '}' within macro invocations added by
3462 # Eric Sunshine <sunshine@sunshineco.com> 2000/09/10.
3463 #####################################################
3464 if ($after =~ /^\s*\{/) # Macro arguments delimited by '{' and '}'?
3466 my ($protect, $start, $end, $depth, $c) = (0, 0, 0, 0, 0);
3467 foreach $c (unpack('C*', $after))
3470 { # Character protected by '\' or '@'; pass through unmolested.
3473 elsif ($c == ord('\\') || $c == ord('@'))
3474 { # '\' and '@' remove special meaning of next character.
3477 elsif ($c == ord('{')) # Allow '{' and '}' to nest.
3481 elsif ($c == ord('}'))
3484 last if $depth == 0;
3486 $start++ if !$depth; # Position of opening brace.
3487 $end++; # Position of closing brace.
3490 # '{' & '}' did not completely unnest; append next line; try again.
3493 my $paste = &next_line;
3494 die "$ERROR Missing closing brace '}' for invocation of macro " .
3495 "\"\@$name\" on line:\n", substr($_,0,70), "...\n" unless $paste;
3497 unshift @input_spool, $_ . $paste;
3501 # Extract macro arguments from within '{' and '}'.
3502 $len = $end - $start - 1;
3503 $args = ($len > 0) ? substr($after, $start + 1, $len) : '';
3504 $after = substr($after, $end + 1);
3506 ############ End Sunshine Modifications #############
3507 elsif (@{$macros->{$name}->{Args}} == 1) # Macro arg extends to EOL.
3514 $args =~ s|\\\\|\\|g;
3517 if (@{$macros->{$name}->{Args}} > 1)
3519 $args =~ s/(^|[^\\]),/$1$;/g ;
3521 @args = split(/$;\s*/, $args) if (@{$macros->{$name}->{Args}} > 1);
3528 my $macrobody = $macros->{$name}->{Body};
3529 for ($i=0; $i<=$#args; $i++)
3531 $macrobody =~ s|\\$macros->{$name}->{Args}->[$i]\\|$args[$i]|g;
3533 $macrobody =~ s|\\\\|\\|g;
3534 $_ = $before . $macrobody . $after;
3535 unshift @input_spool, map {$_ = $_."\n"} split(/\n/, $_);
3540 # try to skip the line
3544 $in_titlepage = 0 if $end_tag eq 'titlepage';
3545 next if $to_skip{"end $end_tag"};
3549 $in_titlepage = 1 if $tag eq 'titlepage';
3550 next if $to_skip{$tag};
3551 last if $tag eq 'bye';
3555 # parsing the top node
3556 if ($tag eq 'node' ||
3557 ($sec2level{$tag} && $tag !~ /unnumbered/ && $tag !~ /heading/))
3561 push(@lines, $TOPEND);
3568 s/([\w ])---([\w ])/$1--$2/g;
3576 &skip_until($tag), next if $tag eq 'ignore';
3577 &skip_until($tag), next if $tag eq 'ifnothtml';
3578 if ($tag eq 'ifinfo')
3580 &skip_until($tag), next unless $T2H_EXPAND eq 'info';
3582 if ($tag eq 'iftex')
3584 &skip_until($tag), next unless $T2H_EXPAND eq 'tex';
3588 # add to latex2html file
3589 if ($T2H_EXPAND eq 'tex' && $T2H_L2H && ! $in_pre)
3591 # add space to the end -- tex(i2dvi) does this, as well
3592 push(@lines, &l2h_ToLatex(&string_until($tag) . " "));
3600 if ($tag eq 'titlepage')
3604 # handle special tables
3605 if ($tag =~ /^(|f|v|multi)table$/)
3611 # APA: Fixed regexp to ONLY match the top node, not any
3612 # node starting with the word top.
3613 if ($tag eq 'top' || ($tag eq 'node' && /^\@node\s+top\s*(,.*)?$/i))
3617 $has_top_command = 1 if $tag eq 'top';
3618 @lines = (); # ignore all lines before top (title page garbage)
3621 elsif ($tag eq 'node')
3626 push(@lines, $TOPEND);
3628 warn "$ERROR Bad node line: $_" unless $_ =~ /^\@node\s$NODESRE$/o;
3629 # request of "Richard Y. Kim" <ryk@ap.com>
3631 $_ = &protect_html($_); # if node contains '&' for instance
3632 ($node, $node_next, $node_prev, $node_up) = split(/,/);
3635 &normalise_node($node);
3639 warn "$ERROR Node is undefined: $_ (eg. \@node NODE-NAME, NEXT, PREVIOUS, UP)";
3643 &normalise_node($node_next);
3647 &normalise_node($node_prev);
3651 &normalise_node($node_up);
3654 push @lines, &html_debug("<A NAME='".protect_html($node)."'></A>\n", __LINE__) :
3655 push @lines, &html_debug("<A NAME=\"".protect_html($node)."\"></A>\n", __LINE__);
3658 elsif ($tag eq 'include')
3660 if (/^\@include\s+($FILERE)\s*$/o)
3662 $file = LocateIncludeFile($1);
3663 if ($file && -e $file)
3666 print "# including $file\n" if $T2H_VERBOSE;
3670 warn "$ERROR Can't find $1, skipping";
3675 warn "$ERROR Bad include line: $_";
3679 elsif ($tag eq 'ifclear')
3681 if (/^\@ifclear\s+($VARRE)\s*$/o)
3683 next unless defined($value{$1});
3688 warn "$ERROR Bad ifclear line: $_";
3692 elsif ($tag eq 'ifset')
3694 if (/^\@ifset\s+($VARRE)\s*$/o)
3696 next if defined($value{$1});
3701 warn "$ERROR Bad ifset line: $_";
3705 elsif ($tag eq 'menu')
3707 unless ($T2H_SHOW_MENU)
3712 &html_push_if($tag);
3713 push(@lines, &html_debug('', __LINE__));
3715 elsif ($format_map{$tag})
3717 $in_pre = 1 if $format_map{$tag} eq 'PRE';
3718 &html_push_if($format_map{$tag});
3719 push(@lines, &html_debug('', __LINE__));
3720 $in_list++ if $format_map{$tag} eq 'UL' || $format_map{$tag} eq 'OL' ;
3721 # push(@lines, &debug("<BLOCKQUOTE>\n", __LINE__))
3722 # if $tag =~ /example/i;
3723 # Eric Sunshine <sunshine@sunshineco.com>: <PRE>blah</PRE> looks
3724 # better than <PRE>\nblah</PRE> on OmniWeb2 NextStep browser.
3725 push(@lines, &debug("<$format_map{$tag}>" .
3726 ($in_pre ? '' : "\n"), __LINE__));
3729 elsif (exists $complex_format_map->{$tag})
3731 my $start = eval $complex_format_map->{$tag}->[0];
3732 # APA: <table> implicitly ends paragraph, so let's do it
3733 # explicitly to keep our HTML stack in sync.
3734 if ($start =~ /\A\s*<table>/i)
3736 if ($html_element eq 'P')
3738 push (@lines2, &debug("</P>\n", __LINE__));
3744 print "$ERROR: eval of complex_format_map->{$tag}->[0] $complex_format_map->{$tag}->[0]: $@";
3747 $in_pre = 1 if $start =~ /<pre/;
3748 push(@lines, html_debug($start. ($in_pre ? '' : "\n"), __LINE__));
3751 elsif ($tag eq 'table')
3753 # anorland@hem2.passagen.se
3754 # if (/^\s*\@(|f|v|multi)table\s+\@(\w+)/) {
3755 if (/^\s*\@(|f|v|multi)table\s+\@(\w+)|(\{[^\}]*\})/)
3758 unshift(@tables, join($;, $table_type, $in_table));
3759 if ($table_type eq "multi")
3761 # APA: <table> implicitly ends paragraph, so let's
3762 # do it explicitly to keep our HTML stack in sync.
3763 if ($html_element eq 'P')
3765 push (@lines, &debug("</P>\n", __LINE__));
3768 # don't use borders -- gets confused by empty cells
3769 push(@lines, &debug("<TABLE>\n", __LINE__));
3770 &html_push_if('TABLE');
3774 # APA: <dl> implicitly ends paragraph, so let's
3775 # do it explicitly to keep our HTML stack in sync.
3776 if ($html_element eq 'P')
3778 push (@lines, &debug("</P>\n", __LINE__));
3781 push(@lines, &debug("<DL COMPACT>\n", __LINE__));
3782 &html_push_if('DL');
3784 push(@lines, &html_debug('', __LINE__));
3788 warn "$ERROR Bad table line: $_";
3792 elsif ($tag eq 'synindex' || $tag eq 'syncodeindex')
3794 if (/^\@$tag\s+(\w+)\s+(\w+)\s*$/)
3798 my $prefix_from = IndexName2Prefix($from);
3799 my $prefix_to = IndexName2Prefix($to);
3801 warn("$ERROR unknown from index name $from ind syn*index line: $_"), next
3802 unless $prefix_from;
3803 warn("$ERROR unknown to index name $to ind syn*index line: $_"), next
3806 if ($tag eq 'syncodeindex')
3808 $index_properties->{$prefix_to}->{'from_code'}->{$prefix_from} = 1;
3812 $index_properties->{$prefix_to}->{'from'}->{$prefix_from} = 1;
3817 warn "$ERROR Bad syn*index line: $_";
3821 elsif ($tag eq 'defindex' || $tag eq 'defcodeindex')
3823 if (/^\@$tag\s+(\w+)\s*$/)
3826 $index_properties->{$name}->{name} = $name;
3827 $index_properties->{$name}->{code} = 1 if $tag eq 'defcodeindex';
3831 warn "$ERROR Bad defindex line: $_";
3835 elsif (/^\@printindex/)
3837 # APA: HTML generated for @printindex contains <table>
3838 # which implicitly ends paragraph, so let's do it
3839 # explicitly to keep our HTML stack in sync.
3840 if ($html_element eq 'P')
3842 push(@lines, &debug("</P>\n", __LINE__));
3845 push (@lines, "<!--::${section}::-->$_");
3848 elsif ($tag eq 'sp')
3850 push(@lines, &debug("<P></P>\n", __LINE__));
3853 elsif ($tag eq 'center')
3855 push(@lines, &debug("<center>\n", __LINE__));
3858 elsif ($tag eq 'setref')
3861 &protect_html; # if setref contains '&' for instance
3862 if (/^\@$tag\s*{($NODERE)}\s*$/)
3865 $setref =~ s/\s+/ /go; # normalize
3867 $node2sec{$setref} = $name;
3868 $sec2node{$name} = $setref;
3869 $node2href{$setref} = "$docu_doc#$docid";
3873 warn "$ERROR Bad setref line: $_";
3877 elsif ($tag eq 'lowersections')
3880 while (($sec, $level) = each %sec2level)
3882 $sec2level{$sec} = $level + 1;
3886 elsif ($tag eq 'raisesections')
3889 while (($sec, $level) = each %sec2level)
3891 $sec2level{$sec} = $level - 1;
3895 elsif ($tag eq 'macro' || $tag eq 'rmacro')
3897 if (/^\@$tag\s*(\w+)\s*(.*)/)
3901 @args = split(/\s*,\s*/ , $1)
3902 if ($2 =~ /^\s*{(.*)}\s*/);
3904 $macros->{$name}->{Args} = \@args;
3905 $macros->{$name}->{Body} = '';
3906 while (($_ = &next_line) && $_ !~ /\@end $tag/)
3908 $macros->{$name}->{Body} .= $_;
3910 die "ERROR: No closing '\@end $tag' found for macro definition of '$name'\n"
3911 unless (/\@end $tag/);
3912 chomp $macros->{$name}->{Body};
3916 warn "$ERROR: Bad macro defintion $_"
3920 elsif ($tag eq 'unmacro')
3922 delete $macros->{$1} if (/^\@unmacro\s*(\w+)/);
3925 elsif ($tag eq 'documentlanguage')
3927 SetDocumentLanguage($1) if (!$T2H_LANG && /documentlanguage\s*(\w+)/);
3929 elsif (defined($def_map{$tag}))
3934 $tag = $def_map{$tag};
3939 elsif (defined($user_sub{$tag}))
3942 $sub = $user_sub{$tag};
3943 print "# user $tag = $sub, arg: $_" if $T2H_DEBUG & $DEBUG_USER;
3951 warn "$ERROR Bad user sub for $tag: $sub\n";
3955 if (defined($def_map{$tag}))
3960 # extra definition line
3968 while (/\{([^\{\}]*)\}/)
3970 # this is a {} construct
3971 ($before, $contents, $after) = ($`, $1, $');
3973 $contents =~ s/\s+/$;9/g;
3974 # restore $_ protecting {}
3975 $_ = "$before$;7$contents$;8$after";
3977 @args = split(/\s+/, &protect_html($_));
3980 s/$;9/ /g; # unprotect spaces
3984 $type = shift(@args);
3985 $type =~ s/^\{(.*)\}$/$1/;
3986 print "# def ($tag): {$type} ", join(', ', @args), "\n"
3987 if $T2H_DEBUG & $DEBUG_DEF;
3988 if ($tag eq 'deftypecv') {
3989 my $class = shift (@args);
3990 $class =~ s/^\{(.*)\}$/$1/;
3991 $type .= " of $class";
3993 $type .= ':' if (!$T2H_DEF_TABLE); # it's nicer like this
3994 $name = shift(@args);
3995 $name =~ s/^\{(.*)\}$/$1/;
3998 $_ = &debug("<DT>", __LINE__) if (!$T2H_DEF_TABLE);
3999 $_ = &debug("", __LINE__) if ($T2H_DEF_TABLE);
4000 #$_ = &debug("<TR TEST1>\n", __LINE__) if ($T2H_DEF_TABLE);
4004 # APA: <dl> implicitly ends paragraph, so let's
4005 # do it explicitly to keep our HTML stack in sync.
4006 if ($html_element eq 'P')
4008 $_ = &debug("</P>\n", __LINE__);
4015 $_ .= &debug("<DL>\n<DT>", __LINE__) if (!$T2H_DEF_TABLE);
4016 $_ .= &debug("<TABLE WIDTH=\"100%\">\n", __LINE__) if ($T2H_DEF_TABLE);
4018 if ($tag eq 'deffn' || $tag eq 'defvr' || $tag eq 'deftp')
4022 $_ .= "<TR>\n<TD ALIGN=\"LEFT\"><B>$name</B>\n";
4023 $_ .= " <I>@args</I>" if @args;
4025 $_ .= "<TD ALIGN=\"RIGHT\">";
4026 $_ .= "$type</TD>\n</TR>\n";
4030 $_ .= "<U>$type</U> <B>$name</B>";
4031 $_ .= " <I>@args</I>" if @args;
4034 elsif ($tag eq 'deftypefn' || $tag eq 'deftypevr'
4035 || $tag eq 'deftypeop' || $tag eq 'defcv'
4036 || $tag eq 'defop' || $tag eq 'deftypecv')
4039 $name = shift(@args);
4040 $name =~ s/^\{(.*)\}$/$1/;
4043 $_ .= "<TR>\n<TD ALIGN=\"LEFT\"><B>$name</B>";
4044 $_ .= " <I>@args</I>" if @args;
4046 $_ .= "<TD ALIGN=\"RIGHT\">";
4047 $_ .= "$type of $ftype</TD>\n</TR>\n";
4051 my $sep = $ftype =~ /\*$/ ? '' : ' ';
4052 $_ .= "<U>$type</U> $ftype$sep<B>$name</B>";
4053 $_ .= " @args" if @args;
4058 warn "$ERROR Unknown definition type: $tag\n";
4059 $_ .= "<U>$type</U> <B>$name</B>";
4060 $_ .= " <I>@args</I>" if @args;
4062 $_ .= &debug("\n<DD>", __LINE__) if (!$T2H_DEF_TABLE);
4063 ########$_ .= &debug("\n</TABLE TEST3>\n<TABLE WIDTH=\"95%\">\n", __LINE__) if ($T2H_DEF_TABLE);
4064 $name = &unprotect_html($name);
4065 if ($tag eq 'deffn' || $tag eq 'deftypefn')
4067 EnterIndexEntry('f', $name, $docu_doc, $section, \@lines);
4068 # unshift(@input_spool, "\@findex $name\n");
4070 elsif ($tag eq 'defop')
4072 EnterIndexEntry('f', "$name on $ftype", $docu_doc, $section, \@lines);
4073 # unshift(@input_spool, "\@findex $name on $ftype\n");
4075 elsif ($tag eq 'defvr' || $tag eq 'deftypevr' || $tag eq 'defcv')
4077 EnterIndexEntry('v', $name, $docu_doc, $section, \@lines);
4078 # unshift(@input_spool, "\@vindex $name\n");
4082 EnterIndexEntry('t', $name, $docu_doc, $section, \@lines);
4083 # unshift(@input_spool, "\@tindex $name\n");
4090 if ($format_map{$end_tag})
4092 $in_pre = 0 if $format_map{$end_tag} eq 'PRE';
4093 $in_list-- if $format_map{$end_tag} eq 'UL' || $format_map{$end_tag} eq 'OL' ;
4097 push(@lines, &debug("</$format_map{$end_tag}>\n", __LINE__));
4098 push(@lines, &html_debug('', __LINE__));
4100 elsif (exists $complex_format_map->{$end_tag})
4102 my $end = eval $complex_format_map->{$end_tag}->[1];
4105 print "$ERROR: eval of complex_format_map->{$end_tag}->[1] $complex_format_map->{$end_tag}->[0]: $@";
4108 $in_pre = 0 if $end =~ m|</pre>|;
4109 push(@lines, html_debug($end, __LINE__));
4111 elsif ($end_tag =~ /^(|f|v|multi)table$/)
4115 warn "$ERROR \@end $end_tag without \@*table\n";
4119 ($table_type, $in_table) = split($;, shift(@tables));
4120 unless ($1 eq $table_type)
4122 warn "$ERROR \@end $end_tag without matching \@$end_tag\n";
4125 if ($table_type eq "multi")
4127 push(@lines, "</TR></TABLE>\n");
4132 # APA: </dl> implicitly ends paragraph, so let's
4133 # do it explicitly to keep our HTML stack in sync.
4134 if ($html_element eq 'P')
4136 push(@lines, &debug("</P>\n", __LINE__));
4139 push(@lines, "</DL>\n");
4145 ($table_type, $in_table) = split($;, $tables[0]);
4152 elsif (defined($def_map{$end_tag}))
4154 # APA: </dl> and </table> implicitly ends paragraph,
4155 # so let's do it explicitly to keep our HTML stack in
4157 if ($html_element eq 'P')
4159 push(@lines, &debug("</P>\n", __LINE__));
4162 push(@lines, &debug("</DL>\n", __LINE__)) if (!$T2H_DEF_TABLE);
4163 push(@lines, &debug("</TABLE>\n", __LINE__)) if ($T2H_DEF_TABLE);
4165 elsif ($end_tag eq 'menu')
4168 push(@lines, $_); # must keep it for pass 2
4172 #############################################################
4174 while (/\@anchor\s*\{(.*?)\}/)
4178 $anchor = &normalise_node($anchor);
4179 push @lines, &html_debug("<A NAME=\"".protect_html($anchor)."\"></A>\n");
4180 $node2href{$anchor} = "$docu_doc#$anchor";
4181 next INPUT_LINE if $_ =~ /^\s*$/;
4183 #############################################################
4184 # index entry generation, after value substitutions
4185 if (/^\@(\w+?)index\s+/)
4187 EnterIndexEntry($1, $', $docu_doc, $section, \
@lines);
4191 # protect texi and HTML things
4193 $_ = &protect_html
($_) unless $dont_html;
4195 # substitution (unsupported things)
4197 s/\@noindent\s+//go;
4199 # other substitutions
4200 &simple_substitutions
;
4201 s/\@footnote\{/\@footnote$docu_doc\{/g; # mark footnotes, cf. pass 4
4203 # analyze the tag again
4207 if (defined($sec2level{$tag}) && $sec2level{$tag} > 0)
4209 if (/^\@$tag\s+(.+)$/)
4212 $name = &normalise_node
($name);
4213 $level = $sec2level{$tag};
4215 $first_index_chapter = $name
4216 if ($level == 1 && !$first_index_chapter &&
4218 if ($in_top && /heading/)
4220 $T2H_HAS_TOP_HEADING = 1;
4221 $_ = &debug
("<H$level>$name</H$level>\n", __LINE__
);
4222 &html_push_if
('body');
4223 print "# top heading, section $name, level $level\n"
4224 if $T2H_DEBUG & $DEBUG_TOC;
4228 unless (/^\@\w*heading/)
4230 unless (/^\@unnumbered/)
4232 my $number = &update_sec_num
($tag, $level);
4233 $name = $number . ' ' . $name if $T2H_NUMBER_SECTIONS;
4234 $sec2number{$name} = $number;
4235 $number2sec{$number} = $name;
4237 if (defined($toplevel))
4239 push @lines, ($level==$toplevel ?
$CHAPTEREND : $SECTIONEND);
4243 # first time we see a "section"
4244 unless ($level == 1)
4246 warn "$WARN The first section found is not of level 1: $_";
4250 push(@sections, $name);
4251 next_doc
() if (defined $T2H_SPLIT
4253 ($T2H_SPLIT eq 'section'
4255 $T2H_SPLIT && $level == $toplevel));
4258 $docid = "SEC$sec_num";
4259 $tocid = (/^\@\w*heading/ ?
undef : "TOC$sec_num");
4260 # check biblio and glossary
4261 $in_bibliography = ($name =~ /^([A-Z]|\d+)?(\.\d+)*\s*bibliography$/i);
4262 $in_glossary = ($name =~ /^([A-Z]|\d+)?(\.\d+)*\s*glossary$/i);
4266 warn "$ERROR Duplicate node found: $node\n"
4267 if ($node2sec{$node});
4271 $name .= ' ' while ($node2sec{$name});
4274 $name .= ' ' while ($sec2node{$name});
4276 $node2sec{$node} = $name;
4277 $sec2node{$name} = $node;
4278 $sec2seccount{$name} = $sec_num;
4279 $seccount2sec{$sec_num} = $name;
4280 $node2href{$node} = "$docu_doc#$docid";
4281 $node2next{$node} = $node_next;
4282 $node2prev{$node} = $node_prev;
4283 $node2up{$node} = $node_up;
4284 print "# node $node, section $name, level $level\n"
4285 if $T2H_DEBUG & $DEBUG_TOC;
4294 while ($level > $curlevel)
4297 push(@toc_lines, "<$toc_indent>\n");
4299 while ($level < $curlevel)
4302 push(@toc_lines, "</$toc_indent>\n");
4304 $_ = &t2h_anchor
($tocid, "$docu_doc#$docid", $name, 1);
4305 $_ = &substitute_style
($_);
4306 push(@stoc_lines, "$_<BR>\n") if ($level == 1);
4307 if ($T2H_NUMBER_SECTIONS)
4309 push(@toc_lines, $_ . "<BR>\n")
4313 push(@toc_lines, "<LI>" . $_ ."</LI>");
4318 push(@lines, &html_debug
("<A NAME=\"".protect_html
($docid)."\"></A>\n",
4322 push(@lines, &html_debug
('', __LINE__
));
4324 $_ = "<H$level> $name </H$level>\n<!--docid::${docid}::-->\n";
4325 $_ = &debug
($_, __LINE__
);
4326 push(@lines, &html_debug
('', __LINE__
));
4329 foreach $line (split(/\n+/, $_))
4331 push(@lines, "$line\n");
4337 warn "$ERROR Bad section line: $_";
4343 $value{$1} = Unprotect_texi
($2), next if /^\@set\s+($VARRE)\s+(.*)$/o;
4344 delete $value{$1}, next if /^\@clear\s+($VARRE)\s*$/o;
4346 $value{'_shorttitle'} = Unprotect_texi
($1), next if /^\@shorttitle\s+(.*)$/;
4347 $value{'_setfilename'} = Unprotect_texi
($1), next if /^\@setfilename\s+(.*)$/;
4348 $value{'_settitle'} = Unprotect_texi
($1), next if /^\@settitle\s+(.*)$/;
4349 $value{'_author'} .= Unprotect_texi
($1)."\n", next if /^\@author\s+(.*)$/;
4350 $value{'_subtitle'} .= Unprotect_texi
($1)."\n", next if /^\@subtitle\s+(.*)$/;
4351 $value{'_title'} .= Unprotect_texi
($1)."\n", next if /^\@title\s+(.*)$/;
4354 if (/^\s*\@itemx?\s+/)
4358 if ($in_bibliography && $use_bibliography)
4360 if ($what =~ /^$BIBRE$/o)
4362 $id = 'BIB
' . ++$bib_num;
4363 $bib2href{$what} = "$docu_doc#$id";
4364 print "# found bibliography for '$what' id $id\n"
4365 if $T2H_DEBUG & $DEBUG_BIB;
4366 $what = &t2h_anchor($id, '', $what);
4369 elsif ($in_glossary && $T2H_USE_GLOSSARY)
4371 $id = 'GLOSS
' . ++$gloss_num;
4373 $entry =~ tr/A-Z/a-z/ unless $entry =~ /^[A-Z\s]+$/;
4374 $gloss2href{$entry} = "$docu_doc#$id";
4375 print "# found glossary for '$entry' id $id\n"
4376 if $T2H_DEBUG & $DEBUG_GLOSS;
4377 $what = &t2h_anchor($id, '', $what);
4379 elsif ($in_table && ($table_type eq 'f
' || $table_type eq 'v
'))
4381 # APA: Insert <dt> before index anchor, if
4382 # necessary to produce valid HTML. Close open
4384 if ($html_element ne 'DT
')
4386 # APA: End paragraph, if any.
4387 if ($html_element eq 'P
')
4389 push(@lines, &debug("</P>\n", __LINE__));
4392 push(@lines, &debug("<DT>", __LINE__));
4395 EnterIndexEntry($table_type, $what, $docu_doc, $section, \@lines);
4397 # APA: End paragraph, if any.
4398 if ($html_element eq 'P
')
4400 push(@lines, &debug("</P>\n", __LINE__));
4403 if ($html_element =~ m|^D[DLT]$|)
4405 unless ($html_element eq 'DT
')
4407 push(@lines, &debug("<DT>", __LINE__));
4409 if ($things_map{$in_table} && !$what)
4411 # special case to allow @table @bullet for instance
4412 push(@lines, &debug("$things_map{$in_table}\n", __LINE__));
4416 push(@lines, &debug("\@$in_table\{$what\}\n", __LINE__));
4418 push(@lines, "<DD>");
4419 &html_push('DD
') unless $html_element eq 'DD
';
4421 { # add also an index
4422 unshift(@input_spool, "\@${table_type}index $what\n");
4425 elsif ($html_element eq 'TABLE
')
4427 push(@lines, &debug("<TR><TD>$what</TD>\n", __LINE__));
4430 elsif ($html_element eq 'TR
')
4432 push(@lines, &debug("</TR>\n", __LINE__));
4433 push(@lines, &debug("<TR><TD>$what</TD>\n", __LINE__));
4437 push(@lines, &debug("<LI>$what\n", __LINE__));
4438 &html_push('LI
') unless $html_element eq 'LI
';
4440 push(@lines, &html_debug('', __LINE__));
4443 push(@lines, &debug("$deferred_ref\n", __LINE__));
4448 elsif (/^\@tab\s+(.*)$/)
4450 push(@lines, "<TD>$1</TD>\n");
4455 # paragraph separator
4456 if ($_ eq "\n" && ! $in_pre)
4458 next if $#lines >= 0 && $lines[$#lines] eq "\n";
4459 if ($html_element eq 'P
')
4461 push (@lines, &debug("</P>\n<P>\n", __LINE__));
4465 # push(@lines, "<P></P>\n");
4466 # $_ = &debug("<P></P>\n", __LINE__);
4468 elsif ($html_element eq 'body
' || $html_element eq 'BLOCKQUOTE
' || $html_element eq 'DD
' || $html_element eq 'LI
')
4471 push(@lines, &debug("<P>\n", __LINE__));
4475 push(@lines, $_) unless $in_titlepage;
4476 push(@lines, &debug("</center>\n", __LINE__)) if ($tag eq 'center
');
4480 while ($level < $curlevel)
4483 push(@toc_lines, "</$toc_indent>\n");
4485 print "# end of pass 1\n" if $T2H_VERBOSE;
4488 #+++############################################################################
4490 # Stuff related to Index generation #
4492 #---############################################################################
4498 my $docu_doc = shift;
4499 my $section = shift;
4503 warn "$ERROR Undefined index command: $_", next
4504 unless (exists ($index_properties->{$prefix}));
4509 $_ = &protect_html($_);
4510 my $html_key = substitute_style($_);
4512 $key = remove_style($key);
4513 $key = remove_things($key);
4517 while (exists $index->{$prefix}->{$key})
4522 if ($lines->[$#lines] =~ /^<!--docid::(.+)::-->$/)
4528 $id = 'IDX
' . ++$idx_num;
4529 push(@$lines, &t2h_anchor($id, '', $T2H_INVISIBLE_MARK, !$in_pre));
4531 $index->{$prefix}->{$key}->{html_key} = $html_key;
4532 $index->{$prefix}->{$key}->{section} = $section;
4533 $index->{$prefix}->{$key}->{href} = "$docu_doc#$id";
4534 print "# found ${prefix}index for '$key' with id $id\n"
4535 if $T2H_DEBUG & $DEBUG_INDEX;
4538 sub IndexName2Prefix
4543 for $prefix (keys %$index_properties)
4545 return $prefix if ($index_properties->{$prefix}->{name} eq $name);
4554 my ($entries, $prefix, $key) = ({});
4555 for $prefix (keys %$normal)
4557 for $key (keys %{$index->{$prefix}})
4559 $entries->{$key} = {%{$index->{$prefix}->{$key}}};
4565 for $prefix (keys %$code)
4567 unless (exists $normal->{$prefix})
4569 for $key (keys %{$index->{$prefix}})
4571 $entries->{$key} = {%{$index->{$prefix}->{$key}}};
4572 $entries->{$key}->{html_key} = "<CODE>$entries->{$key}->{html_key}</CODE>";
4582 if ($a =~ /^[A-Za-z]/)
4584 if ($b =~ /^[A-Za-z]/)
4586 return lc($a) cmp lc($b);
4593 elsif ($b =~ /^[A-Za-z]/)
4599 return lc($a) cmp lc($b);
4605 my $entries = shift;
4606 my (@Letters, $key);
4607 my ($EntriesByLetter, $Pages, $page) = ({}, [], {});
4608 my @keys = sort byAlpha keys %$entries;
4612 push @{$EntriesByLetter->{uc(substr($key,0, 1))}} , $entries->{$key};
4614 @Letters = sort byAlpha keys %$EntriesByLetter;
4615 $T2H_SPLIT_INDEX = 0 unless $T2H_SPLIT;
4617 unless ($T2H_SPLIT_INDEX)
4619 $page->{First} = $Letters[0];
4620 $page->{Last} = $Letters[$#Letters];
4621 $page->{Letters} = \@Letters;
4622 $page->{EntriesByLetter} = $EntriesByLetter;
4623 push @$Pages, $page;
4627 if ($T2H_SPLIT_INDEX =~ /^\d+$/)
4630 my ($prev_letter, $letter);
4631 for $letter (@Letters)
4633 if ($i > $T2H_SPLIT_INDEX)
4635 $page->{Last} = $prev_letter;
4636 push @$Pages, $page;
4642 $page->{Letters} = [];
4643 $page->{EntriesByLetter} = {};
4644 $page->{First} = $letter;
4646 push @{$page->{Letters}}, $letter;
4647 $page->{EntriesByLetter}->{$letter} = [@{$EntriesByLetter->{$letter}}];
4648 $i += scalar(@{$EntriesByLetter->{$letter}});
4649 $prev_letter = $letter;
4651 $page->{Last} = $Letters[$#Letters];
4652 push @$Pages, $page;
4659 my $first_page = shift;
4662 my ($page, $letter, $summary, $i, $l1, $l2, $l);
4665 $summary = '<table
><tr
><th valign
=top
>Jump to
:  
; </th
><td
>';
4666 for $page ($first_page, @$Pages)
4668 for $letter (@{$page->{Letters}})
4670 $l = t2h_anchor('', "$page->{href}#${name}_$letter", "<b>$letter</b>",
4671 0, 'style
="text-decoration:none"') . "\n \n";
4672 if ($letter =~ /^[A-Za-z]/)
4682 $summary .= $l1 . "<BR>\n" if ($l1);
4683 $summary .= $l2 . '</td></tr
></table
>';
4690 my $summary = shift;
4694 push @$lines, $summary;
4696 push @$lines , <<EOT;
4699 <TR><TD></TD><TH ALIGN=LEFT>Index Entry</TH><TH ALIGN=LEFT> Section</TH></TR>
4700 <TR><TD COLSPAN=3> <HR></TD></TR>
4703 for $letter (@
{$page->{Letters
}})
4705 push @
$lines, "<TR><TH><A NAME=\"".protect_html
("${name}_$letter")."\"></A>".protect_html
($letter)."</TH><TD></TD><TD></TD></TR>\n";
4706 for $entry (@
{$page->{EntriesByLetter
}->{$letter}})
4709 "<TR><TD></TD><TD valign=top>" .
4710 t2h_anchor
('', $entry->{href
}, $entry->{html_key
}) .
4711 "</TD><TD valign=top>" .
4712 t2h_anchor
('', sec_href
($entry->{section
}), clean_name
($entry->{section
})) .
4715 push @
$lines, "<TR><TD COLSPAN=3> <HR></TD></TR>\n";
4717 push @
$lines, "</TABLE><P></P>";
4718 push @
$lines, $summary;
4725 my $section = shift;
4726 $section = 'Top' unless $section;
4727 my $prefix = IndexName2Prefix
($name);
4729 warn ("$ERROR printindex: bad index name: $name"), return
4732 if ($index_properties->{$prefix}->{code
})
4734 $index_properties->{$prefix}->{from_code
}->{$prefix} = 1;
4738 $index_properties->{$prefix}->{from
}->{$prefix}= 1;
4741 my $Entries = GetIndexEntries
($index_properties->{$prefix}->{from
},
4742 $index_properties->{$prefix}->{from_code
});
4743 return unless %$Entries;
4745 if ($T2H_IDX_SUMMARY)
4748 open(FHIDX
, ">$docu_rdir$docu_name" . "_$name.idx")
4749 || die "Can't open > $docu_rdir$docu_name" . "_$name.idx for writing: $!\n";
4750 print "# writing $name index summary in $docu_rdir$docu_name" . "_$name.idx...\n" if $T2H_VERBOSE;
4752 for $key (sort keys %$Entries)
4754 print FHIDX
"$key\t$Entries->{$key}->{href}\n";
4758 my $Pages = GetIndexPages
($Entries);
4760 my $first_page = shift @
$Pages;
4761 my $sec_name = $section;
4763 # remove section number
4764 $sec_name =~ s/.*? // if $sec_name =~ /^([A-Z]|\d+)\./;
4766 ($first_page->{href
} = sec_href
($section)) =~ s/\#.*$//;
4767 $node2prev{$section} = Sec2PrevNode
($node2sec{$section});
4768 $prev_node = $section;
4769 # Update tree structure of document
4775 while (@sections && $sections[$#sections] ne $section)
4777 unshift @after, pop @sections;
4782 my $node = ($page->{First
} ne $page->{Last
} ?
4783 "$sec_name: $page->{First} -- $page->{Last}" :
4784 "$sec_name: $page->{First}");
4785 push @sections, $node;
4786 $node2sec{$node} = $node;
4787 $sec2node{$node} = $node;
4788 $node2up{$node} = $section;
4789 $page->{href
} = next_doc
();
4790 $page->{name
} = $node;
4791 $node2href{$node} = $page->{href
};
4794 $node2next{$prev_node} = $node;
4795 $node2prev{$node} = $prev_node;
4799 # Full circle - Next on last index page goes to Top
4800 $node2next{$prev_node} = "Top";
4801 push @sections, @after;
4804 my $summary = GetIndexSummary
($first_page, $Pages, $name);
4805 PrintIndexPage
($lines, $summary, $first_page, $name);
4808 push @
$lines, ($T2H_SPLIT eq 'chapter' ?
$CHAPTEREND : $SECTIONEND);
4809 push @
$lines, "<H2 ALIGN=\"Left\">$page->{name}</H2>\n";
4810 PrintIndexPage
($lines, $summary, $page, $name);
4815 #+++############################################################################
4817 # Pass 2/3: handle style, menu, index, cross-reference #
4819 #---############################################################################
4824 @lines2 = (); # whole document (2nd pass)
4825 @lines3 = (); # whole document (3rd pass)
4826 my $in_menu = 0; # am I inside a menu
4827 my $in_menu_listing;
4833 # special case (protected sections)
4835 if (/^$PROTECTTAG/o)
4846 $in_menu_listing = 1;
4847 # APA: <table> implicitly ends paragraph, so let's do it
4848 # explicitly to keep our HTML stack in sync.
4849 if ($html_element eq 'P')
4851 push (@lines2, &debug
("</P>\n", __LINE__
));
4854 push(@lines2, &debug
("<TABLE BORDER=\"0\" CELLSPACING=\"0\">\n", __LINE__
));
4857 if (/^\@end\s+menu\b/)
4859 if ($in_menu_listing)
4861 push(@lines2, &debug
("</TABLE>\n", __LINE__
));
4864 $in_menu_listing = 0;
4869 my ($node, $name, $descr);
4870 if (/^\*\s+($NODERE)::/o)
4875 elsif (/^\*\s+(.+):\s+([^\t,\.\n]+)[\t,\.\n]/)
4883 warn "$ERROR Bad menu line: $_";
4887 if ($in_menu_listing)
4889 # APA: Handle menu comment lines. These don't end the menu!
4890 # $in_menu_listing = 0;
4891 push(@lines2,&debug
('<TR><TH COLSPAN="3" ALIGN="left" VALIGN="TOP">' . $_ . '</TH></TR>
4897 if (! $in_menu_listing)
4899 $in_menu_listing = 1;
4900 push(@lines2, &debug
("<TABLE BORDER=0 CELLSPACING=0>\n", __LINE__
));
4902 # look for continuation
4903 while ($lines[0] =~ /^\s+\w+/)
4905 $descr .= shift(@lines);
4907 &menu_entry
($node, $name, $descr);
4914 PrintIndex
(\
@lines2, $2, $1), next
4915 if (/^<!--::(.*)::-->\@printindex\s+(\w+)/);
4917 # simple style substitutions
4919 $_ = &substitute_style
($_);
4923 while (/\@(x|px|info|)ref{([^{}]+)(}?)/)
4925 # note: Texinfo may accept other characters
4926 ($type, $nodes, $full) = ($1, $2, $3);
4927 ($before, $after) = ($`, $');
4928 if (! $full && $after)
4930 warn "$ERROR Bad xref (no ending } on line): $_";
4931 $_ = "$before$;0${type}ref\{$nodes$after";
4936 $type = "$T2H_WORDS->{$T2H_LANG}->{'See'} ";
4938 elsif ($type eq 'px')
4940 $type = "$T2H_WORDS->{$T2H_LANG}->{'see'} ";
4942 elsif ($type eq 'info')
4944 $type = "$T2H_WORDS->{$T2H_LANG}->{'See'} Info";
4952 $next = shift(@lines);
4953 $next = &substitute_style($next);
4954 chop($nodes); # remove final newline
4956 { # split on 2 lines
4963 $next = shift(@lines);
4964 $next = &substitute_style($next);
4967 { # split on 3 lines
4973 warn "$ERROR Bad xref (no ending }): $_";
4974 $_ = "$before$;0xref\{$nodes$after";
4975 unshift(@lines, $next);
4980 $nodes =~ s/\s+/ /go; # remove useless spaces
4981 @args = split(/\s*,\s*/, $nodes);
4982 $node = $args[0]; # the node is always the first arg
4983 $node = &normalise_node($node);
4984 $sec = $args[2] || $args[1] || $node2sec{$node};
4985 $href = $node2href{$node};
4987 { # reference to another manual
4988 $sec = $args[2] || $node;
4989 $man = $args[4] || $args[3];
4990 $_ = "${before}${type}$T2H_WORDS->{$T2H_LANG}->{'section'} `$sec' in \@cite{$man}$after";
4992 elsif ($type =~ /Info/)
4994 warn "$ERROR Wrong number of arguments: $_" unless @args == 3;
4995 ($nn, $_, $in) = @args;
4996 $_ = "${before}${type} file `$in', node
`$nn'$after";
4998 elsif ($sec && $href && ! $T2H_SHORT_REF)
5000 $_ = "${before}${type}";
5001 $_ .= "$T2H_WORDS->{$T2H_LANG}->{'section'} " if $type;
5002 $_ .= &t2h_anchor('', $href, $sec) . $after;
5006 $_ = "${before}${type} " .
5007 &t2h_anchor('', $href, $args[2] || $args[1] || $node) .
5012 warn "$ERROR Undefined node ($node): $_";
5013 $_ = "$before$;0xref{$nodes}$after";
5018 s[\@image\s*{(.+?)}]
5020 my @args = split (/\s*,\s*/, $1);
5021 my $base = $args[0];
5023 LocateIncludeFile("$base.png") ||
5024 LocateIncludeFile("$base.jpg") ||
5025 LocateIncludeFile("$base.gif");
5026 warn "$ERROR no image file for $base: $_" unless ($image && -e $image);
5027 ($T2H_CENTER_IMAGE ?
5028 "<CENTER><IMG SRC=\"$image\" ALT=\"$base\"></CENTER>" :
5029 "<IMG SRC=\"$image\" ALT=\"$base\">");
5033 # try to guess bibliography references or glossary terms
5035 unless (/^<H\d><A NAME=\"SEC\d/)
5037 if ($use_bibliography)
5042 ($pre, $what, $post) = ($`, $&, $');
5043 $href = $bib2href{$what};
5044 if (defined($href) && $post !~ /^[^<]*<\/A>/)
5046 $done .= $pre . &t2h_anchor('', $href, $what);
5050 $done .= "$pre$what";
5056 if ($T2H_USE_GLOSSARY)
5061 ($pre, $what, $post) = ($`, $&, $');
5063 $entry =~ tr/A-Z/a-z/ unless $entry =~ /^[A-Z\s]+$/;
5064 $href = $gloss2href{$entry};
5065 if (defined($href) && $post !~ /^[^<]*<\/A
>/)
5067 $done .= $pre . &t2h_anchor
('', $href, $what);
5071 $done .= "$pre$what";
5081 print "# end of pass 2\n" if $T2H_VERBOSE;
5087 # split style substitutions
5092 $_ = shift(@lines2);
5094 # special case (protected sections)
5096 if (/^$PROTECTTAG/o)
5102 # split style substitutions
5110 ($before, $style, $after) = ($`, $1, $');
5111 if (defined($style_map{$style}))
5129 $_ = shift(@lines2);
5134 die "* Bad syntax (\@$style) after: $before\n";
5138 $text = &apply_style($style, $text);
5139 $_ = "$before$text$after";
5147 print "# end of pass 3\n" if $T2H_VERBOSE;
5150 #+++############################################################################
5152 # Pass 4: foot notes, final cleanup #
5154 #---############################################################################
5159 @foot_lines = (); # footnotes
5160 @doc_lines = (); # final document
5161 $end_of_para = 0; # true if last line is <P>
5163 # APA: There aint no paragraph before the first one!
5164 # This fixes a HTML validation error.
5165 $lines3[0] =~ s|^</P>\n|\n|;
5168 $_ = shift(@lines3);
5170 # special case (protected sections)
5172 if (/^$PROTECTTAG/o)
5174 push(@doc_lines, $_);
5181 while (/\@footnote([^\{\s]+)\{/)
5183 ($before, $d, $after) = ($`, $1, $');
5200 $_ = shift(@lines3);
5205 die "* Bad syntax (\@footnote) after: $before\n";
5210 $docid = "DOCF$foot_num";
5211 $footid = "FOOT$foot_num";
5212 $foot = "($foot_num)";
5213 push(@foot_lines, "<H3>" . &t2h_anchor($footid, "$d#$docid", $foot) . "</H3>\n");
5214 $text = "<P>$text" unless $text =~ /^\s*<P>/;
5215 push(@foot_lines, "$text\n");
5216 $_ = $before . &t2h_anchor($docid, "$docu_foot#$footid", $foot) . $after;
5220 # remove unnecessary <P>
5224 next if $end_of_para++;
5231 push(@doc_lines, $_);
5234 print "# end of pass 4\n" if $T2H_VERBOSE;
5237 #+++############################################################################
5239 # Pass 5: print things #
5241 #---############################################################################
5244 $T2H_L2H = &l2h_FinishToLatex if ($T2H_L2H);
5245 $T2H_L2H = &l2h_ToHtml if ($T2H_L2H);
5246 $T2H_L2H = &l2h_InitFromHtml if ($T2H_L2H);
5250 # fix node2up, node2prev, node2next, if desired
5251 if ($has_top_command)
5253 for $section (keys %sec2number)
5255 $node2href{$sec2node{$section}} =~ /SEC(\d+)$/;
5256 $node = $sec2node{$section};
5257 $node2up{$node} = Sec2UpNode($section) unless $node2up{$node};
5258 $node2prev{$node} = Sec2PrevNode($section) unless $node2prev{$node};
5259 $node2next{$node} = Sec2NextNode($section) unless $node2next{$node};
5263 # prepare %T2H_THISDOC
5264 $T2H_THISDOC{fulltitle} = $value{'_title'} || $value{'_settitle'} || "Untitled Document";
5265 $T2H_THISDOC{title} = $value{'_settitle'} || $T2H_THISDOC{fulltitle};
5266 $T2H_THISDOC{author} = $value{'_author'};
5267 $T2H_THISDOC{subtitle} = $value{'_subtitle'};
5268 $T2H_THISDOC{shorttitle} = $value{'_shorttitle'};
5269 for $key (keys %T2H_THISDOC)
5271 $_ = &substitute_style($T2H_THISDOC{$key});
5274 $T2H_THISDOC{$key} = $_;
5277 # if no sections, then simply print document as is
5280 print "# Writing content into $docu_top_file \n" if $T2H_VERBOSE;
5281 open(FILE, "> $docu_top_file")
5282 || die "$ERROR: Can't open $docu_top_file for writing: $!\n";
5284 &$T2H_print_page_head(\*FILE);
5285 $T2H_THIS_SECTION = \@doc_lines;
5286 t2h_print_lines(\*FILE);
5287 &$T2H_print_foot_navigation(\*FILE);
5288 &$T2H_print_page_foot(\*FILE);
5293 # initialize $T2H_HREF, $T2H_NAME
5296 'First' , sec_href($sections[0]),
5297 'Last', sec_href($sections[$#sections]),
5298 'About', $docu_about. '#SEC_About',
5301 # prepare TOC, OVERVIEW, TOP
5302 $T2H_TOC = \@toc_lines;
5303 $T2H_OVERVIEW = \@stoc_lines;
5308 $_ = shift @doc_lines;
5312 $T2H_HREF{'Top'} = $docu_top . '#SEC_Top';
5316 $T2H_HREF{'Top'} = $T2H_HREF{First};
5319 $node2href{Top} = $T2H_HREF{Top};
5320 $T2H_HREF{Contents} = $docu_toc.'#SEC_Contents' if @toc_lines;
5321 $T2H_HREF{Overview} = $docu_stoc.'#SEC_OVERVIEW' if @stoc_lines;
5324 if ($T2H_INDEX_CHAPTER)
5326 $T2H_HREF{Index} = $node2href{normalise_node($T2H_INDEX_CHAPTER)};
5327 warn "$ERROR T2H_INDEX_CHAPTER '$T2H_INDEX_CHAPTER' not found\n"
5328 unless $T2H_HREF{Index};
5330 if (! $T2H_HREF{Index} && $first_index_chapter)
5332 $T2H_INDEX_CHAPTER = $first_index_chapter;
5333 $T2H_HREF{Index} = $node2href{$T2H_INDEX_CHAPTER};
5336 print "# Using '" . clean_name($T2H_INDEX_CHAPTER) . "' as index page\n"
5337 if ($T2H_VERBOSE && $T2H_HREF{Index});
5341 'First', clean_name($sec2node{$sections[0]}),
5342 'Last', clean_name($sec2node{$sections[$#sections]}),
5343 'About', $T2H_WORDS->{$T2H_LANG}->{'About_Title'},
5344 'Contents', $T2H_WORDS->{$T2H_LANG}->{'ToC_Title'},
5345 'Overview', $T2H_WORDS->{$T2H_LANG}->{'Overview_Title'},
5346 'Index' , clean_name($T2H_INDEX_CHAPTER),
5347 'Top', clean_name($T2H_TOP_HEADING || $T2H_THISDOC{'title'} || $T2H_THISDOC{'shorttitle'}),
5350 #############################################################################
5351 # print frame and frame toc file
5355 open(FILE, "> $docu_frame_file")
5356 || die "$ERROR: Can't open $docu_frame_file for writing: $!\n";
5357 print "# Creating frame in $docu_frame_file ...\n" if $T2H_VERBOSE;
5358 &$T2H_print_frame(\*FILE);
5361 open(FILE, "> $docu_toc_frame_file")
5362 || die "$ERROR: Can't open $docu_toc_frame_file for writing: $!\n";
5363 print "# Creating toc frame in $docu_frame_file ...\n" if $T2H_VERBOSE;
5364 &$T2H_print_toc_frame(\*FILE);
5369 #############################################################################
5370 # Monolithic beginning.
5374 open(FILE, "> $docu_doc_file")
5375 || die "$ERROR: Can't open $docu_doc_file for writing: $!\n";
5376 &$T2H_print_page_head(\*FILE);
5380 #############################################################################
5387 open(FILE, "> $docu_top_file")
5388 || die "$ERROR: Can't open $docu_top_file for writing: $!\n";
5391 print "# Creating Top in $docu_top_file ...\n" if $T2H_VERBOSE;
5392 $T2H_THIS_SECTION = $T2H_TOP;
5393 $T2H_HREF{This} = $T2H_HREF{Top};
5394 $T2H_NAME{This} = $T2H_NAME{Top};
5395 &$T2H_print_Top(\*FILE);
5400 || die "$ERROR: Error occurred when closing $docu_top_file: $!\n";
5405 #############################################################################
5408 $T2H_NODE{Forward} = $sec2node{$sections[0]};
5409 $T2H_NAME{Forward} = &clean_name($sec2node{$sections[0]});
5410 $T2H_HREF{Forward} = sec_href($sections[0]);
5411 $T2H_NODE{This} = 'Top';
5412 $T2H_NAME{This} = $T2H_NAME{Top};
5413 $T2H_HREF{This} = $T2H_HREF{Top};
5416 print "# writing " . scalar(@sections) .
5417 " sections into $docu_rdir$docu_name"."_[1..$doc_num].$docu_ext"
5419 $previous = ($T2H_SPLIT eq 'chapter' ? $CHAPTEREND : $SECTIONEND);
5425 print "# writing " . scalar(@sections) . " sections in $docu_top_file ..."
5432 # loop through sections
5433 while ($section = shift(@sections))
5435 if ($T2H_SPLIT && ($T2H_SPLIT eq 'section' || $previous eq $CHAPTEREND))
5439 #close previous page
5440 &$T2H_print_chapter_footer($FH) if $T2H_SPLIT eq 'chapter';
5441 &$T2H_print_page_foot($FH);
5446 $T2H_NAME{Back} = $T2H_NAME{This};
5447 $T2H_HREF{Back} = $T2H_HREF{This};
5448 $T2H_NODE{Back} = $T2H_NODE{This};
5449 $T2H_NAME{This} = $T2H_NAME{Forward};
5450 $T2H_HREF{This} = $T2H_HREF{Forward};
5451 $T2H_NODE{This} = $T2H_NODE{Forward};
5454 $T2H_NODE{Forward} = $sec2node{$sections[0]};
5455 $T2H_NAME{Forward} = &clean_name($T2H_NODE{Forward});
5456 $T2H_HREF{Forward} = sec_href($sections[0]);
5460 delete $T2H_HREF{Forward};
5461 delete $T2H_NODE{Forward};
5462 delete $T2H_NAME{Forward};
5465 $node = $node2up{$T2H_NODE{This}};
5466 $T2H_HREF{Up} = $node2href{$node};
5467 if ($T2H_HREF{Up} eq $T2H_HREF{This} || ! $T2H_HREF{Up})
5469 $T2H_NAME{Up} = $T2H_NAME{Top};
5470 $T2H_HREF{Up} = $T2H_HREF{Top};
5471 $T2H_NODE{Up} = 'Up';
5475 $T2H_NAME{Up} = &clean_name($node);
5476 $T2H_NODE{Up} = $node;
5479 $node = $node2prev{$T2H_NODE{This}};
5480 $T2H_NAME{Prev} = &clean_name($node);
5481 $T2H_HREF{Prev} = $node2href{$node};
5482 $T2H_NODE{Prev} = $node;
5484 $node = Node2FastBack($T2H_NODE{This});
5485 $T2H_NAME{FastBack} = &clean_name($node);
5486 $T2H_HREF{FastBack} = $node2href{$node};
5487 $T2H_NODE{FastBack} = $node;
5489 $node = $node2next{$T2H_NODE{This}};
5490 $T2H_NAME{Next} = &clean_name($node);
5491 $T2H_HREF{Next} = $node2href{$node};
5492 $T2H_NODE{Next} = $node;
5494 $node = Node2FastForward($T2H_NODE{This});
5495 $T2H_NAME{FastForward} = &clean_name($node);
5496 $T2H_HREF{FastForward} = $node2href{$node};
5497 $T2H_NODE{FastForward} = $node;
5501 my $file = $T2H_HREF{This};
5503 open(FILE, "> $docu_rdir$file") ||
5504 die "$ERROR: Can't open $docu_rdir$file for writing: $!\n";
5506 &$T2H_print_page_head($FH);
5507 t2h_print_label($FH);
5508 &$T2H_print_chapter_header($FH) if $T2H_SPLIT eq 'chapter';
5512 t2h_print_label($FH);
5515 $T2H_THIS_SECTION = [];
5518 $_ = shift(@doc_lines);
5519 last if ($_ eq $SECTIONEND || $_ eq $CHAPTEREND);
5520 push(@$T2H_THIS_SECTION, $_);
5523 &$T2H_print_section($FH);
5528 print "." if $counter =~ /00$/;
5533 &$T2H_print_chapter_footer($FH) if $T2H_SPLIT eq 'chapter';
5534 &$T2H_print_page_foot($FH);
5537 print "\n" if $T2H_VERBOSE;
5539 #############################################################################
5540 # Print ToC, Overview, Footnotes
5542 delete $T2H_HREF{Prev};
5543 delete $T2H_HREF{Next};
5544 delete $T2H_HREF{Back};
5545 delete $T2H_HREF{Forward};
5546 delete $T2H_HREF{Up};
5550 print "# writing Footnotes in $docu_foot_file...\n" if $T2H_VERBOSE;
5551 open (FILE, "> $docu_foot_file") || die "$ERROR: Can't open $docu_foot_file for writing: $!\n"
5553 $T2H_HREF{This} = $docu_foot;
5554 $T2H_NAME{This} = $T2H_WORDS->{$T2H_LANG}->{'Footnotes_Title'};
5555 $T2H_THIS_SECTION = \@foot_lines;
5556 &$T2H_print_Footnotes(\*FILE);
5557 close(FILE) if $T2H_SPLIT;
5562 print "# writing Toc in $docu_toc_file...\n" if $T2H_VERBOSE;
5563 open (FILE, "> $docu_toc_file") || die "$ERROR: Can't open $docu_toc_file for writing: $!\n"
5565 $T2H_HREF{This} = $T2H_HREF{Contents};
5566 $T2H_NAME{This} = $T2H_NAME{Contents};
5567 $T2H_THIS_SECTION = \@toc_lines;
5568 &$T2H_print_Toc(\*FILE);
5569 close(FILE) if $T2H_SPLIT;
5574 print "# writing Overview in $docu_stoc_file...\n" if $T2H_VERBOSE;
5575 open (FILE, "> $docu_stoc_file") || die "$ERROR: Can't open $docu_stoc_file for writing: $!\n"
5577 $T2H_HREF{This} = $T2H_HREF{Overview};
5578 $T2H_NAME{This} = $T2H_NAME{Overview};
5579 $T2H_THIS_SECTION = \@stoc_lines;
5580 unshift @$T2H_THIS_SECTION, "<BLOCKQUOTE>\n";
5581 push @$T2H_THIS_SECTION, "\n</BLOCKQUOTE>\n";
5582 &$T2H_print_Overview(\*FILE);
5583 close(FILE) if $T2H_SPLIT;
5586 if ($about_body = &$T2H_about_body())
5588 print "# writing About in $docu_about_file...\n" if $T2H_VERBOSE;
5589 open (FILE, "> $docu_about_file") || die "$ERROR: Can't open $docu_about_file for writing: $!\n"
5592 $T2H_HREF{This} = $T2H_HREF{About};
5593 $T2H_NAME{This} = $T2H_NAME{About};
5594 $T2H_THIS_SECTION = [$about_body];
5595 &$T2H_print_About(\*FILE);
5596 close(FILE) if $T2H_SPLIT;
5601 &$T2H_print_page_foot(\*FILE);
5606 &l2h_FinishFromHtml if ($T2H_L2H);
5607 &l2h_Finish if($T2H_L2H);
5608 print "# that's all folks\n" if $T2H_VERBOSE;
5613 #+++############################################################################
5615 # Low level functions #
5617 #---############################################################################
5619 sub LocateIncludeFile
5624 # APA: Don't implicitely search ., to conform with the docs!
5625 # return $file if (-e $file && -r $file);
5626 foreach $dir (@T2H_INCLUDE_DIRS)
5628 return "$dir/$file" if (-e "$dir/$file" && -r "$dir/$file");
5636 $_ = &remove_style($_[0]);
5643 my($name, $level) = @_;
5646 $level--; # here we start at 0
5647 if ($name =~ /^appendix/ || defined(@appendix_sec_num))
5650 if (defined(@appendix_sec_num))
5652 &incr_sec_num($level, @appendix_sec_num);
5656 @appendix_sec_num = ('A', 0, 0, 0);
5658 $ret = join('.', @appendix_sec_num[0..$level]);
5663 if (defined(@normal_sec_num))
5665 &incr_sec_num($level, @normal_sec_num);
5669 @normal_sec_num = (1, 0, 0, 0);
5671 $ret = join('.', @normal_sec_num[0..$level]);
5673 $ret .= "." if $level == 0;
5682 foreach $l ($level+1 .. 3)
5691 my $num = $sec2number{$sec};
5693 return '' unless $num;
5694 return 'Top' unless $num =~ /\.\d+/;
5695 $num =~ s/\.[^\.]*$//;
5696 $num = $num . '.' unless $num =~ /\./;
5697 return $sec2node{$number2sec{$num}};
5700 # Return previous node or "Top"
5704 my $sec_num = $sec2seccount{$sec} - 1;
5705 return "Top" if !$sec_num || $sec_num < 1;
5706 return $sec2node{$seccount2sec{$sec_num}};
5709 # Return next node or "Top"
5713 my $sec_num = $sec2seccount{$sec} + 1;
5714 return "Top" unless exists $seccount2sec{$sec_num};
5715 return $sec2node{$seccount2sec{$sec_num}};
5719 # sub Node2FastBack NODE
5725 # The beginning of this chapter, or if already there, the beginning of the
5731 my $num = $sec2number{$node2sec{$node}};
5734 # Index Pages have no section number and 1. should go back to Top
5735 return $node2prev{$node} if !$num or $num eq "1.";
5737 # Get the current chapter
5738 $num =~ /^([A-Z\d]+)\./;
5741 # If the first section of this chapter, decrement chapter
5742 $n = $n eq 'A' ? $normal_sec_num[0] : $n =~ /^\d+$/ ? --$n : chr(ord($n)-1)
5743 if $n . '.' eq $num;
5745 # Return node name for section number "$n."
5746 return $sec2node{$number2sec{$n . '.'}} || $node2prev{$node};
5750 # sub Node2FastForward NODE
5756 # The beginning of the next chapter.
5758 sub Node2FastForward
5761 my $num = $sec2number{$node2sec{$node}};
5765 return $node2next{$node} if !$num;
5767 # Get current chapter
5768 $num =~ /^([A-Z\d]+)\./;
5772 $n = $n eq $normal_sec_num[0] ? 'A' : ++$n;
5775 return $sec2node{$number2sec{$n . '.'}} || $node2next{$node};
5780 local($_, %seen, %context, $before, $match, $after);
5784 if (/\@(\*|\.|\:|\@|\{|\})/)
5787 $context{$&} .= "> $_" if $T2H_VERBOSE;
5793 ($before, $match, $after) = ($`, $&, $');
5794 if ($before =~ /\b[-\w]+$/ && $after =~ /^[-\w.]*\b/)
5796 $seen{'e-mail address'}++;
5797 $context{'e-mail address'} .= "> $_" if $T2H_VERBOSE;
5802 $context{$match} .= "> $_" if $T2H_VERBOSE;
5805 $_ = "$before$match$after";
5810 foreach (sort(keys(%seen)))
5819 print "$_ ($seen{$_})\n";
5830 if (open($fh_name, $name))
5832 unshift(@fhs, $fh_name);
5836 warn "$ERROR Can't read file $name: $!\n";
5843 @fhs = (); # hold the file handles to read
5844 @input_spool = (); # spooled lines to read
5855 $line = shift(@input_spool);
5862 return($line) if $line;
5869 # used in pass 1, use &next_line
5875 while ($_ = &next_line
)
5877 return if /^\@end\s+$tag\s*$/;
5879 die "* Failed to find '$tag' after: " . $lines[$#lines];
5882 # used in pass 1 for l2h use &next_line
5888 while ($_ = &next_line
)
5890 return $string if /^\@end\s+$tag\s*$/;
5891 # $_ =~ s/hbox/mbox/g;
5892 $string = $string.$_;
5894 die "* Failed to find '$tag' after: " . $lines[$#lines];
5898 # HTML stacking to have a better HTML output
5903 @html_stack = ('html');
5904 $html_element = 'body';
5910 push(@html_stack, $html_element);
5911 $html_element = $what;
5917 push(@html_stack, $html_element)
5918 if ($html_element && $html_element ne 'P');
5919 $html_element = $what;
5924 $html_element = pop(@html_stack);
5935 if ($elt eq $html_element)
5937 $html_element = pop(@html_stack) if @html_stack;
5944 $html_element = pop(@html_stack) if @html_stack;
5950 my($what, $line) = @_;
5951 if ($T2H_DEBUG & $DEBUG_HTML)
5953 $what = "\n" unless $what;
5954 return("<!-- $line @html_stack, $html_element -->$what")
5959 # to debug the output...
5962 my($what, $line) = @_;
5963 return("<!-- $line -->$what")
5964 if $T2H_DEBUG & $DEBUG_HTML;
5973 $_ = substitute_style
($_);
5985 $_ = substitute_style
($_);
5991 my ($node, $name, $descr) = @_;
5994 &normalise_node
($node);
5995 $href = $node2href{$node};
6000 $descr = SimpleTexi2Html
($descr);
6001 if ($T2H_NUMBER_SECTIONS && !$T2H_NODE_NAME_IN_MENU && $node2sec{$node})
6003 $entry = $node2sec{$node};
6008 &normalise_node
($name);
6009 $entry = ($name && ($name ne $node || ! $T2H_AVOID_MENU_REDUNDANCY)
6010 ?
"$name : $node" : $node);
6013 if ($T2H_AVOID_MENU_REDUNDANCY && $descr)
6015 my $clean_entry = $entry;
6016 $clean_entry =~ s/^.*? // if ($clean_entry =~ /^([A-Z]|\d+)\.[\d\.]* /);
6017 $clean_entry =~ s/[^\w]//g;
6018 my $clean_descr = $descr;
6019 $clean_descr =~ s/[^\w]//g;
6020 $descr = '' if ($clean_entry eq $clean_descr)
6022 push(@lines2,&debug
('<TR><TD ALIGN="left" VALIGN="TOP">' .
6023 &t2h_anchor
('', $href, $entry) .
6024 '</TD><TD> </TD><TD ALIGN="left" VALIGN="TOP">' .
6026 "</TD></TR>\n", __LINE__
));
6028 elsif ($node =~ /^\(.*\)\w+/)
6030 push(@lines2,&debug
('<TR><TD ALIGN="left" VALIGN="TOP">' .
6032 '</TD><TD ALIGN="left" VALIGN="TOP">' . $descr .
6033 "</TD></TR>\n", __LINE__
))
6037 warn "$ERROR Undefined node of menu_entry ($node): $_";
6041 sub do_ctrl
{ "^$_[0]" }
6045 my($addr, $text) = split(/,\s*/, $_[0]);
6047 $text = $addr unless $text;
6048 &t2h_anchor
('', "mailto:$addr", $text);
6053 # l2h does this much better
6054 return &l2h_ToLatex
("{\\sc ".&unprotect_html
($_[0])."}") if ($T2H_L2H);
6061 # This sub doesn't seem to be used.
6062 # What are $_[0] and $text?
6064 return &l2h_ToLatex
("\$".&unprotect_html
($_[0])."\$") if ($T2H_L2H);
6065 return "<EM>".$text."</EM>";
6070 my($url, $text, $only_text) = split(/,\s*/, $_[0]);
6071 # APA: Don't markup obviously bad links.
6072 # e.g. texinfo.texi 4.0 has this, which would lead to a broken
6074 # @section @code{@@uref@{@var{url}[, @var{text}][, @var{replacement}]@}}
6075 return if $url =~ /[<>]/;
6076 $text = $only_text if $only_text;
6077 $text = $url unless $text;
6078 &t2h_anchor
('', $url, $text);
6081 sub do_url
{ &t2h_anchor
('', $_[0], $_[0]) }
6085 return '<FONT SIZE="-1">' . $_[0] . '</FONT>';
6090 return "&$_[0]acute;" if $_[1] eq 'H';
6091 return "$_[0]." if $_[1] eq 'dotaccent';
6092 return "$_[0]*" if $_[1] eq 'ringaccent';
6093 return "$_[0]".'[' if $_[1] eq 'tieaccent';
6094 return "$_[0]".'(' if $_[1] eq 'u';
6095 return "$_[0]_" if $_[1] eq 'ubaraccent';
6096 return ".$_[0]" if $_[1] eq 'udotaccent';
6097 return "$_[0]<" if $_[1] eq 'v';
6098 return "&$_[0]cedil;" if $_[1] eq ',';
6099 return "$_[0]" if $_[1] eq 'dotless';
6105 my($texi_style, $text) = @_;
6108 $style = $style_map{$texi_style};
6109 if (defined($style))
6112 if ($style =~ /^\"/)
6117 if ($style =~ /^\&/)
6121 $text = &$style($text, $texi_style);
6126 $text = "<$style>$text</$style>";
6131 $text = "<Q>$text</Q>" if $do_quotes;
6140 # remove Texinfo styles
6144 1 while(s/\@\w+{([^\{\}]+)}/$1/g);
6155 sub substitute_style
6158 my($changed, $done, $style, $text);
6160 &simple_substitutions
;
6166 while (/\@(\w+){([^\{\}]+)}/ || /\@(,){([^\{\}]+)}/)
6168 $text = &apply_style
($1, $2);
6187 my($name, $href, $text, $newline, $extra_attribs) = @_;
6191 $result .= " NAME=\"".protect_html
($name)."\"" if $name;
6194 $href =~ s
|^$T2H_HREF_DIR_INSTEAD_FILE|./|
6195 if ($T2H_HREF_DIR_INSTEAD_FILE);
6196 $result .= " HREF=\"".protect_html
($href)."\"";
6198 $result .= " $extra_attribs" if $extra_attribs;
6199 $result .= ">$text</A>";
6200 $result .= "\n" if $newline;
6208 return("${docu_name}_$num.$docu_ext");
6213 return $node2href{$sec2node{$_[0]}};
6219 if ("$docu_rdir${docu_name}_$doc_num.$docu_ext" eq "$docu_top_file") {
6220 warn "$WARN Section $docu_rdir${docu_name}_$doc_num.$docu_ext would overwrite Top, continuing at $docu_rdir${docu_name}_".($doc_num+1).".$docu_ext";
6223 $docu_doc = &doc_href
($doc_num);
6228 my ($fh, $lines) = @_;
6230 $lines = $T2H_THIS_SECTION unless $lines;
6235 $_ = l2h_FromHtml
($_) if ($T2H_L2H);
6236 if (/^$PROTECTTAG/o)
6245 @cnt = split(/\W*\s+\W*/);
6246 $cnt += scalar(@cnt);
6264 # protect &, ", <, and >.
6265 # APA: Keep it simple. This is what perl's CGI::espaceHTML does.
6266 # We may consider using that instead.
6267 # If raw HTML is used outside @ifhtml or @html it's an error
6269 $what =~ s/\&/\&/go;
6270 $what =~ s/\"/\"/go;
6271 $what =~ s/\</\</go;
6272 $what =~ s/\>/\>/go;
6296 # Character entity references (eg. <)
6298 # Numeric character references (eg. <)
6299 $what =~ s/\&/\&/go;
6300 $what =~ s/\"/\"/go;
6301 $what =~ s/\</\</go;
6302 $what =~ s/\>/\>/go;
6309 my $href = shift || $T2H_HREF{This
};
6310 $href =~ s/.*#(.*)$/$1/;
6311 print $fh qq{<A NAME
="$href"></A
>\n};
6316 SetDocumentLanguage
('en') unless ($T2H_LANG);
6317 # APA: There's got to be a better way:
6318 $things_map{'today'} = &pretty_date
;
6320 $T2H_TODAY = &pretty_date
; # like "20 September 1993"
6321 # the eval prevents this from breaking on system which do not have
6322 # a proper getpwuid implemented
6323 eval { ($T2H_USER = (getpwuid ($<))[6]) =~ s/,.*//;}; # Who am i
6324 # APA: Provide Windows NT workaround until getpwuid gets
6325 # implemented there.
6326 $T2H_USER = $ENV{'USERNAME'} unless defined $T2H_USER;
6336 ##############################################################################
6338 # These next few lines are legal in both Perl and nroff.
6342 'di \" finish diversion--previous line must be blank
6343 .nr nl 0-1 \" fake up transition to first page again
6344 .nr % 0 \" start at page 1
6345 '; __END__
############# From here on it's a standard manual page ############
6346 .so
/usr/share
/man/man
1/texi2html
.1