File: hxincl.1

package info (click to toggle)
html-xml-utils 7.7-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye, forky, sid, trixie
  • size: 2,488 kB
  • sloc: ansic: 11,213; sh: 7,996; lex: 243; makefile: 193; yacc: 125
file content (193 lines) | stat: -rwxr-xr-x 4,303 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
.de d \" begin display
.sp
.in +4
.nf
..
.de e \" end display
.in -4
.fi
.sp
..
.TH "HXINCL" "1" "10 Jul 2011" "7.x" "HTML-XML-utils"
.SH NAME
hxincl \- expand included HTML or XML files
.SH SYNOPSIS
.B hxincl
.RB "[\| " \-x " \|]"
.RB "[\| " \-f " \|]"
.RB "[\| " \-s
.IR name=subst " \|]"
.RB "[\| " \-s
.IR name=subst " \|]..."
.RB "[\| " \-b
.IR base " \|]"
.RI "[\| " file\-or\-URL " \|]"
.LP
.B hxincl
.B \-M
.I target
.RB "[\| " \-s
.IR name=subst " \|]"
.RB "[\| " \-s
.IR name=subst " \|]..."
.RB "[\| " \-b
.IR base " \|]"
.RB "[\| " \-G " \|]"
.RI "[\| " file\-or\-URL " \|]"
.SH DESCRIPTION
.LP
Without
.BR \-M ,
the
.B hxincl
command copies an HTML or XML file to standard output, looking for
comments with a certain structure.  Such a comment is replaced by
the file whose name is given as the attribute of the directive. For
example:
.d
\&...<!-- include "foo.html" -->...
.e
will be replaced by the content of the file \fIfoo.html\fP.
.LP
The comment is replaced by
.d
<!-- begin-include "foo.html" -->
.e
before the included text and
.d
<!-- end-include "foo.html" -->
.e
after it. These comments make it possible to run
.B hxincl
on the resulting file again to update the inclusions.
.PP
Single quotes are allowed instead of double quotes. And if the file
name contains no spaces, the quotes may also be omitted.
.PP
With
.BR \-M ,
the
.B hxincl
command outputs a line of dependencies that is suitable for inclusion
in a Makefile. The
.I target
is the target of the Makefile rule and
.B hxincl
will list after the ':' all the files that are included,
recursively. E.g., the result of
.d
hxincl -M myfile.html inputfile
.e
might be
.d
myfile.html: foo.html bar.html
.e
.SH OPTIONS
The following options are supported:
.TP 10
.B \-x
Use XML conventions: empty elements are written with a slash at the
end: <IMG\ />.
.TP
.BI \-b " base"
Sets the base URL for resolving relative URLs. By default the file
given as argument is the base URL.
.TP
.B \-f
Removes the comments after including the files. This means
.B hxincl
cannot be run on the resulting file later to update the inclusions.
(Mnemonic:
.BR f inal
or
.BR f rozen.)
.TP
.BI \-s " name=substitution"
Include a different file than the one mentioned in the directive. If
the comment is
.d
<!-- include "name" -->
.e
the file
.I substitution
is included instead. And if the file name in the comment includes a
variable called
.I name
delimited by %, e.g.,
.d
<!-- include "xxx-%name%" -->
.e
then
.RI % name %
is replaced by
.I substitution
and thus the file
.RI xxx\- substitution
is included. The option
.B \-s
may occur multiple times. %-delimited variables are expanded
recursively, i.e., if the substitution text contains a variable, that
variable is expanded, too. E.g., if the two options
.B \-s name=%p1%.rrr
and
.B \-s p1=subst
are given, then the "xxx-%name%" will expand to "xxx-subst.rrr".
.TP
.BI \-M " target"
Instead of outputting the input file with all inclusions expanded,
output just the list of all files that the input includes,
recursively, in the form of a rule that is suitable for a
Makefile. The
.I target
is printed as the target of that rule.
.TP
.B \-G
Suppress error messages if a file to include cannot be found. (Only
with
.BR \-M .)
.SH OPERANDS
The following operand is supported:
.TP 10
.I file\-or\-URL
The name of an HTML or XML file or the URL of one. If absent, standard
input is read instead.
.SH "EXIT STATUS"
The following exit values are returned:
.TP 10
.B 0
Successful completion.
.TP
.B > 0
An error occurred in the parsing of one of the HTML or XML files.
.SH ENVIRONMENT
To use a proxy to retrieve remote files, set the environment variables
.B http_proxy
or
.BR ftp_proxy "."
E.g.,
.B http_proxy="http://localhost:8080/"
.SH BUGS
.LP
Assumes UTF-8 as input. Doesn't expand character entities. Instead
pipe the input through
.BR hxunent (1)
and
.BR asc2xml (1)
to convert it to UTF-8.
.LP
Remote files (specified with a URL) are currently only supported for
HTTP. Password-protected files or files that depend on HTTP "cookies"
are not handled. (You can use tools such as
.BR curl (1)
or
.BR wget (1)
to retrieve such files.)
.SH "SEE ALSO"
.BR asc2xml (1),
.BR hxnormalize (1),
.BR hxnum (1),
.BR hxprune (1),
.BR hxtoc (1),
.BR hxunent (1),
.BR xml2asc (1),
.BR UTF-8 " (RFC 2279)"