components/texinfo/texi2html.pl
author Sonam Gupta <sonam.x.gupta@oracle.com>
Wed, 13 Feb 2013 01:14:45 -0800
branchs11-update
changeset 2490 ee4391c71c07
parent 233 95421649b836
permissions -rw-r--r--
15698471 cups should audit printing information in TX environments 14850597 TX printing is reported to print jobs even when request authorization fail. 16182423 Update error code for all the failed use of authorization records in CUPS 16182458 Print 3 files requesting nolabel and nobanner should produce 6 audit records 16201093 For remote print requests, the path token in AR from GZ needs modification
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
233
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     1
#!/usr/perl5/bin/perl
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     2
'di ';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     3
'ig 00 ';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     4
#+##############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     5
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     6
# File: texi2html                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     7
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     8
# Description: Program to transform most Texinfo documents to HTML             #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
     9
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    10
#-##############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    11
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    12
# From @(#)texi2html	1.52 01/05/98	Written (mainly) by Lionel Cons, [email protected]
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    13
# $Id: texi2html,v 1.5 1999/02/20 20:27:00 karl Exp $
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    14
# This version of texi2html is currently maintained at
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    15
# ftp://ftp.cs.umb.edu/pub/tex/texi2html by [email protected].
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    16
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    17
# The man page for this program is included at the end of this file and can be
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    18
# viewed using the command 'nroff -man texi2html'.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    19
# Please read the copyright at the end of the man page.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    20
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    21
#+++############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    22
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    23
# Constants                                                                    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    24
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    25
#---############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    26
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    27
$DEBUG_TOC   =  1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    28
$DEBUG_INDEX =  2;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    29
$DEBUG_BIB   =  4;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    30
$DEBUG_GLOSS =  8;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    31
$DEBUG_DEF   = 16;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    32
$DEBUG_HTML  = 32;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    33
$DEBUG_USER  = 64;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    34
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    35
$BIBRE = '\[[\w\/-]+\]';		# RE for a bibliography reference
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    36
$FILERE = '[\/\w.+-]+';			# RE for a file name
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    37
$VARRE = '[^\s\{\}]+';			# RE for a variable name
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    38
$NODERE = '[^@{}:\'`",]+';		# RE for a node name
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    39
$NODESRE = '[^@{}:\'`"]+';		# RE for a list of node names
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    40
$XREFRE = '[^@{}]+';			# RE for a xref (should use NODERE)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    41
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    42
$ERROR = "***";			        # prefix for errors and warnings
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    43
$THISVERSION = "1.56k";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    44
$THISPROG = "texi2html $THISVERSION";	# program name and version
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    45
$HOMEPAGE = "http://wwwinfo.cern.ch/dis/texi2html/"; # program home page
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    46
$TODAY = &pretty_date;			# like "20 September 1993"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    47
$SPLITTAG = "<!-- SPLIT HERE -->\n";	# tag to know where to split
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    48
$PROTECTTAG = "_ThisIsProtected_";	# tag to recognize protected sections
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    49
$html2_doctype = '<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0 Strict Level 2//EN">';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    50
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    51
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    52
# language dependent constants
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    53
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    54
#$LDC_SEE = 'see';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    55
#$LDC_SECTION = 'section';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    56
#$LDC_IN = 'in';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    57
#$LDC_TOC = 'Table of Contents';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    58
#$LDC_GOTO = 'Go to the';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    59
#$LDC_FOOT = 'Footnotes';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    60
# TODO: @def* shortcuts
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    61
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    62
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    63
# pre-defined indices
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    64
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    65
%predefined_index = (
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    66
		    'cp', 'c',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    67
		    'fn', 'f',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    68
		    'vr', 'v',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    69
		    'ky', 'k',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    70
		    'pg', 'p',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    71
		    'tp', 't',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    72
	            );
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    73
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    74
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    75
# valid indices
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    76
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    77
%valid_index = (
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    78
		    'c', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    79
		    'f', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    80
		    'v', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    81
		    'k', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    82
		    'p', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    83
		    't', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    84
		);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    85
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    86
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    87
# texinfo section names to level
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    88
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    89
%sec2level = (
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    90
	      'top', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    91
	      'chapter', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    92
	      'unnumbered', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    93
	      'majorheading', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    94
	      'chapheading', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    95
	      'appendix', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    96
	      'section', 2,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    97
	      'unnumberedsec', 2,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    98
	      'heading', 2,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
    99
	      'appendixsec', 2,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   100
	      'appendixsection', 2,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   101
	      'subsection', 3,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   102
	      'unnumberedsubsec', 3,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   103
	      'subheading', 3,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   104
	      'appendixsubsec', 3,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   105
	      'subsubsection', 4,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   106
	      'unnumberedsubsubsec', 4,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   107
	      'subsubheading', 4,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   108
	      'appendixsubsubsec', 4,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   109
	      );
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   110
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   111
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   112
# accent map, TeX command to ISO name
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   113
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   114
%accent_map = (
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   115
	       '"',  'uml',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   116
	       '~',  'tilde',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   117
	       '^',  'circ',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   118
	       '`',  'grave',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   119
	       '\'', 'acute',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   120
	       );
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   121
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   122
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   123
# texinfo "simple things" (@foo) to HTML ones
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   124
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   125
%simple_map = (
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   126
	       # cf. makeinfo.c
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   127
	       "*", "<BR>",		# HTML+
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   128
	       " ", " ",
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   129
	       "\t", " ",
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   130
  	       "-", "&#173;",	# soft hyphen
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   131
	       "\n", "\n",
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   132
	       "|", "",
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   133
	       'tab', '<\/TD><TD>',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   134
	       # spacing commands
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   135
	       ":", "",
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   136
	       "!", "!",
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   137
	       "?", "?",
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   138
	       ".", ".",
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   139
	       "-", "",
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   140
	       );
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   141
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   142
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   143
# texinfo "things" (@foo{}) to HTML ones
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   144
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   145
%things_map = (
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   146
	       'TeX', 'TeX',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   147
	       'br', '<P>',		# paragraph break
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   148
	       'bullet', '*',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   149
	       'copyright', '(C)',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   150
	       'dots', '...',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   151
	       'equiv', '==',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   152
	       'error', 'error-->',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   153
	       'expansion', '==>',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   154
	       'minus', '-',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   155
	       'point', '-!-',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   156
	       'print', '-|',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   157
	       'result', '=>',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   158
	       'today', $TODAY,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   159
	       );
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   160
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   161
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   162
# texinfo styles (@foo{bar}) to HTML ones
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   163
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   164
%style_map = (
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   165
	      'asis', '',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   166
	      'b', 'B',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   167
	      'cite', 'CITE',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   168
	      'code', 'CODE',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   169
	      'ctrl', '&do_ctrl',	# special case
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   170
	      'dfn', 'EM',		# DFN tag is illegal in the standard
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   171
	      'dmn', '',		# useless
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   172
	      'email', '&do_email',     # insert a clickable email address
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   173
	      'emph', 'EM',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   174
	      'file', '"TT',		# will put quotes, cf. &apply_style
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   175
	      'i', 'I',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   176
	      'kbd', 'KBD',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   177
	      'key', 'KBD',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   178
	      'math', 'EM',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   179
	      'r', '',			# unsupported
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   180
	      'samp', '"SAMP',		# will put quotes, cf. &apply_style
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   181
	      'sc', '&do_sc',		# special case
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   182
	      'strong', 'STRONG',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   183
	      't', 'TT',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   184
	      'titlefont', '',		# useless
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   185
	      'uref', '&do_uref',       # insert a clickable URL
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   186
	      'url', '&do_url',         # insert a clickable URL
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   187
	      'var', 'VAR',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   188
	      'w', '',			# unsupported
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   189
	      );
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   190
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   191
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   192
# texinfo format (@foo/@end foo) to HTML ones
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   193
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   194
%format_map = (
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   195
	       'display', 'PRE',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   196
	       'example', 'PRE',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   197
	       'format', 'PRE',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   198
	       'lisp', 'PRE',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   199
	       'quotation', 'BLOCKQUOTE',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   200
	       'smallexample', 'PRE',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   201
	       'smalllisp', 'PRE',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   202
	       # lists
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   203
	       'itemize', 'UL',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   204
	       'enumerate', 'OL',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   205
	       # poorly supported
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   206
	       'flushleft', 'PRE',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   207
	       'flushright', 'PRE',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   208
	       );
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   209
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   210
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   211
# texinfo definition shortcuts to real ones
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   212
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   213
%def_map = (
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   214
	    # basic commands
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   215
	    'deffn', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   216
	    'defvr', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   217
	    'deftypefn', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   218
	    'deftypevr', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   219
	    'defcv', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   220
	    'defop', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   221
	    'deftp', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   222
	    # basic x commands
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   223
	    'deffnx', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   224
	    'defvrx', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   225
	    'deftypefnx', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   226
	    'deftypevrx', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   227
	    'defcvx', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   228
	    'defopx', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   229
	    'deftpx', 0,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   230
	    # shortcuts
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   231
	    'defun', 'deffn Function',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   232
	    'defmac', 'deffn Macro',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   233
	    'defspec', 'deffn {Special Form}',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   234
	    'defvar', 'defvr Variable',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   235
	    'defopt', 'defvr {User Option}',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   236
	    'deftypefun', 'deftypefn Function',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   237
	    'deftypevar', 'deftypevr Variable',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   238
	    'defivar', 'defcv {Instance Variable}',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   239
	    'defmethod', 'defop Method',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   240
	    # x shortcuts
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   241
	    'defunx', 'deffnx Function',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   242
	    'defmacx', 'deffnx Macro',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   243
	    'defspecx', 'deffnx {Special Form}',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   244
	    'defvarx', 'defvrx Variable',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   245
	    'defoptx', 'defvrx {User Option}',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   246
	    'deftypefunx', 'deftypefnx Function',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   247
	    'deftypevarx', 'deftypevrx Variable',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   248
	    'defivarx', 'defcvx {Instance Variable}',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   249
	    'defmethodx', 'defopx Method',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   250
	    );
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   251
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   252
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   253
# things to skip
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   254
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   255
%to_skip = (
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   256
	    # comments
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   257
	    'c', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   258
	    'comment', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   259
            'ifnothtml', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   260
	    # useless
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   261
	    'detailmenu', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   262
            'direntry', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   263
	    'contents', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   264
	    'shortcontents', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   265
	    'summarycontents', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   266
	    'footnotestyle', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   267
	    'end ifclear', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   268
	    'end ifset', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   269
	    'titlepage', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   270
	    'end titlepage', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   271
	    # unsupported commands (formatting)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   272
	    'afourpaper', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   273
	    'cropmarks', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   274
	    'finalout', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   275
	    'headings', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   276
            'sp', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   277
	    'need', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   278
	    'page', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   279
	    'setchapternewpage', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   280
	    'everyheading', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   281
	    'everyfooting', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   282
	    'evenheading', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   283
	    'evenfooting', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   284
	    'oddheading', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   285
	    'oddfooting', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   286
	    'smallbook', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   287
	    'vskip', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   288
	    'filbreak', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   289
	    'paragraphindent', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   290
	    # unsupported formats
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   291
	    'cartouche', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   292
	    'end cartouche', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   293
	    'group', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   294
	    'end group', 1,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   295
	    );
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   296
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   297
#+++############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   298
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   299
# Argument parsing, initialisation                                             #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   300
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   301
#---############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   302
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   303
%value = ();				# hold texinfo variables, see also -D
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   304
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   305
$use_bibliography = 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   306
$use_acc = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   307
$debug = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   308
$doctype = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   309
$check = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   310
$expandinfo = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   311
$use_glossary = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   312
$invisible_mark = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   313
$use_iso = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   314
@include_dirs = ();
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   315
$show_menu = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   316
$number_sections = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   317
$split_node = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   318
$split_chapter = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   319
$monolithic = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   320
$verbose = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   321
$usage = <<EOT;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   322
This is $THISPROG
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   323
To convert a Texinfo file to HMTL: $0 [options] file
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   324
  where options can be:
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   325
    -expandinfo    : use \@ifinfo sections, not \@iftex
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   326
    -glossary      : handle a glossary
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   327
    -invisible name: use 'name' as an invisible anchor
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   328
    -Dname         : define name like with \@set
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   329
    -I dir         : search also for files in 'dir'
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   330
    -menu          : handle menus
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   331
    -monolithic    : output only one file including ToC
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   332
    -number        : number sections
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   333
    -split_chapter : split on main sections
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   334
    -split_node    : split on nodes
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   335
    -usage         : print usage instructions
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   336
    -verbose       : verbose output
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   337
To check converted files: $0 -check [-verbose] files
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   338
EOT
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   339
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   340
while (@ARGV && $ARGV[0] =~ /^-/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   341
    $_ = shift(@ARGV);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   342
    if (/^-acc$/)            { $use_acc = 1; next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   343
    if (/^-d(ebug)?(\d+)?$/) { $debug = $2 || shift(@ARGV); next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   344
    if (/^-doctype$/)        { $doctype = shift(@ARGV); next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   345
    if (/^-c(heck)?$/)       { $check = 1; next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   346
    if (/^-e(xpandinfo)?$/)  { $expandinfo = 1; next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   347
    if (/^-g(lossary)?$/)    { $use_glossary = 1; next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   348
    if (/^-i(nvisible)?$/)   { $invisible_mark = shift(@ARGV); next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   349
    if (/^-iso$/)            { $use_iso = 1; next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   350
    if (/^-D(.+)?$/)         { $value{$1 || shift(@ARGV)} = 1; next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   351
    if (/^-I(.+)?$/)         { push(@include_dirs, $1 || shift(@ARGV)); next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   352
    if (/^-m(enu)?$/)        { $show_menu = 1; next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   353
    if (/^-mono(lithic)?$/)  { $monolithic = 1; next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   354
    if (/^-n(umber)?$/)      { $number_sections = 1; next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   355
    if (/^-s(plit)?_?(n(ode)?|c(hapter)?)?$/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   356
	if ($2 =~ /^n/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   357
	    $split_node = 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   358
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   359
	    $split_chapter = 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   360
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   361
	next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   362
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   363
    if (/^-v(erbose)?$/)     { $verbose = 1; next; }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   364
    die $usage;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   365
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   366
if ($check) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   367
    die $usage unless @ARGV > 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   368
    &check;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   369
    exit;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   370
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   371
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   372
if (($split_node || $split_chapter) && $monolithic) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   373
    warn "Can't use -monolithic with -split, -monolithic ignored.\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   374
    $monolithic = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   375
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   376
if ($expandinfo) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   377
    $to_skip{'ifinfo'}++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   378
    $to_skip{'end ifinfo'}++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   379
    $to_skip{'ifnottex'}++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   380
    $to_skip{'end ifnottex'}++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   381
} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   382
    $to_skip{'iftex'}++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   383
    $to_skip{'end iftex'}++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   384
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   385
$invisible_mark = '<IMG SRC="invisible.xbm">' if $invisible_mark eq 'xbm';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   386
die $usage unless @ARGV == 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   387
$docu = shift(@ARGV);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   388
if ($docu =~ /.*\//) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   389
    chop($docu_dir = $&);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   390
    $docu_name = $';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   391
} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   392
    $docu_dir = '.';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   393
    $docu_name = $docu;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   394
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   395
unshift(@include_dirs, $docu_dir);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   396
$docu_name =~ s/\.te?x(i|info)?$//;	# basename of the document
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   397
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   398
$docu_doc = "$docu_name.html";		# document's contents
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   399
if ($monolithic) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   400
    $docu_toc = $docu_foot = $docu_doc;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   401
} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   402
    $docu_toc  = "${docu_name}_toc.html";  # document's table of contents
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   403
    $docu_foot = "${docu_name}_foot.html"; # document's footnotes
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   404
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   405
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   406
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   407
# variables
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   408
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   409
$value{'html'} = 1;			# predefine html (the output format)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   410
$value{'texi2html'} = $THISVERSION;	# predefine texi2html (the translator)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   411
# _foo: internal to track @foo
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   412
foreach ('_author', '_title', '_subtitle',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   413
	 '_settitle', '_setfilename') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   414
    $value{$_} = '';		        # prevent -w warnings
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   415
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   416
%node2sec = ();				# node to section name
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   417
%node2href = ();			# node to HREF
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   418
%bib2href = ();				# bibliography reference to HREF
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   419
%gloss2href = ();			# glossary term to HREF
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   420
@sections = ();				# list of sections
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   421
%tag2pro = ();				# protected sections
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   422
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   423
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   424
# initial indexes
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   425
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   426
$bib_num = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   427
$foot_num = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   428
$gloss_num = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   429
$idx_num = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   430
$sec_num = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   431
$doc_num = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   432
$html_num = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   433
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   434
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   435
# can I use ISO8879 characters? (HTML+)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   436
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   437
if ($use_iso) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   438
    $things_map{'bullet'} = "&bull;";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   439
    $things_map{'copyright'} = "&copy;";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   440
    $things_map{'dots'} = "&hellip;";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   441
    $things_map{'equiv'} = "&equiv;";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   442
    $things_map{'expansion'} = "&rarr;";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   443
    $things_map{'point'} = "&lowast;";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   444
    $things_map{'result'} = "&rArr;";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   445
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   446
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   447
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   448
# read texi2html extensions (if any)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   449
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   450
$extensions = 'texi2html.ext'; # extensions in working directory
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   451
if (-f $extensions) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   452
    print "# reading extensions from $extensions\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   453
    require($extensions);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   454
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   455
($progdir = $0) =~ s/[^\/]+$//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   456
if ($progdir && ($progdir ne './')) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   457
    $extensions = "${progdir}texi2html.ext"; # extensions in texi2html directory
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   458
    if (-f $extensions) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   459
	print "# reading extensions from $extensions\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   460
	require($extensions);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   461
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   462
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   463
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   464
print "# reading from $docu\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   465
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   466
#+++############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   467
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   468
# Pass 1: read source, handle command, variable, simple substitution           #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   469
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   470
#---############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   471
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   472
@lines = ();				# whole document
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   473
@toc_lines = ();			# table of contents
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   474
$toplevel = 0;			        # top level seen in hierarchy
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   475
$curlevel = 0;				# current level in TOC
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   476
$node = '';				# current node name
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   477
$in_table = 0;				# am I inside a table
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   478
$table_type = '';			# type of table ('', 'f', 'v', 'multi')
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   479
@tables = ();			        # nested table support
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   480
$in_bibliography = 0;			# am I inside a bibliography
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   481
$in_glossary = 0;			# am I inside a glossary
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   482
$in_top = 0;				# am I inside the top node
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   483
$in_pre = 0;				# am I inside a preformatted section
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   484
$in_list = 0;				# am I inside a list
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   485
$in_html = 0;				# am I inside an HTML section
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   486
$first_line = 1;		        # is it the first line
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   487
$dont_html = 0;				# don't protect HTML on this line
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   488
$split_num = 0;				# split index
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   489
$deferred_ref = '';			# deferred reference for indexes
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   490
@html_stack = ();			# HTML elements stack
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   491
$html_element = '';			# current HTML element
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   492
&html_reset;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   493
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   494
# build code for simple substitutions
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   495
# the maps used (%simple_map and %things_map) MUST be aware of this
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   496
# watch out for regexps, / and escaped characters!
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   497
$subst_code = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   498
foreach (keys(%simple_map)) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   499
    ($re = $_) =~ s/(\W)/\\$1/g; # protect regexp chars
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   500
    $subst_code .= "s/\\\@$re/$simple_map{$_}/g;\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   501
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   502
foreach (keys(%things_map)) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   503
    $subst_code .= "s/\\\@$_\\{\\}/$things_map{$_}/g;\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   504
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   505
if ($use_acc) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   506
    # accentuated characters
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   507
    foreach (keys(%accent_map)) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   508
	if ($_ eq "`") {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   509
	    $subst_code .= "s/$;3";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   510
	} elsif ($_ eq "'") {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   511
	    $subst_code .= "s/$;4";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   512
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   513
	    $subst_code .= "s/\\\@\\$_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   514
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   515
	$subst_code .= "([aeiou])/&\${1}$accent_map{$_};/gi;\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   516
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   517
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   518
eval("sub simple_substitutions { $subst_code }");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   519
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   520
&init_input;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   521
while ($_ = &next_line) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   522
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   523
    # remove \input on the first lines only
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   524
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   525
    if ($first_line) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   526
	next if /^\\input/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   527
	$first_line = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   528
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   529
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   530
    # parse texinfo tags
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   531
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   532
    $tag = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   533
    $end_tag = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   534
    if (/^\s*\@end\s+(\w+)\b/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   535
	$end_tag = $1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   536
    } elsif (/^\s*\@(\w+)\b/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   537
	$tag = $1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   538
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   539
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   540
    # handle @ifhtml / @end ifhtml
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   541
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   542
    if ($in_html) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   543
	if ($end_tag eq 'ifhtml') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   544
	    $in_html = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   545
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   546
	    $tag2pro{$in_html} .= $_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   547
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   548
	next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   549
    } elsif ($tag eq 'ifhtml') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   550
	$in_html = $PROTECTTAG . ++$html_num;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   551
	push(@lines, $in_html);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   552
	next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   553
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   554
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   555
    # try to skip the line
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   556
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   557
    if ($end_tag) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   558
	next if $to_skip{"end $end_tag"};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   559
    } elsif ($tag) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   560
	next if $to_skip{$tag};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   561
	last if $tag eq 'bye';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   562
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   563
    if ($in_top) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   564
	# parsing the top node
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   565
	if ($tag eq 'node' || $tag eq 'include' || $sec2level{$tag}) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   566
	    # no more in top
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   567
	    $in_top = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   568
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   569
	    # skip it
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   570
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   571
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   572
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   573
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   574
    # try to remove inlined comments
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   575
    # syntax from tex-mode.el comment-start-skip
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   576
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   577
    s/((^|[^\@])(\@\@)*)\@c(omment)? .*/$1/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   578
    # non-@ substitutions cf. texinfmt.el
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   579
    unless ($in_pre) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   580
	s/``/\"/g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   581
	s/''/\"/g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   582
	s/([\w ])---([\w ])/$1--$2/g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   583
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   584
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   585
    # analyze the tag
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   586
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   587
    if ($tag) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   588
	# skip lines
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   589
	&skip_until($tag), next if $tag eq 'ignore';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   590
	if ($expandinfo) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   591
	    &skip_until($tag), next if $tag eq 'iftex';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   592
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   593
	    &skip_until($tag), next if $tag eq 'ifinfo';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   594
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   595
	&skip_until($tag), next if $tag eq 'tex';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   596
	# handle special tables
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   597
	if ($tag =~ /^(|f|v|multi)table$/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   598
	    $table_type = $1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   599
	    $tag = 'table';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   600
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   601
	# special cases
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   602
	if ($tag eq 'top' || ($tag eq 'node' && /^\@node\s+top\s*,/i)) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   603
	    $in_top = 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   604
	    @lines = (); # ignore all lines before top (title page garbage)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   605
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   606
	} elsif ($tag eq 'node') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   607
	    $in_top = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   608
	    warn "$ERROR Bad node line: $_" unless $_ =~ /^\@node\s$NODESRE$/o;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   609
	    $_ = &protect_html($_); # if node contains '&' for instance
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   610
	    s/^\@node\s+//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   611
	    ($node) = split(/,/);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   612
	    &normalise_node($node);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   613
	    if ($split_node) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   614
		&next_doc;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   615
		push(@lines, $SPLITTAG) if $split_num++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   616
		push(@sections, $node);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   617
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   618
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   619
	} elsif ($tag eq 'include') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   620
	    if (/^\@include\s+($FILERE)\s*$/o) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   621
		$file = $1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   622
		unless (-e $file) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   623
		    foreach $dir (@include_dirs) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   624
			$file = "$dir/$1";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   625
			last if -e $file;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   626
		    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   627
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   628
		if (-e $file) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   629
		    &open($file);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   630
		    print "# including $file\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   631
		} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   632
		    warn "$ERROR Can't find $file, skipping";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   633
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   634
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   635
		warn "$ERROR Bad include line: $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   636
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   637
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   638
	} elsif ($tag eq 'ifclear') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   639
	    if (/^\@ifclear\s+($VARRE)\s*$/o) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   640
		next unless defined($value{$1});
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   641
		&skip_until($tag);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   642
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   643
		warn "$ERROR Bad ifclear line: $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   644
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   645
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   646
	} elsif ($tag eq 'ifset') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   647
	    if (/^\@ifset\s+($VARRE)\s*$/o) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   648
		next if defined($value{$1});
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   649
		&skip_until($tag);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   650
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   651
		warn "$ERROR Bad ifset line: $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   652
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   653
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   654
	} elsif ($tag eq 'menu') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   655
	    unless ($show_menu) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   656
		&skip_until($tag);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   657
		next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   658
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   659
	    &html_push_if($tag);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   660
	    push(@lines, &html_debug("\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   661
	} elsif ($format_map{$tag}) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   662
	    $in_pre = 1 if $format_map{$tag} eq 'PRE';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   663
	    &html_push_if($format_map{$tag});
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   664
	    push(@lines, &html_debug("\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   665
	    $in_list++ if $format_map{$tag} eq 'UL' || $format_map{$tag} eq 'OL' ;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   666
	    push(@lines, &debug("<$format_map{$tag}>\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   667
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   668
	} elsif ($tag eq 'table') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   669
	    if (/^\s*\@(|f|v|multi)table\s+\@(\w+)/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   670
		$in_table = $2;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   671
		unshift(@tables, join($;, $table_type, $in_table));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   672
		if ($table_type eq "multi") {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   673
		    push(@lines, &debug("<TABLE BORDER>\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   674
		    &html_push_if('TABLE');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   675
		} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   676
		    push(@lines, &debug("<DL COMPACT>\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   677
		    &html_push_if('DL');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   678
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   679
		push(@lines, &html_debug("\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   680
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   681
		warn "$ERROR Bad table line: $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   682
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   683
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   684
	} elsif ($tag eq 'synindex' || $tag eq 'syncodeindex') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   685
	    if (/^\@$tag\s+(\w)\w\s+(\w)\w\s*$/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   686
		eval("*${1}index = *${2}index");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   687
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   688
		warn "$ERROR Bad syn*index line: $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   689
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   690
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   691
	} elsif ($tag eq 'sp') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   692
	    push(@lines, &debug("<P>\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   693
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   694
	} elsif ($tag eq 'setref') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   695
	    &protect_html; # if setref contains '&' for instance
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   696
	    if (/^\@$tag\s*{($NODERE)}\s*$/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   697
		$setref = $1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   698
		$setref =~ s/\s+/ /g; # normalize
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   699
		$setref =~ s/ $//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   700
		$node2sec{$setref} = $name;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   701
		$node2href{$setref} = "$docu_doc#$docid";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   702
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   703
		warn "$ERROR Bad setref line: $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   704
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   705
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   706
	} elsif ($tag eq 'defindex' || $tag eq 'defcodeindex') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   707
	    if (/^\@$tag\s+(\w\w)\s*$/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   708
		$valid_index{$1} = 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   709
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   710
		warn "$ERROR Bad defindex line: $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   711
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   712
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   713
	} elsif ($tag eq 'lowersections') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   714
	    local ($sec, $level);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   715
	    while (($sec, $level) = each %sec2level) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   716
		$sec2level{$sec} = $level + 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   717
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   718
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   719
	} elsif ($tag eq 'raisesections') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   720
	    local ($sec, $level);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   721
	    while (($sec, $level) = each %sec2level) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   722
		$sec2level{$sec} = $level - 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   723
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   724
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   725
	} elsif (defined($def_map{$tag})) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   726
	    if ($def_map{$tag}) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   727
		s/^\@$tag\s+//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   728
		$tag = $def_map{$tag};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   729
		$_ = "\@$tag $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   730
		$tag =~ s/\s.*//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   731
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   732
	} elsif (defined($user_sub{$tag})) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   733
	    s/^\@$tag\s+//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   734
	    $sub = $user_sub{$tag};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   735
	    print "# user $tag = $sub, arg: $_" if $debug & $DEBUG_USER;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   736
	    if (defined(&$sub)) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   737
		chop($_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   738
		&$sub($_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   739
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   740
		warn "$ERROR Bad user sub for $tag: $sub\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   741
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   742
	    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   743
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   744
	if (defined($def_map{$tag})) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   745
	    s/^\@$tag\s+//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   746
	    if ($tag =~ /x$/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   747
		# extra definition line
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   748
		$tag = $`;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   749
		$is_extra = 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   750
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   751
		$is_extra = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   752
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   753
	    while (/\{([^\{\}]*)\}/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   754
		# this is a {} construct
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   755
		($before, $contents, $after) = ($`, $1, $');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   756
		# protect spaces
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   757
		$contents =~ s/\s+/$;9/g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   758
		# restore $_ protecting {}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   759
		$_ = "$before$;7$contents$;8$after";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   760
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   761
	    @args = split(/\s+/, &protect_html($_));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   762
	    foreach (@args) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   763
		s/$;9/ /g;	# unprotect spaces
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   764
		s/$;7/\{/g;	# ... {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   765
		s/$;8/\}/g;	# ... }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   766
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   767
	    $type = shift(@args);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   768
	    $type =~ s/^\{(.*)\}$/$1/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   769
	    print "# def ($tag): {$type} ", join(', ', @args), "\n"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   770
		if $debug & $DEBUG_DEF;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   771
	    $type .= ':'; # it's nicer like this
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   772
	    $name = shift(@args);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   773
	    $name =~ s/^\{(.*)\}$/$1/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   774
	    if ($is_extra) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   775
		$_ = &debug("<DT>", __LINE__);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   776
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   777
		$_ = &debug("<DL>\n<DT>", __LINE__);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   778
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   779
	    if ($tag eq 'deffn' || $tag eq 'defvr' || $tag eq 'deftp') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   780
		$_ .= "<U>$type</U> <B>$name</B>";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   781
		$_ .= " <I>@args</I>" if @args;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   782
	    } elsif ($tag eq 'deftypefn' || $tag eq 'deftypevr'
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   783
		     || $tag eq 'defcv' || $tag eq 'defop') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   784
		$ftype = $name;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   785
		$name = shift(@args);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   786
		$name =~ s/^\{(.*)\}$/$1/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   787
		$_ .= "<U>$type</U> $ftype <B>$name</B>";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   788
		$_ .= " <I>@args</I>" if @args;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   789
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   790
		warn "$ERROR Unknown definition type: $tag\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   791
		$_ .= "<U>$type</U> <B>$name</B>";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   792
		$_ .= " <I>@args</I>" if @args;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   793
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   794
 	    $_ .= &debug("\n<DD>", __LINE__);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   795
	    $name = &unprotect_html($name);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   796
	    if ($tag eq 'deffn' || $tag eq 'deftypefn') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   797
		unshift(@input_spool, "\@findex $name\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   798
	    } elsif ($tag eq 'defop') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   799
		unshift(@input_spool, "\@findex $name on $ftype\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   800
	    } elsif ($tag eq 'defvr' || $tag eq 'deftypevr' || $tag eq 'defcv') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   801
		unshift(@input_spool, "\@vindex $name\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   802
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   803
		unshift(@input_spool, "\@tindex $name\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   804
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   805
	    $dont_html = 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   806
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   807
    } elsif ($end_tag) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   808
	if ($format_map{$end_tag}) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   809
	    $in_pre = 0 if $format_map{$end_tag} eq 'PRE';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   810
	    $in_list-- if $format_map{$end_tag} eq 'UL' || $format_map{$end_tag} eq 'OL' ;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   811
	    &html_pop_if('LI', 'P');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   812
	    &html_pop_if();
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   813
	    push(@lines, &debug("</$format_map{$end_tag}>\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   814
	    push(@lines, &html_debug("\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   815
	} elsif ($end_tag =~ /^(|f|v|multi)table$/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   816
	    unless (@tables) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   817
		warn "$ERROR \@end $end_tag without \@*table\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   818
		next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   819
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   820
	    ($table_type, $in_table) = split($;, shift(@tables));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   821
	    unless ($1 eq $table_type) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   822
		warn "$ERROR \@end $end_tag without matching \@$end_tag\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   823
		next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   824
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   825
	    if ($table_type eq "multi") {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   826
		push(@lines, "</TR></TABLE>\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   827
		&html_pop_if('TR');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   828
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   829
		push(@lines, "</DL>\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   830
		&html_pop_if('DD');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   831
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   832
	    &html_pop_if();
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   833
	    if (@tables) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   834
		($table_type, $in_table) = split($;, $tables[0]);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   835
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   836
		$in_table = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   837
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   838
	} elsif (defined($def_map{$end_tag})) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   839
 	    push(@lines, &debug("</DL>\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   840
	} elsif ($end_tag eq 'menu') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   841
	    &html_pop_if();
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   842
	    push(@lines, $_); # must keep it for pass 2
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   843
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   844
	next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   845
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   846
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   847
    # misc things
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   848
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   849
    # protect texi and HTML things
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   850
    &protect_texi;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   851
    $_ = &protect_html($_) unless $dont_html;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   852
    $dont_html = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   853
    # substitution (unsupported things)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   854
    s/^\@center\s+//g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   855
    s/^\@exdent\s+//g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   856
    s/\@noindent\s+//g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   857
    s/\@refill\s+//g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   858
    # other substitutions
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   859
    &simple_substitutions;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   860
    s/\@value{($VARRE)}/$value{$1}/eg;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   861
    s/\@footnote\{/\@footnote$docu_doc\{/g; # mark footnotes, cf. pass 4
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   862
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   863
    # analyze the tag again
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   864
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   865
    if ($tag) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   866
	if (defined($sec2level{$tag}) && $sec2level{$tag} > 0) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   867
	    if (/^\@$tag\s+(.+)$/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   868
		$name = $1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   869
		$name =~ s/\s+$//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   870
		$level = $sec2level{$tag};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   871
		$name = &update_sec_num($tag, $level) . " $name"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   872
		    if $number_sections && $tag !~ /^unnumbered/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   873
		if ($tag =~ /heading$/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   874
		    push(@lines, &html_debug("\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   875
		    if ($html_element ne 'body') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   876
			# We are in a nice pickle here. We are trying to get a H? heading
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   877
			# even though we are not in the body level. So, we convert it to a
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   878
			# nice, bold, line by itself.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   879
			$_ = &debug("\n\n<P><STRONG>$name</STRONG>\n\n", __LINE__);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   880
		    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   881
			$_ = &debug("<H$level>$name</H$level>\n", __LINE__);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   882
			&html_push_if('body');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   883
		    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   884
		    print "# heading, section $name, level $level\n"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   885
			if $debug & $DEBUG_TOC;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   886
		} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   887
		    if ($split_chapter) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   888
			unless ($toplevel) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   889
			    # first time we see a "section"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   890
			    unless ($level == 1) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   891
				warn "$ERROR The first section found is not of level 1: $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   892
				warn "$ERROR I'll split on sections of level $level...\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   893
			    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   894
			    $toplevel = $level;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   895
			}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   896
			if ($level == $toplevel) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   897
			    &next_doc;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   898
			    push(@lines, $SPLITTAG) if $split_num++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   899
			    push(@sections, $name);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   900
			}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   901
		    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   902
		    $sec_num++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   903
		    $docid = "SEC$sec_num";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   904
		    $tocid = "TOC$sec_num";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   905
		    # check biblio and glossary
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   906
		    $in_bibliography = ($name =~ /^([A-Z]|\d+)?(\.\d+)*\s*bibliography$/i);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   907
		    $in_glossary = ($name =~ /^([A-Z]|\d+)?(\.\d+)*\s*glossary$/i);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   908
		    # check node
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   909
		    if ($node) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   910
			if ($node2sec{$node}) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   911
			    warn "$ERROR Duplicate node found: $node\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   912
			} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   913
			    $node2sec{$node} = $name;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   914
			    $node2href{$node} = "$docu_doc#$docid";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   915
			    print "# node $node, section $name, level $level\n"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   916
				if $debug & $DEBUG_TOC;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   917
			}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   918
			$node = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   919
		    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   920
			print "# no node, section $name, level $level\n"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   921
			    if $debug & $DEBUG_TOC;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   922
		    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   923
		    # update TOC
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   924
		    while ($level > $curlevel) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   925
			$curlevel++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   926
			push(@toc_lines, "<UL>\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   927
		    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   928
		    while ($level < $curlevel) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   929
			$curlevel--;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   930
			push(@toc_lines, "</UL>\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   931
		    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   932
		    $_ = "<LI>" . &anchor($tocid, "$docu_doc#$docid", $name, 1);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   933
		    push(@toc_lines, &substitute_style($_));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   934
		    # update DOC
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   935
		    push(@lines, &html_debug("\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   936
		    &html_reset;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   937
		    $_ =  "<H$level>".&anchor($docid, "$docu_toc#$tocid", $name)."</H$level>\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   938
		    $_ = &debug($_, __LINE__);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   939
		    push(@lines, &html_debug("\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   940
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   941
		# update DOC
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   942
		foreach $line (split(/\n+/, $_)) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   943
		    push(@lines, "$line\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   944
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   945
		next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   946
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   947
		warn "$ERROR Bad section line: $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   948
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   949
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   950
	    # track variables
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   951
	    $value{$1} = $2, next if /^\@set\s+($VARRE)\s+(.*)$/o;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   952
	    delete $value{$1}, next if /^\@clear\s+($VARRE)\s*$/o;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   953
	    # store things
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   954
	    $value{'_setfilename'}   = $1, next if /^\@setfilename\s+(.*)$/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   955
	    $value{'_settitle'}      = $1, next if /^\@settitle\s+(.*)$/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   956
	    $value{'_author'}   .= "$1\n", next if /^\@author\s+(.*)$/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   957
	    $value{'_subtitle'} .= "$1\n", next if /^\@subtitle\s+(.*)$/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   958
	    $value{'_title'}    .= "$1\n", next if /^\@title\s+(.*)$/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   959
	    # index
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   960
	    if (/^\@(..?)index\s+/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   961
		unless ($valid_index{$1}) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   962
		    warn "$ERROR Undefined index command: $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   963
		    next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   964
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   965
		$id = 'IDX' . ++$idx_num;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   966
		$index = $1 . 'index';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   967
		$what = &substitute_style($');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   968
		$what =~ s/\s+$//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   969
		print "# found $index for '$what' id $id\n"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   970
		    if $debug & $DEBUG_INDEX;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   971
		eval(<<EOC);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   972
		if (defined(\$$index\{\$what\})) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   973
		    \$$index\{\$what\} .= "$;$docu_doc#$id";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   974
		} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   975
		    \$$index\{\$what\} = "$docu_doc#$id";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   976
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   977
EOC
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   978
		#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   979
		# dirty hack to see if I can put an invisible anchor...
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   980
		#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   981
		if ($html_element eq 'P' ||
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   982
		    $html_element eq 'LI' ||
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   983
		    $html_element eq 'DT' ||
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   984
		    $html_element eq 'DD' ||
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   985
		    $html_element eq 'ADDRESS' ||
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   986
		    $html_element eq 'B' ||
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   987
		    $html_element eq 'BLOCKQUOTE' ||
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   988
		    $html_element eq 'PRE' ||
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   989
		    $html_element eq 'SAMP') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   990
                    push(@lines, &anchor($id, '', $invisible_mark, !$in_pre));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   991
                } elsif ($html_element eq 'body') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   992
		    push(@lines, &debug("<P>\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   993
                    push(@lines, &anchor($id, '', $invisible_mark, !$in_pre));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   994
		    &html_push('P');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   995
		} elsif ($html_element eq 'DL' ||
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   996
			 $html_element eq 'UL' ||
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   997
			 $html_element eq 'OL' ) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   998
		    $deferred_ref .= &anchor($id, '', $invisible_mark, !$in_pre) . " ";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
   999
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1000
		next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1001
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1002
	    # list item
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1003
	    if (/^\s*\@itemx?\s+/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1004
		$what = $';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1005
		$what =~ s/\s+$//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1006
		if ($in_bibliography && $use_bibliography) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1007
		    if ($what =~ /^$BIBRE$/o) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1008
			$id = 'BIB' . ++$bib_num;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1009
			$bib2href{$what} = "$docu_doc#$id";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1010
			print "# found bibliography for '$what' id $id\n"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1011
			    if $debug & $DEBUG_BIB;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1012
			$what = &anchor($id, '', $what);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1013
		    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1014
		} elsif ($in_glossary && $use_glossary) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1015
		    $id = 'GLOSS' . ++$gloss_num;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1016
		    $entry = $what;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1017
		    $entry =~ tr/A-Z/a-z/ unless $entry =~ /^[A-Z\s]+$/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1018
		    $gloss2href{$entry} = "$docu_doc#$id";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1019
		    print "# found glossary for '$entry' id $id\n"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1020
			if $debug & $DEBUG_GLOSS;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1021
		    $what = &anchor($id, '', $what);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1022
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1023
		&html_pop_if('P');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1024
		if ($html_element eq 'DL' || $html_element eq 'DD') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1025
		    if ($things_map{$in_table} && !$what) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1026
			# special case to allow @table @bullet for instance
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1027
			push(@lines, &debug("<DT>$things_map{$in_table}\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1028
		    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1029
			push(@lines, &debug("<DT>\@$in_table\{$what\}\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1030
		    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1031
		    push(@lines, "<DD>");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1032
		    &html_push('DD') unless $html_element eq 'DD';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1033
		    if ($table_type) { # add also an index
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1034
			unshift(@input_spool, "\@${table_type}index $what\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1035
		    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1036
		} elsif ($html_element eq 'TABLE') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1037
		    push(@lines, &debug("<TR><TD>$what</TD>\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1038
		    &html_push('TR');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1039
		} elsif ($html_element eq 'TR') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1040
		    push(@lines, &debug("</TR>\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1041
		    push(@lines, &debug("<TR><TD>$what</TD>\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1042
		} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1043
		    push(@lines, &debug("<LI>$what\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1044
		    &html_push('LI') unless $html_element eq 'LI';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1045
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1046
		push(@lines, &html_debug("\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1047
		if ($deferred_ref) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1048
		    push(@lines, &debug("$deferred_ref\n", __LINE__));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1049
		    $deferred_ref = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1050
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1051
		next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1052
	    } elsif (/^\@tab\s+(.*)$/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1053
		push(@lines, "<TD>$1</TD>\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1054
		next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1055
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1056
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1057
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1058
    # paragraph separator
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1059
    if ($_ eq "\n") {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1060
	next if $#lines >= 0 && $lines[$#lines] eq "\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1061
	if ($html_element eq 'P') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1062
	    push(@lines, "\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1063
	    $_ = &debug("\n", __LINE__);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1064
	    &html_pop;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1065
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1066
    } elsif ($html_element eq 'body' || $html_element eq 'BLOCKQUOTE') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1067
	push(@lines, "<P>\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1068
	&html_push('P');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1069
	$_ = &debug($_, __LINE__);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1070
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1071
    # otherwise
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1072
    push(@lines, $_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1073
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1074
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1075
# finish TOC
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1076
$level = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1077
while ($level < $curlevel) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1078
    $curlevel--;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1079
    push(@toc_lines, "</UL>\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1080
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1081
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1082
print "# end of pass 1\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1083
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1084
#+++############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1085
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1086
# Pass 2/3: handle style, menu, index, cross-reference                         #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1087
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1088
#---############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1089
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1090
@lines2 = ();				# whole document (2nd pass)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1091
@lines3 = ();				# whole document (3rd pass)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1092
$in_menu = 0;				# am I inside a menu
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1093
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1094
while (@lines) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1095
    $_ = shift(@lines);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1096
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1097
    # special case (protected sections)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1098
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1099
    if (/^$PROTECTTAG/o) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1100
	push(@lines2, $_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1101
	next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1102
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1103
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1104
    # menu
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1105
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1106
    $in_menu = 1, push(@lines2, &debug("<UL>\n", __LINE__)), next if /^\@menu\b/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1107
    $in_menu = 0, push(@lines2, &debug("</UL>\n", __LINE__)), next if /^\@end\s+menu\b/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1108
    if ($in_menu) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1109
	if (/^\*\s+($NODERE)::/o) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1110
	    $descr = $';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1111
	    chop($descr);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1112
	    &menu_entry($1, $1, $descr);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1113
	} elsif (/^\*\s+(.+):\s+([^\t,\.\n]+)[\t,\.\n]/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1114
	    $descr = $';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1115
	    chop($descr);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1116
	    &menu_entry($1, $2, $descr);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1117
	} elsif (/^\*/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1118
	    warn "$ERROR Bad menu line: $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1119
	} else { # description continued?
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1120
	    push(@lines2, $_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1121
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1122
	next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1123
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1124
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1125
    # printindex
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1126
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1127
    if (/^\@printindex\s+(\w\w)\b/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1128
	local($index, *ary, @keys, $key, $letter, $last_letter, @refs);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1129
	if ($predefined_index{$1}) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1130
	    $index = $predefined_index{$1} . 'index';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1131
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1132
	    $index = $1 . 'index';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1133
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1134
	eval("*ary = *$index");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1135
	@keys = keys(%ary);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1136
	foreach $key (@keys) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1137
	    $_ = $key;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1138
	    1 while s/<(\w+)>\`(.*)\'<\/\1>/$2/; # remove HTML tags with quotes
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1139
	    1 while s/<(\w+)>(.*)<\/\1>/$2/;     # remove HTML tags
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1140
	    $_ = &unprotect_html($_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1141
	    &unprotect_texi;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1142
	    tr/A-Z/a-z/; # lowercase
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1143
	    $key2alpha{$key} = $_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1144
	    print "# index $key sorted as $_\n"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1145
		if $key ne $_ && $debug & $DEBUG_INDEX;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1146
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1147
	push(@lines2, "Jump to:\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1148
	$last_letter = undef;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1149
	foreach $key (sort byalpha @keys) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1150
	    $letter = substr($key2alpha{$key}, 0, 1);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1151
	    $letter = substr($key2alpha{$key}, 0, 2) if $letter eq $;;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1152
	    if (!defined($last_letter) || $letter ne $last_letter) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1153
		push(@lines2, "-\n") if defined($last_letter);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1154
		push(@lines2, "<A HREF=\"#$index\_$letter\">" . &protect_html($letter) . "</A>\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1155
		$last_letter = $letter;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1156
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1157
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1158
	push(@lines2, "<P>\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1159
	$last_letter = undef;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1160
	foreach $key (sort byalpha @keys) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1161
	    $letter = substr($key2alpha{$key}, 0, 1);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1162
	    $letter = substr($key2alpha{$key}, 0, 2) if $letter eq $;;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1163
	    if (!defined($last_letter) || $letter ne $last_letter) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1164
		push(@lines2, "</DIR>\n") if defined($last_letter);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1165
		push(@lines2, "<H2><A NAME=\"$index\_$letter\">" . &protect_html($letter) . "</A></H2>\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1166
		push(@lines2, "<DIR>\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1167
		$last_letter = $letter;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1168
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1169
	    @refs = ();
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1170
	    foreach (split(/$;/, $ary{$key})) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1171
		push(@refs, &anchor('', $_, $key, 0));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1172
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1173
	    push(@lines2, "<LI>" . join(", ", @refs) . "\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1174
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1175
	push(@lines2, "</DIR>\n") if defined($last_letter);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1176
	next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1177
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1178
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1179
    # simple style substitutions
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1180
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1181
    $_ = &substitute_style($_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1182
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1183
    # xref
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1184
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1185
    while (/\@(x|px|info|)ref{($XREFRE)(}?)/o) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1186
	# note: Texinfo may accept other characters
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1187
	($type, $nodes, $full) = ($1, $2, $3);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1188
	($before, $after) = ($`, $');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1189
	if (! $full && $after) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1190
	    warn "$ERROR Bad xref (no ending } on line): $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1191
	    $_ = "$before$;0${type}ref\{$nodes$after";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1192
	    next; # while xref
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1193
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1194
	if ($type eq 'x') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1195
	    $type = 'See ';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1196
	} elsif ($type eq 'px') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1197
	    $type = 'see ';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1198
	} elsif ($type eq 'info') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1199
	    $type = 'See Info';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1200
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1201
	    $type = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1202
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1203
	unless ($full) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1204
	    $next = shift(@lines);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1205
	    $next = &substitute_style($next);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1206
	    chop($nodes); # remove final newline
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1207
	    if ($next =~ /\}/) { # split on 2 lines
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1208
		$nodes .= " $`";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1209
		$after = $';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1210
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1211
		$nodes .= " $next";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1212
		$next = shift(@lines);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1213
		$next = &substitute_style($next);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1214
		chop($nodes);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1215
		if ($next =~ /\}/) { # split on 3 lines
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1216
		    $nodes .= " $`";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1217
		    $after = $';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1218
		} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1219
		    warn "$ERROR Bad xref (no ending }): $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1220
		    $_ = "$before$;0xref\{$nodes$after";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1221
		    unshift(@lines, $next);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1222
		    next; # while xref
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1223
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1224
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1225
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1226
	$nodes =~ s/\s+/ /g; # remove useless spaces
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1227
	@args = split(/\s*,\s*/, $nodes);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1228
	$node = $args[0]; # the node is always the first arg
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1229
	&normalise_node($node);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1230
	$sec = $node2sec{$node};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1231
	if (@args == 5) { # reference to another manual
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1232
	    $sec = $args[2] || $node;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1233
	    $man = $args[4] || $args[3];
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1234
	    $_ = "${before}${type}section `$sec' in \@cite{$man}$after";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1235
	} elsif ($type =~ /Info/) { # inforef
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1236
	    warn "$ERROR Wrong number of arguments: $_" unless @args == 3;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1237
	    ($nn, $_, $in) = @args;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1238
	    $_ = "${before}${type} file `$in', node `$nn'$after";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1239
	} elsif ($sec) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1240
	    $href = $node2href{$node};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1241
	    $_ = "${before}${type}section " . &anchor('', $href, $sec) . $after;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1242
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1243
	    warn "$ERROR Undefined node ($node): $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1244
	    $_ = "$before$;0xref{$nodes}$after";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1245
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1246
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1247
    
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1248
    if (/^\@image\s*{/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1249
      s/\@image\s*{//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1250
      my (@args) = split (/,/);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1251
      my $base = $args[0];
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1252
      my $image;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1253
      if (-r "$base.jpg") {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1254
        $image = "$base.jpg";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1255
      } elsif (-r "$base.png") {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1256
        $image = "$base.png";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1257
      } elsif (-r "$base.gif") {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1258
        $image = "$base.gif";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1259
      } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1260
        warn "$ERROR no image file for $base: $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1261
      }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1262
      $_ = "<IMG SRC=\"$image\" ALT=\"$base\">";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1263
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1264
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1265
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1266
    # try to guess bibliography references or glossary terms
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1267
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1268
    unless (/^<H\d><A NAME=\"SEC\d/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1269
	if ($use_bibliography) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1270
	    $done = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1271
	    while (/$BIBRE/o) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1272
		($pre, $what, $post) = ($`, $&, $');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1273
		$href = $bib2href{$what};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1274
		if (defined($href) && $post !~ /^[^<]*<\/A>/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1275
		    $done .= $pre . &anchor('', $href, $what);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1276
		} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1277
		    $done .= "$pre$what";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1278
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1279
		$_ = $post;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1280
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1281
	    $_ = $done . $_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1282
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1283
	if ($use_glossary) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1284
	    $done = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1285
	    while (/\b\w+\b/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1286
		($pre, $what, $post) = ($`, $&, $');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1287
		$entry = $what;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1288
		$entry =~ tr/A-Z/a-z/ unless $entry =~ /^[A-Z\s]+$/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1289
		$href = $gloss2href{$entry};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1290
		if (defined($href) && $post !~ /^[^<]*<\/A>/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1291
		    $done .= $pre . &anchor('', $href, $what);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1292
		} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1293
		    $done .= "$pre$what";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1294
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1295
		$_ = $post;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1296
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1297
	    $_ = $done . $_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1298
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1299
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1300
    # otherwise
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1301
    push(@lines2, $_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1302
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1303
print "# end of pass 2\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1304
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1305
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1306
# split style substitutions
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1307
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1308
while (@lines2) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1309
    $_ = shift(@lines2);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1310
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1311
    # special case (protected sections)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1312
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1313
    if (/^$PROTECTTAG/o) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1314
	push(@lines3, $_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1315
	next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1316
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1317
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1318
    # split style substitutions
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1319
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1320
    $old = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1321
    while ($old ne $_) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1322
        $old = $_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1323
	if (/\@(\w+)\{/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1324
	    ($before, $style, $after) = ($`, $1, $');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1325
	    if (defined($style_map{$style})) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1326
		$_ = $after;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1327
		$text = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1328
		$after = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1329
		$failed = 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1330
		while (@lines2) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1331
		    if (/\}/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1332
			$text .= $`;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1333
			$after = $';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1334
			$failed = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1335
			last;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1336
		    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1337
			$text .= $_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1338
			$_ = shift(@lines2);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1339
		    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1340
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1341
		if ($failed) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1342
		    die "* Bad syntax (\@$style) after: $before\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1343
		} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1344
		    $text = &apply_style($style, $text);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1345
		    $_ = "$before$text$after";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1346
		}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1347
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1348
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1349
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1350
    # otherwise
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1351
    push(@lines3, $_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1352
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1353
print "# end of pass 3\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1354
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1355
#+++############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1356
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1357
# Pass 4: foot notes, final cleanup                                            #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1358
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1359
#---############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1360
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1361
@foot_lines = ();			# footnotes
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1362
@doc_lines = ();			# final document
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1363
$end_of_para = 0;			# true if last line is <P>
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1364
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1365
while (@lines3) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1366
    $_ = shift(@lines3);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1367
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1368
    # special case (protected sections)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1369
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1370
    if (/^$PROTECTTAG/o) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1371
	push(@doc_lines, $_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1372
	$end_of_para = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1373
	next;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1374
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1375
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1376
    # footnotes
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1377
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1378
    while (/\@footnote([^\{\s]+)\{/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1379
	($before, $d, $after) = ($`, $1, $');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1380
	$_ = $after;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1381
	$text = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1382
	$after = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1383
	$failed = 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1384
	while (@lines3) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1385
	    if (/\}/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1386
		$text .= $`;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1387
		$after = $';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1388
		$failed = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1389
		last;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1390
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1391
		$text .= $_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1392
		$_ = shift(@lines3);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1393
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1394
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1395
	if ($failed) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1396
	    die "* Bad syntax (\@footnote) after: $before\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1397
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1398
	    $foot_num++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1399
	    $docid  = "DOCF$foot_num";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1400
	    $footid = "FOOT$foot_num";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1401
	    $foot = "($foot_num)";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1402
	    push(@foot_lines, "<H3>" . &anchor($footid, "$d#$docid", $foot) . "</H3>\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1403
	    $text = "<P>$text" unless $text =~ /^\s*<P>/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1404
	    push(@foot_lines, "$text\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1405
	    $_ = $before . &anchor($docid, "$docu_foot#$footid", $foot) . $after;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1406
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1407
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1408
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1409
    # remove unnecessary <P>
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1410
    #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1411
    if (/^\s*<P>\s*$/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1412
	next if $end_of_para++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1413
    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1414
	$end_of_para = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1415
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1416
    # otherwise
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1417
    push(@doc_lines, $_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1418
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1419
print "# end of pass 4\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1420
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1421
#+++############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1422
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1423
# Pass 5: print things                                                         #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1424
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1425
#---############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1426
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1427
$header = <<EOT;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1428
<!-- Created by $THISPROG from $docu on $TODAY -->
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1429
EOT
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1430
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1431
$full_title = $value{'_title'} || $value{'_settitle'} || "Untitled Document";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1432
$title = $value{'_settitle'} || $full_title;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1433
$_ = &substitute_style($full_title);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1434
&unprotect_texi;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1435
s/\n$//; # rmv last \n (if any)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1436
$full_title = "<H1>" . join("</H1>\n<H1>", split(/\n/, $_)) . "</H1>\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1437
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1438
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1439
# print ToC
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1440
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1441
if (!$monolithic && @toc_lines) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1442
    if (open(FILE, "> $docu_toc")) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1443
	print "# creating $docu_toc...\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1444
	&print_toplevel_header("$title - Table of Contents");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1445
	&print_ruler;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1446
	&print(*toc_lines, FILE);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1447
	&print_toplevel_footer;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1448
	close(FILE);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1449
    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1450
	warn "$ERROR Can't write to $docu_toc: $!\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1451
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1452
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1453
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1454
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1455
# print footnotes
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1456
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1457
if (!$monolithic && @foot_lines) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1458
    if (open(FILE, "> $docu_foot")) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1459
	print "# creating $docu_foot...\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1460
	&print_toplevel_header("$title - Footnotes");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1461
	&print_ruler;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1462
        &print(*foot_lines, FILE);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1463
	&print_toplevel_footer;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1464
	close(FILE);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1465
    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1466
	warn "$ERROR Can't write to $docu_foot: $!\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1467
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1468
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1469
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1470
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1471
# print document
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1472
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1473
if ($split_chapter || $split_node) { # split
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1474
    $doc_num = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1475
    $last_num = scalar(@sections);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1476
    $first_doc = &doc_name(1);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1477
    $last_doc = &doc_name($last_num);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1478
    while (@sections) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1479
	$section = shift(@sections);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1480
	&next_doc;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1481
	if (open(FILE, "> $docu_doc")) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1482
	    print "# creating $docu_doc...\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1483
	    &print_header("$title - $section");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1484
	    $prev_doc = ($doc_num == 1 ? undef : &doc_name($doc_num - 1));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1485
	    $next_doc = ($doc_num == $last_num ? undef : &doc_name($doc_num + 1));
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1486
	    $navigation = "Go to the ";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1487
	    $navigation .= ($prev_doc ? &anchor('', $first_doc, "first") : "first");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1488
	    $navigation .= ", ";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1489
	    $navigation .= ($prev_doc ? &anchor('', $prev_doc, "previous") : "previous");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1490
	    $navigation .= ", ";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1491
	    $navigation .= ($next_doc ? &anchor('', $next_doc, "next") : "next");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1492
	    $navigation .= ", ";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1493
	    $navigation .= ($next_doc ? &anchor('', $last_doc, "last") : "last");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1494
	    $navigation .= " section, " . &anchor('', $docu_toc, "table of contents") . ".\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1495
	    print FILE $navigation;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1496
	    &print_ruler;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1497
	    # find corresponding lines
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1498
            @tmp_lines = ();
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1499
            while (@doc_lines) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1500
		$_ = shift(@doc_lines);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1501
		last if ($_ eq $SPLITTAG);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1502
		push(@tmp_lines, $_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1503
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1504
            &print(*tmp_lines, FILE);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1505
	    &print_ruler;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1506
	    print FILE $navigation;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1507
	    &print_footer;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1508
	    close(FILE);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1509
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1510
	    warn "$ERROR Can't write to $docu_doc: $!\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1511
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1512
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1513
} else { # not split
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1514
    if (open(FILE, "> $docu_doc")) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1515
	print "# creating $docu_doc...\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1516
	if ($monolithic || !@toc_lines) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1517
	    &print_toplevel_header($title);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1518
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1519
	    &print_header($title);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1520
	    print FILE $full_title;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1521
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1522
	if ($monolithic && @toc_lines) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1523
	    &print_ruler;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1524
 	    print FILE "<H1>Table of Contents</H1>\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1525
 	    &print(*toc_lines, FILE);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1526
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1527
	&print_ruler;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1528
        &print(*doc_lines, FILE);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1529
	if ($monolithic && @foot_lines) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1530
	    &print_ruler;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1531
 	    print FILE "<H1>Footnotes</H1>\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1532
 	    &print(*foot_lines, FILE);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1533
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1534
	if ($monolithic || !@toc_lines) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1535
	    &print_toplevel_footer;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1536
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1537
	    &print_footer;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1538
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1539
	close(FILE);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1540
    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1541
	warn "$ERROR Can't write to $docu_doc: $!\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1542
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1543
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1544
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1545
print "# that's all folks\n" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1546
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1547
#+++############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1548
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1549
# Low level functions                                                          #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1550
#                                                                              #
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1551
#---############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1552
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1553
sub update_sec_num {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1554
    local($name, $level) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1555
    my $ret;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1556
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1557
    $level--; # here we start at 0
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1558
    if ($name =~ /^appendix/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1559
	# appendix style
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1560
	if (defined(@appendix_sec_num)) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1561
	    &incr_sec_num($level, @appendix_sec_num);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1562
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1563
	    @appendix_sec_num = ('A', 0, 0, 0);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1564
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1565
	$ret = join('.', @appendix_sec_num[0..$level]);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1566
    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1567
	# normal style
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1568
	if (defined(@normal_sec_num)) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1569
	    &incr_sec_num($level, @normal_sec_num);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1570
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1571
	    @normal_sec_num = (1, 0, 0, 0);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1572
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1573
	$ret = join('.', @normal_sec_num[0..$level]);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1574
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1575
    
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1576
    $ret .= "." if $level == 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1577
    return $ret;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1578
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1579
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1580
sub incr_sec_num {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1581
    local($level, $l);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1582
    $level = shift(@_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1583
    $_[$level]++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1584
    foreach $l ($level+1 .. 3) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1585
	$_[$l] = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1586
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1587
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1588
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1589
sub check {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1590
    local($_, %seen, %context, $before, $match, $after);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1591
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1592
    while (<>) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1593
	if (/\@(\*|\.|\:|\@|\{|\})/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1594
	    $seen{$&}++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1595
	    $context{$&} .= "> $_" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1596
	    $_ = "$`XX$'";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1597
	    redo;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1598
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1599
	if (/\@(\w+)/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1600
	    ($before, $match, $after) = ($`, $&, $');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1601
	    if ($before =~ /\b[\w-]+$/ && $after =~ /^[\w-.]*\b/) { # e-mail address
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1602
		$seen{'e-mail address'}++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1603
		$context{'e-mail address'} .= "> $_" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1604
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1605
		$seen{$match}++;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1606
		$context{$match} .= "> $_" if $verbose;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1607
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1608
	    $match =~ s/^\@/X/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1609
	    $_ = "$before$match$after";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1610
	    redo;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1611
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1612
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1613
    
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1614
    foreach (sort(keys(%seen))) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1615
	if ($verbose) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1616
	    print "$_\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1617
	    print $context{$_};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1618
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1619
	    print "$_ ($seen{$_})\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1620
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1621
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1622
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1623
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1624
sub open {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1625
    local($name) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1626
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1627
    ++$fh_name;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1628
    if (open($fh_name, $name)) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1629
	unshift(@fhs, $fh_name);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1630
    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1631
	warn "$ERROR Can't read file $name: $!\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1632
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1633
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1634
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1635
sub init_input {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1636
    @fhs = ();			# hold the file handles to read
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1637
    @input_spool = ();		# spooled lines to read
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1638
    $fh_name = 'FH000';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1639
    &open($docu);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1640
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1641
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1642
sub next_line {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1643
    local($fh, $line);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1644
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1645
    if (@input_spool) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1646
	$line = shift(@input_spool);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1647
	return($line);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1648
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1649
    while (@fhs) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1650
	$fh = $fhs[0];
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1651
	$line = <$fh>;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1652
	return($line) if $line;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1653
	close($fh);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1654
	shift(@fhs);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1655
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1656
    return(undef);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1657
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1658
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1659
# used in pass 1, use &next_line
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1660
sub skip_until {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1661
    local($tag) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1662
    local($_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1663
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1664
    while ($_ = &next_line) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1665
	return if /^\@end\s+$tag\s*$/;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1666
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1667
    die "* Failed to find '$tag' after: " . $lines[$#lines];
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1668
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1669
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1670
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1671
# HTML stacking to have a better HTML output
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1672
#
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1673
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1674
sub html_reset {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1675
    @html_stack = ('html');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1676
    $html_element = 'body';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1677
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1678
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1679
sub html_push {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1680
    local($what) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1681
    push(@html_stack, $html_element);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1682
    $html_element = $what;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1683
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1684
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1685
sub html_push_if {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1686
    local($what) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1687
    push(@html_stack, $html_element)
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1688
	if ($html_element && $html_element ne 'P');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1689
    $html_element = $what;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1690
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1691
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1692
sub html_pop {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1693
    $html_element = pop(@html_stack);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1694
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1695
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1696
sub html_pop_if {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1697
    local($elt);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1698
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1699
    if (@_) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1700
	foreach $elt (@_) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1701
	    if ($elt eq $html_element) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1702
		$html_element = pop(@html_stack) if @html_stack;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1703
		last;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1704
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1705
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1706
    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1707
	$html_element = pop(@html_stack) if @html_stack;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1708
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1709
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1710
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1711
sub html_debug {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1712
    local($what, $line) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1713
    return("<!-- $line @html_stack, $html_element -->$what")
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1714
	if $debug & $DEBUG_HTML;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1715
    return($what);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1716
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1717
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1718
# to debug the output...
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1719
sub debug {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1720
    local($what, $line) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1721
    return("<!-- $line -->$what")
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1722
	if $debug & $DEBUG_HTML;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1723
    return($what);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1724
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1725
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1726
sub normalise_node {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1727
    $_[0] =~ s/\s+/ /g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1728
    $_[0] =~ s/ $//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1729
    $_[0] =~ s/^ //;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1730
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1731
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1732
sub menu_entry {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1733
    local($entry, $node, $descr) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1734
    local($href);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1735
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1736
    &normalise_node($node);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1737
    $href = $node2href{$node};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1738
    if ($href) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1739
	$descr =~ s/^\s+//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1740
	$descr = ": $descr" if $descr;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1741
	push(@lines2, "<LI>" . &anchor('', $href, $entry) . "$descr\n");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1742
    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1743
	warn "$ERROR Undefined node ($node): $_";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1744
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1745
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1746
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1747
sub do_ctrl { "^$_[0]" }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1748
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1749
sub do_email {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1750
    local($addr, $text) = split(/,\s*/, $_[0]);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1751
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1752
    $text = $addr unless $text;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1753
    &anchor('', "mailto:$addr", $text);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1754
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1755
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1756
sub do_sc { "\U$_[0]\E" }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1757
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1758
sub do_uref {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1759
    local($url, $text) = split(/,\s*/, $_[0]);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1760
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1761
    $text = $url unless $text;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1762
    &anchor('', $url, $text);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1763
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1764
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1765
sub do_url { &anchor('', $_[0], $_[0]) }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1766
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1767
sub apply_style {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1768
    local($texi_style, $text) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1769
    local($style);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1770
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1771
    $style = $style_map{$texi_style};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1772
    if (defined($style)) { # known style
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1773
	if ($style =~ /^\"/) { # add quotes
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1774
	    $style = $';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1775
	    $text = "\`$text\'";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1776
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1777
	if ($style =~ /^\&/) { # custom
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1778
	    $style = $';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1779
	    $text = &$style($text);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1780
	} elsif ($style) { # good style
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1781
	    $text = "<$style>$text</$style>";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1782
	} else { # no style
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1783
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1784
    } else { # unknown style
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1785
	$text = undef;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1786
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1787
    return($text);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1788
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1789
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1790
# remove Texinfo styles
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1791
sub remove_style {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1792
    local($_) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1793
    s/\@\w+{([^\{\}]+)}/$1/g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1794
    return($_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1795
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1796
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1797
sub substitute_style {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1798
    local($_) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1799
    local($changed, $done, $style, $text);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1800
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1801
    $changed = 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1802
    while ($changed) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1803
	$changed = 0;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1804
	$done = '';
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1805
	while (/\@(\w+){([^\{\}]+)}/) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1806
	    $text = &apply_style($1, $2);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1807
	    if ($text) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1808
		$_ = "$`$text$'";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1809
		$changed = 1;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1810
	    } else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1811
		$done .= "$`\@$1";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1812
		$_ = "{$2}$'";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1813
	    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1814
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1815
        $_ = $done . $_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1816
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1817
    return($_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1818
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1819
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1820
sub anchor {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1821
    local($name, $href, $text, $newline) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1822
    local($result);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1823
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1824
    $result = "<A";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1825
    $result .= " NAME=\"$name\"" if $name;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1826
    $result .= " HREF=\"$href\"" if $href;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1827
    $result .= ">$text</A>";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1828
    $result .= "\n" if $newline;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1829
    return($result);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1830
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1831
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1832
sub pretty_date {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1833
    local(@MoY, $sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1834
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1835
    @MoY = ('January', 'February', 'March', 'April', 'May', 'June',
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1836
	    'July', 'August', 'September', 'October', 'November', 'December');
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1837
    ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1838
    $year += ($year < 70) ? 2000 : 1900;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1839
    return("$mday $MoY[$mon] $year");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1840
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1841
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1842
sub doc_name {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1843
    local($num) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1844
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1845
    return("${docu_name}_$num.html");
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1846
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1847
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1848
sub next_doc {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1849
    $docu_doc = &doc_name(++$doc_num);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1850
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1851
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1852
sub print {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1853
    local(*lines, $fh) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1854
    local($_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1855
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1856
    while (@lines) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1857
	$_ = shift(@lines);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1858
	if (/^$PROTECTTAG/o) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1859
	    $_ = $tag2pro{$_};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1860
	} else {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1861
	    &unprotect_texi;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1862
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1863
	print $fh $_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1864
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1865
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1866
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1867
sub print_ruler {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1868
    print FILE "<P><HR><P>\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1869
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1870
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1871
sub print_header {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1872
    local($_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1873
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1874
    # clean the title
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1875
    $_ = &remove_style($_[0]);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1876
    &unprotect_texi;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1877
    # print the header
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1878
    if ($doctype eq 'html2') {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1879
	print FILE $html2_doctype;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1880
    } elsif ($doctype) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1881
	print FILE $doctype;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1882
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1883
    print FILE <<EOT;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1884
<HTML>
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1885
<HEAD>
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1886
$header
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1887
<TITLE>$_</TITLE>
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1888
</HEAD>
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1889
<BODY>
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1890
EOT
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1891
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1892
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1893
sub print_toplevel_header {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1894
    local($_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1895
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1896
    &print_header; # pass given arg...
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1897
    print FILE $full_title;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1898
    if ($value{'_subtitle'}) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1899
	$value{'_subtitle'} =~ s/\n+$//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1900
	foreach (split(/\n/, $value{'_subtitle'})) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1901
	    $_ = &substitute_style($_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1902
	    &unprotect_texi;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1903
	    print FILE "<H2>$_</H2>\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1904
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1905
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1906
    if ($value{'_author'}) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1907
	$value{'_author'} =~ s/\n+$//;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1908
	foreach (split(/\n/, $value{'_author'})) {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1909
	    $_ = &substitute_style($_);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1910
	    &unprotect_texi;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1911
	    s/[\w.-]+\@[\w.-]+/<A HREF="mailto:$&">$&<\/A>/g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1912
	    print FILE "<ADDRESS>$_</ADDRESS>\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1913
	}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1914
    }
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1915
    print FILE "<P>\n";
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1916
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1917
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1918
sub print_footer {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1919
    print FILE <<EOT;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1920
</BODY>
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1921
</HTML>
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1922
EOT
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1923
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1924
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1925
sub print_toplevel_footer {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1926
    &print_ruler;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1927
    print FILE <<EOT;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1928
This document was generated on $TODAY using
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1929
<A HREF=\"$HOMEPAGE\">texi2html</A>&nbsp;$value{texi2html}.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1930
EOT
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1931
    &print_footer;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1932
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1933
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1934
sub protect_texi {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1935
    # protect @ { } ` '
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1936
    s/\@\@/$;0/go;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1937
    s/\@\{/$;1/go;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1938
    s/\@\}/$;2/go;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1939
    s/\@\`/$;3/go;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1940
    s/\@\'/$;4/go;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1941
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1942
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1943
sub protect_html {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1944
    local($what) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1945
    # protect & < >
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1946
    $what =~ s/\&/\&\#38;/g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1947
    $what =~ s/\</\&\#60;/g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1948
    $what =~ s/\>/\&\#62;/g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1949
    # but recognize some HTML things
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1950
    $what =~ s/\&\#60;\/A\&\#62;/<\/A>/g;	      # </A>
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1951
    $what =~ s/\&\#60;A ([^\&]+)\&\#62;/<A $1>/g;     # <A [^&]+>
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1952
    $what =~ s/\&\#60;IMG ([^\&]+)\&\#62;/<IMG $1>/g; # <IMG [^&]+>
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1953
    return($what);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1954
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1955
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1956
sub unprotect_texi {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1957
    s/$;0/\@/go;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1958
    s/$;1/\{/go;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1959
    s/$;2/\}/go;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1960
    s/$;3/\`/go;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1961
    s/$;4/\'/go;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1962
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1963
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1964
sub unprotect_html {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1965
    local($what) = @_;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1966
    $what =~ s/\&\#38;/\&/g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1967
    $what =~ s/\&\#60;/\</g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1968
    $what =~ s/\&\#62;/\>/g;
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1969
    return($what);
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1970
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1971
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1972
sub byalpha {
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1973
    $key2alpha{$a} cmp $key2alpha{$b};
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1974
}
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1975
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1976
##############################################################################
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1977
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1978
	# These next few lines are legal in both Perl and nroff.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1979
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1980
.00 ;			# finish .ig
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1981
 
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1982
'di			\" finish diversion--previous line must be blank
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1983
.nr nl 0-1		\" fake up transition to first page again
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1984
.nr % 0			\" start at page 1
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1985
'; __END__ ############# From here on it's a standard manual page ############
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1986
.TH TEXI2HTML 1 "01/05/98"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1987
.AT 3
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1988
.SH NAME
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1989
texi2html \- a Texinfo to HTML converter
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1990
.SH SYNOPSIS
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1991
.B texi2html [options] file
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1992
.PP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1993
.B texi2html -check [-verbose] files
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1994
.SH DESCRIPTION
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1995
.I Texi2html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1996
converts the given Texinfo file to a set of HTML files. It tries to handle
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1997
most of the Texinfo commands. It creates hypertext links for cross-references,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1998
footnotes...
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  1999
.PP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2000
It also tries to add links from a reference to its corresponding entry in the
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2001
bibliography (if any). It may also handle a glossary (see the
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2002
.B \-glossary
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2003
option).
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2004
.PP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2005
.I Texi2html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2006
creates several files depending on the contents of the Texinfo file and on
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2007
the chosen options (see FILES).
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2008
.PP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2009
The HTML files created by
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2010
.I texi2html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2011
are closer to TeX than to Info, that's why
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2012
.I texi2html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2013
converts @iftex sections and not @ifinfo ones by default. You can reverse
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2014
this with the \-expandinfo option.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2015
.SH OPTIONS
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2016
.TP 12
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2017
.B \-check
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2018
Check the given file and give the list of all things that may be Texinfo commands.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2019
This may be used to check the output of
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2020
.I texi2html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2021
to find the Texinfo commands that have been left in the HTML file.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2022
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2023
.B \-expandinfo
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2024
Expand @ifinfo sections, not @iftex ones.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2025
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2026
.B \-glossary
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2027
Use the section named 'Glossary' to build a list of terms and put links in the HTML
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2028
document from each term toward its definition.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2029
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2030
.B \-invisible \fIname\fP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2031
Use \fIname\fP to create invisible destination anchors for index links
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2032
(you can for instance use the invisible.xbm file shipped with this program).
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2033
This is a workaround for a known bug of many WWW browsers, including netscape.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2034
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2035
.B \-I \fIdir\fP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2036
Look also in \fIdir\fP to find included files.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2037
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2038
.B \-menu
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2039
Show the Texinfo menus; by default they are ignored.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2040
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2041
.B \-monolithic
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2042
Output only one file, including the table of contents and footnotes.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2043
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2044
.B \-number
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2045
Number the sections.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2046
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2047
.B \-split_chapter
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2048
Split the output into several HTML files (one per main section:
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2049
chapter, appendix...).
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2050
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2051
.B \-split_node
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2052
Split the output into several HTML files (one per node).
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2053
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2054
.B \-usage
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2055
Print usage instructions, listing the current available command-line options.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2056
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2057
.B \-verbose
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2058
Give a verbose output. Can be used with the
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2059
.B \-check
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2060
option.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2061
.PP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2062
.SH FILES
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2063
By default
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2064
.I texi2html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2065
creates the following files (foo being the name of the Texinfo file):
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2066
.TP 16
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2067
.B foo_toc.html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2068
The table of contents.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2069
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2070
.B foo.html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2071
The document's contents.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2072
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2073
.B foo_foot.html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2074
The footnotes (if any).
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2075
.PP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2076
When used with the
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2077
.B \-split
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2078
option, it creates several files (one per chapter or node), named
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2079
.B foo_n.html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2080
(n being the indice of the chapter or node), instead of the single
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2081
.B foo.html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2082
file.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2083
.PP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2084
When used with the
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2085
.B \-monolithic
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2086
option, it creates only one file:
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2087
.B foo.html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2088
.SH VARIABLES
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2089
.I texi2html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2090
predefines the following variables: \fBhtml\fP, \fBtexi2html\fP.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2091
.SH ADDITIONAL COMMANDS
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2092
.I texi2html
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2093
implements the following non-Texinfo commands (maybe they are in Texinfo now...):
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2094
.TP 16
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2095
.B @ifhtml
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2096
This indicates the start of an HTML section, this section will passed through
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2097
without any modification.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2098
.TP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2099
.B @end ifhtml
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2100
This indicates the end of an HTML section.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2101
.SH VERSION
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2102
This is \fItexi2html\fP version 1.56k, 1999-02-20.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2103
.PP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2104
The latest version of \fItexi2html\fP can be found in WWW, cf. URLs
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2105
http://wwwinfo.cern.ch/dis/texi2html/
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2106
.br
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2107
http://texinfo.org/texi2html/
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2108
.SH AUTHOR
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2109
The main author is Lionel Cons, CERN IT/DIS/OSE, [email protected].
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2110
Many other people around the net contributed to this program.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2111
.SH COPYRIGHT
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2112
This program is the intellectual property of the European
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2113
Laboratory for Particle Physics (known as CERN). No guarantee whatsoever is
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2114
provided by CERN. No liability whatsoever is accepted for any loss or damage
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2115
of any kind resulting from any defect or inaccuracy in this information or
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2116
code.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2117
.PP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2118
CERN, 1211 Geneva 23, Switzerland
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2119
.SH "SEE ALSO"
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2120
GNU Texinfo Documentation Format,
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2121
HyperText Markup Language (HTML),
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2122
World Wide Web (WWW).
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2123
.SH BUGS
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2124
This program does not understand all Texinfo commands (yet).
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2125
.PP
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2126
TeX specific commands (normally enclosed in @iftex) will be
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2127
passed unmodified.
95421649b836 7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff changeset
  2128
.ex