1HTML2WIKI(1) User Contributed Perl Documentation HTML2WIKI(1)
2
3
4
6 html2wiki - convert HTML into wiki markup
7
9 html2wiki [options] [file]
10
11 Commonly used options:
12
13 --dialect=dialect Dialect name, e.g. "MediaWiki" (required unless
14 the WCDIALECT environment variable is used)
15 --encoding=encoding Source encoding (default is 'utf-8')
16 --base-uri=uri Base URI for relative links
17 --wiki-uri=uri URI fragment for wiki links
18 --wrap-in-html Wrap input in <html> and </html> (enabled by default).
19 Use --no-wrap-in-html to disable.
20 --escape-entities Escape HTML entities within text elements (enabled by
21 default). Use --no-escape-entities to disable.
22
23 --list List installed dialects and exit
24 --options List all recognized options (except for negations
25 such as --no-wrap-in-html)
26 --help Show this message and exit
27
28 Additional options, including those corresponding to dialect
29 attributes, are also supported. Consult the html2wiki man page for
30 details.
31
32 Example:
33
34 html2wiki --dialect MediaWiki --encoding iso-8859-1 \
35 --base-uri http://en.wikipedia.org/wiki/ \
36 --wiki-uri http://en.wikipedia.org/wiki/ \
37 input.html > output.wiki
38
40 "html2wiki" is a command-line interface to HTML::WikiConverter, which
41 it uses to convert HTML to wiki markup.
42
44 If the dialect you provide in "--dialect" is not installed on your
45 system (e.g. if you specify "MediaWiki" but have not installed its
46 dialect module, HTML::WikiConverter::MediaWiki) a fatal error will be
47 issued. Use "html2wiki --list" to list all available dialects on your
48 system. Additional dialects may be downloaded from the CPAN.
49
51 Correspondence of options and attributes
52 Each of the options accepted by "html2wiki" corresponds to an
53 HTML::WikiConverter attribute. Commonly used options described in
54 "html2wiki --help" therefore correspond to attributes discussed in
55 "ATTRIBUTES" in HTML::WikiConverter. That section also contains other
56 attributes that may be used as "html2wiki" command-line options.
57
58 Mapping an attribute name to an option name
59 While related, option names are not identical to their corresponding
60 attribute names. The only difference is that attribute names use
61 underscores to separate words while option names use hyphens. For
62 example, the "base_uri" attribute corresponds to the "--base-uri"
63 command-line option.
64
65 Additional options defined in dialect modules
66 Individual dialects may define their own attributes, and therefore make
67 available their own command-line options to "html2wiki", in addition to
68 the ones defined by "HTML::WikiConverter". The same rules described
69 above apply for converting between these attribute names and their
70 corresponding command-line option names. For example, Markdown supports
71 an "unordered_list_style" attribute that takes a string value. To use
72 this attribute on the command line, one would use the
73 "--unordered-list-style" option. Consult individual dialect man pages
74 for a list of supported attributes.
75
76 Options that are enabled by default
77 Attributes that take boolean values may be enabled by default. The
78 "wrap_in_html" attribute is one such example. Because of this,
79 "html2wiki" will effectively behave by default as if "--wrap-in-html"
80 had been specified in every invokation. If this is not desired, the
81 option name may be prefixed with "no-" to disable the option, as in
82 "--no-wrap-in-html".
83
84 Options that take multiple values
85 Some attributes (eg, "wiki_uri" and "strip_tags") accept an array of
86 values. To accommodate this in "html2wiki", such options can be
87 specified more than once on the command line. For example, to specify
88 that only comment and script elements should be stripped from HTML:
89
90 % html2wiki --strip-tags ~comment --strip-tags script ...
91
93 Input is taken from STDIN, so you may pipe the output from another
94 program into "html2wiki". For example:
95
96 curl http://example.com/input.html | html2wiki --dialect MediaWiki
97
98 You may also specify a file to read HTML from:
99
100 html2wiki --dialect MediaWiki input.html
101
102 Output is sent to STDOUT, though you may redirect it on the command
103 line:
104
105 html2wiki --dialect MediaWiki input.html > output.wiki
106
107 Or you may pipe it into another program:
108
109 html2wiki --dialect MediaWiki input.html | less
110
112 David J. Iberri, "<diberri@cpan.org>"
113
115 Copyright 2006 David J. Iberri, all rights reserved.
116
117 This program is free software; you can redistribute it and/or modify it
118 under the same terms as Perl itself.
119
121 HTML::WikiConverter
122
123
124
125perl v5.38.0 2023-07-20 HTML2WIKI(1)