1HXNORMALIZE(1) HTML-XML-utils HXNORMALIZE(1)
2
3
4
6 hxnormalize - pretty-print an HTML file
7
9 hxnormalize [ -x ] [ -e ] [ -d ] [ -s ] [ -i indent ] [ -l line-length
10 ] [ -c commentmagic ] [ file ]
11
13 The hxnormalize command pretty-prints an HTML file, and also tries to
14 fix small errors. The output is the same HTML, but with a maximum line
15 length and with optional indentation to indicate the nesting level of
16 each line.
17
19 The following options are supported:
20
21 -x Use XML conventions: empty elements are written with a slash
22 at the end: <IMG />. Implies -e.
23
24 -e Always insert endtags, even if HTML does not require them
25 (for example: </p> and </li>).
26
27 -d Omit the DOCTYPE from the output.
28
29 -i indent Set the number of spaces to indent each nesting level.
30 Default is 2. Not all elements cause an indent. In general,
31 elements that can occur in a block environment are started on
32 a new line and cause an indent, but inline elements, such as
33 EM and SPAN do not cause an indent.
34
35 -l line-length
36 Sets the maximum length of lines. hxnormalize will wrap
37 lines so that all lines are as long as possible, but no
38 longer than this length. Default is 72. Words that are longer
39 than the line length will not be broken, and will extend past
40 this length. A
41
42 content of the STYLE, SCRIPT and PRE elements will not be
43 line-wrapped.
44
45 -s Omit <span> tags that don't have any attributes.
46
47 -c commentmagic
48 Comments are normally placed right after the preceding text.
49 That is usually correct for short comments, but some comments
50 are meant to be on a separate line. commentmagic is a string
51 and when that string occurs inside a comment, hxnormalize
52 will output an empty line before that comment. E.g. -c "===="
53 can be used to put all comments that contain "====" on a sep‐
54 arate line, preceded by an empty line. By default, no com‐
55 ments are treated that way.
56
58 The following operand is supported:
59
60 file The name of an HTML file. If absent, standard input is read
61 instead.
62
64 The following exit values are returned:
65
66 0 Successful completion.
67
68 > 0 An error occurred in the parsing of the HTML file. hxnormal‐
69 ize will try to correct the error and produce output anyway.
70
72 asc2xml(1), xml2asc(1), UTF-8 (RFC 2279)
73
75 The error recovery for incorrect HTML is primitive.
76
77 hxnormalize will not omit an endtag if the white space after it could
78 possibly be significant. E.g., it will not remove the first </p> from
79 "<div><p>text</p> <p>text</p></div>".
80
81
82
835.x 21 Nov 2008 HXNORMALIZE(1)