author | Norm Jacobs <Norm.Jacobs@Oracle.COM> |
Wed, 11 May 2011 16:27:33 -0700 | |
changeset 233 | 95421649b836 |
permissions | -rw-r--r-- |
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 |
"-", "­", # 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 |
✓ |
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'} = "•"; |
95421649b836
7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
439 |
$things_map{'copyright'} = "©"; |
95421649b836
7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
440 |
$things_map{'dots'} = "…"; |
95421649b836
7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
441 |
$things_map{'equiv'} = "≡"; |
95421649b836
7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
442 |
$things_map{'expansion'} = "→"; |
95421649b836
7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
443 |
$things_map{'point'} = "∗"; |
95421649b836
7017805 texinfo should move to userland (add texi2html)
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
444 |
$things_map{'result'} = "⇒"; |
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 J |