.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32 .\" .\" Standard preamble: .\" ======================================================================== .de Sh \" Subsection heading .br .if t .Sp .ne 5 .PP \fB\\$1\fR .PP .. .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' 'br\} .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . nr % 0 . rr F .\} .\" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .hy 0 .if n .na .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "TXT2HTML 1p" .TH TXT2HTML 1p "2008-05-04" "perl v5.8.8" "User Contributed Perl Documentation" .SH "NAME" txt2html \- convert plain text file to HTML. .SH "VERSION" .IX Header "VERSION" This describes version \fB2.51\fR of txt2html. .SH "SYNOPSIS" .IX Header "SYNOPSIS" txt2html \-\-help | \-\-manpage .PP txt2html [ \-\-append_file \fIfilename\fR ] [ \-\-append_head \fIfilename\fR ] [ \-\-body_deco \fIstring\fR ] [ \-\-bold_delimiter \fIstring\fR ] [ \-\-bullets \fIstring\fR ] [ \-\-bullets_ordered \fIstring\fR ] [ \-\-caps_tag \fItag\fR ] { \-\-custom_heading_regexp \fIregexp\fR } [ \-\-debug ] [ \-\-demoronize ] [ \-\-default_link_dict \fIfilename\fR ] [ \-\-dict_debug \fIn\fR ] [ \-\-doctype \fIdoctype\fR ] [ \-\-eight_bit_clean ] [ \-\-escape_HTML_chars ] [ \-\-explicit_headings ] [ \-\-extract ] [ \-\-hrule_min \fIn\fR ] [ \-\-indent_width \fIn\fR ] [ \-\-indent_par_break ] { \-\-infile \fIfilename\fR | \-\-instring \fIstring\fR } [ \-\-italic_delimiter \fIstring\fR ] { \-\-links_dictionaries \fIfilename\fR } [ \-\-link_only ] [ \-\-lower_case_tags ] [ \-\-mailmode ] [ \-\-make_anchors ] [ \-\-make_tables ] [ \-\-min_caps_length \fIn\fR ] [ \-\-outfile \fIfilename\fR ] [ \-\-par_indent \fIn\fR ] [ \-\-preformat_trigger_lines \fIn\fR ] [ \-\-endpreformat_trigger_lines \fIn\fR ] [ \-\-preformat_start_marker \fIregexp\fR ] [ \-\-preformat_end_marker \fIregexp\fR ] [ \-\-preformat_whitespace_min \fIn\fR ] [ \-\-prepend_file \fIfilename\fR ] [ \-\-preserve_indent ] [ \-\-short_line_length \fIn\fR ] [ \-\-style_url \fIstylesheet_url\fR ] [ \-\-tab_width \fIn\fR ] [ \-\-table_type \fItype\fR=0/1 ] [ \-\-title \fItitle\fR ] [ \-\-titlefirst ] [ \-\-underline_delimiter \fIstring\fR ] [ \-\-underline_length_tolerance \fIn\fR ] [ \-\-underline_offset_tolerance \fIn\fR ] [ \-\-unhyphenation ] [ \-\-use_mosaic_header ] [ \-\-use_preformat_marker ] [ \-\-xhtml ] [file ...] .SH "DESCRIPTION" .IX Header "DESCRIPTION" txt2html converts plain text files to \s-1HTML\s0. .PP It supports headings, tables, lists, simple character markup, and hyperlinking, and is highly customizable. It recognizes some of the apparent structure of the source document (mostly whitespace and typographic layout), and attempts to mark that structure explicitly using \s-1HTML\s0. The purpose for this tool is to provide an easier way of converting existing text documents to \s-1HTML\s0 format. .PP One can use txt2html as a filter, outputting the result to \s-1STDOUT\s0, or to a given file. .PP One can define options in a config file as well as on the command\-line. .SH "OPTIONS" .IX Header "OPTIONS" Option names can be abbreviated to the shortest unique name for that option. Options can start with \*(L"\-\-\*(R" or \*(L"\-\*(R". Boolean options can be negated by preceding them with \*(L"no\*(R"; options with hash or array values can be added to by giving the option again for each value. .PP See Getopt::Long for more information. .PP If the Getopt::ArgvFile module is installed, then groups of options can be read from a file or files designated by the @ character preceding the name. For example: .PP .Vb 1 \& txt2html @poem_options \-\-outfile poem_glory.html poem_glory.txt .Ve .PP See \*(L"Options Files\*(R" for more information. .PP Help options: .IP "\-\-help" 4 .IX Item "--help" Display short help and exit. .IP "\-\-manpage" 4 .IX Item "--manpage" Display full documentation and exit. This requires perldoc to be installed. .PP General options: .IP "\-\-append_file \fIfilename\fR | \-\-append \fIfilename\fR | \-\-append_body \fIfilename\fR" 4 .IX Item "--append_file filename | --append filename | --append_body filename" If you want something appended by default, put the filename here. The appended text will not be processed at all, so make sure it's plain text or decent \s-1HTML\s0. i.e. do not have things like: Mary Andersen but instead, have: Mary Andersen <kitty@example.com> .Sp (default: nothing) .IP "\-\-append_head \fIfilename\fR | \-ah \fIfilename\fR" 4 .IX Item "--append_head filename | -ah filename" If you want something appended to the head by default, put the filename here. The appended text will not be processed at all, so make sure it's plain text or decent \s-1HTML\s0. i.e. do not have things like: Mary Andersen but instead, have: Mary Andersen <kitty@example.com> .Sp (default: nothing) .IP "\-\-body_deco \fIstring\fR" 4 .IX Item "--body_deco string" Body decoration string: a string to be added to the \s-1BODY\s0 tag so that one can set attributes to the \s-1BODY\s0 (such as class, style, bgcolor etc) For example, \*(L"class='withimage'\*(R". .IP "\-\-bold_delimiter \fIstring\fR" 4 .IX Item "--bold_delimiter string" This defines what character (or string) is taken to be the delimiter of text which is to be interpreted as bold (that is, to be given a \s-1STRONG\s0 tag). If this is empty, then no bolding of text will be done. (default: #) .IP "\-\-bullets \fIstring\fR" 4 .IX Item "--bullets string" This defines what single characters are taken to be \*(L"bullet\*(R" characters for unordered lists. Note that because this is used as a character class, if you use '\-' it must come first. (default:\-=o*\e267) .IP "\-\-bullets_ordered \fIstring\fR" 4 .IX Item "--bullets_ordered string" This defines what single characters are taken to be \*(L"bullet\*(R" placeholder characters for ordered lists. Ordered lists are normally marked by a number or letter followed by '.' or ')' or ']' or ':'. If an ordered bullet is used, then it simply indicates that this is an ordered list, without giving explicit numbers. .Sp Note that because this is used as a character class, if you use '\-' it must come first. (default:nothing) .IP "\-\-caps_tag \fItag\fR | \-\-capstag \fItag\fR | \-ct \fItag\fR" 4 .IX Item "--caps_tag tag | --capstag tag | -ct tag" Tag to put around all-caps lines (default: \s-1STRONG\s0) If an empty tag is given, then no tag will be put around all-caps lines. .IP "\-\-custom_heading_regexp \fIregexp\fR | \-\-heading \fIregexp\fR | \-H \fIregexp\fR" 4 .IX Item "--custom_heading_regexp regexp | --heading regexp | -H regexp" Add a regexp for headings. Header levels are assigned by regexp in order seen When a line matches a custom header regexp, it is tagged as a header. If it's the first time that particular regexp has matched, the next available header level is associated with it and applied to the line. Any later matches of that regexp will use the same header level. Therefore, if you want to match numbered header lines, you could use something like this: .Sp .Vb 1 \& \-H \(aq^ *\ed+\e. \ew+\(aq \-H \(aq^ *\ed+\e.\ed+\e. \ew+\(aq \-H \(aq^ *\ed+\e.\ed+\e.\ed+\e. \ew+\(aq .Ve .Sp Then lines like .Sp .Vb 3 \& " 1. Examples " \& " 1.1. Things" \& and " 4.2.5. Cold Fusion" .Ve .Sp Would be marked as H1, H2, and H3 (assuming they were found in that order, and that no other header styles were encountered). If you prefer that the first one specified always be H1, the second always be H2, the third H3, etc, then use the \-EH/\-\-explicit\-headings option. .Sp This is a multi-valued option. .Sp (default: none) .IP "\-\-debug" 4 .IX Item "--debug" Enable copious script debugging output (don't bother, this is for the developer) .IP "\-\-default_link_dict \fIfilename\fR" 4 .IX Item "--default_link_dict filename" The name of the default \*(L"user\*(R" link dictionary. (default: \*(L"$ENV{'\s-1HOME\s0'}/.txt2html.dict\*(R") .IP "\-\-demoronize" 4 .IX Item "--demoronize" Convert Microsoft-generated character codes that are non-ISO codes into something more reasonable. (default:true) .IP "\-\-dict_debug \fIn\fR | \-db \fIn\fR" 4 .IX Item "--dict_debug n | -db n" Debug mode for link dictionaries Bitwise-Or what you want to see: 1: The parsing of the dictionary 2: The code that will make the links 4: When each rule matches something 8: When each tag is created .Sp (default: 0) .IP "\-\-doctype \fIdoctype\fR | \-\-dt \fIdoctype\fR" 4 .IX Item "--doctype doctype | --dt doctype" This gets put in the \s-1DOCTYPE\s0 field at the top of the document, unless it's empty. .Sp Default : \&'\-//W3C//DTD \s-1HTML\s0 4.01//EN\*(L" \&\*(R"http://www.w3.org/TR/html4/strict.dtd' .Sp If \-\-xhtml is true, the contents of this is ignored, unless it's empty, in which case no \s-1DOCTYPE\s0 declaration is output. .IP "\-\-eight_bit_clean | \-8" 4 .IX Item "--eight_bit_clean | -8" If false, convert Latin\-1 characters to \s-1HTML\s0 entities. If true, this conversion is disabled. (default: false) .IP "\-\-escape_HTML_chars | \-\-escapechars | \-ec" 4 .IX Item "--escape_HTML_chars | --escapechars | -ec" turn & < > into & > < (default: true) .IP "\-\-explicit_headings | \-EH" 4 .IX Item "--explicit_headings | -EH" Don't try to find any headings except the ones specified in the \&\-\-custom_heading_regexp option. Also, the custom headings will not be assigned levels in the order they are encountered in the document, but in the order they are specified on the command line. (default: false) .IP "\-\-extract" 4 .IX Item "--extract" Extract Mode; don't put \s-1HTML\s0 headers or footers on the result, just the plain \s-1HTML\s0 (thus making the result suitable for inserting into another document (or as part of the output of a \s-1CGI\s0 script). (default: false) .IP "\-\-hrule_min \fIn\fR | \-\-hrule \fIn\fR | \-r \fIn\fR" 4 .IX Item "--hrule_min n | --hrule n | -r n" Min number of \-\-\-s for an HRule. (default: 4) .IP "\-\-indent_width \fIn\fR | \-\-indent \fIn\fR | \-iw \fIn\fR" 4 .IX Item "--indent_width n | --indent n | -iw n" Indents this many spaces for each level of a list. (default: 2) .IP "\-\-indent_par_break | \-ipb" 4 .IX Item "--indent_par_break | -ipb" Treat paragraphs marked solely by indents as breaks with indents. That is, instead of taking a three-space indent as a new paragraph, put in a <\s-1BR\s0> and three non-breaking spaces instead. (see also \-\-preserve_indent) (default: false) .IP "\-\-infile \fIfilename\fR" 4 .IX Item "--infile filename" The name of the input file. This is a cumulative list argument. If you want to process more than one file, just add another \-\-infile \fIfile\fR to the list of arguments. Or else just add the filename without the option, after all the options. Note that the special file name of '\-' means standard input. .Sp (default:\-) .IP "\-\-instring \fIstring\fR" 4 .IX Item "--instring string" An input string. One can either have input files or input strings, not both. If you want to process more than one string, just add another \-\-instring \fIstring\fR to the list of arguments. .IP "\-\-italic_delimiter \fIstring\fR" 4 .IX Item "--italic_delimiter string" This defines what character (or string) is taken to be the delimiter of text which is to be interpreted as italic (that is, to be given a \s-1EM\s0 tag). If this is empty, no italicising of text will be done. (default: *) .IP "\-\-links_dictionaries \fIfilename\fR | \-\-link \fIfilename\fR | \-l \fIfilename\fR" 4 .IX Item "--links_dictionaries filename | --link filename | -l filename" File to use as a link\-dictionary. There can be more than one of these. These are in addition to the System Link Dictionary and the User Link Dictionary. .IP "\-\-link_only | \-\-linkonly | \-LO" 4 .IX Item "--link_only | --linkonly | -LO" Do no escaping or marking up at all, except for processing the links dictionary file and applying it. This is useful if you want to use the linking feature on an \s-1HTML\s0 document. If the \s-1HTML\s0 is a complete document (includes \s-1HTML\s0,HEAD,BODY tags, etc) then you'll probably want to use the \-\-extract option also. (default: false) .IP "\-\-lower_case_tags" 4 .IX Item "--lower_case_tags" Force all the tags to be in lower\-case. .IP "\-\-mailmode | \-m" 4 .IX Item "--mailmode | -m" Deal with mail headers & quoted text. The mail header paragraph is given the class 'mail_header', and mail-quoted text is given the class \&'quote_mail'. (default: false) .IP "\-\-make_anchors | \-\-anchors" 4 .IX Item "--make_anchors | --anchors" Should we try to make anchors in headings? (default: true) .IP "\-\-make_links" 4 .IX Item "--make_links" Should we try to build links? If this is false, then the links dictionaries are not consulted and only structural text-to-HTML conversion is done. (default: true) .IP "\-\-make_tables | \-\-tables" 4 .IX Item "--make_tables | --tables" Should we try to build tables? If true, spots tables and marks them up appropriately. See \*(L"Input File Format\*(R" for information on how tables should be formatted. .Sp This overrides the detection of lists; if something looks like a table, it is taken as a table, and list-checking is not done for that paragraph. .Sp (default: false) .IP "\-\-min_caps_length \fIn\fR | \-\-caps \fIn\fR | \-c \fIn\fR" 4 .IX Item "--min_caps_length n | --caps n | -c n" min sequential \s-1CAPS\s0 for an all-caps line (default: 3) .IP "\-\-outfile \fIfilename\fR" 4 .IX Item "--outfile filename" The name of the output file. If it is \*(L"\-\*(R" then the output goes to Standard Output. (default: \- ) .IP "\-\-par_indent \fIn\fR" 4 .IX Item "--par_indent n" Minumum number of spaces indented in first lines of paragraphs. Only used when there's no blank line preceding the new paragraph. (default: 2) .IP "\-\-preformat_trigger_lines \fIn\fR | \-\-prebegin \fIn\fR | \-pb \fIn\fR" 4 .IX Item "--preformat_trigger_lines n | --prebegin n | -pb n" How many lines of preformatted-looking text are needed to switch to <\s-1PRE\s0> <= 0 : Preformat entire document 1 : one line triggers >= 2 : two lines trigger .Sp (default: 2) .IP "\-\-endpreformat_trigger_lines \fIn\fR | \-\-preend \fIn\fR | \-pe \fIn\fR" 4 .IX Item "--endpreformat_trigger_lines n | --preend n | -pe n" How many lines of unpreformatted-looking text are needed to switch from <\s-1PRE\s0> <= 0 : Never preformat within document 1 : one line triggers >= 2 : two lines trigger (default: 2) .Sp \&\s-1NOTE\s0 for \-\-prebegin and \-\-preend: A zero takes precedence. If one is zero, the other is ignored. If both are zero, entire document is preformatted. .IP "\-\-preformat_start_marker \fIregexp\fR" 4 .IX Item "--preformat_start_marker regexp" What flags the start of a preformatted section if \-\-use_preformat_marker is true. .Sp (default: \*(L"^(:?(:?<)|<)PRE(:?(:?>)|>)\e$\*(R") .IP "\-\-preformat_end_marker \fIregexp\fR" 4 .IX Item "--preformat_end_marker regexp" What flags the end of a preformatted section if \-\-use_preformat_marker is true. .Sp (default: \*(L"^(:?(:?<)|<)/PRE(:?(:?>)|>)\e$\*(R") .IP "\-\-preformat_whitespace_min \fIn\fR | \-\-prewhite \fIn\fR | \-p \fIn\fR" 4 .IX Item "--preformat_whitespace_min n | --prewhite n | -p n" Minimum number of consecutive whitespace characters to trigger normal preformatting. \&\s-1NOTE:\s0 Tabs are expanded to spaces before this check is made. That means if \fBtab_width\fR is 8 and this is 5, then one tab may be expanded to 8 spaces, which is enough to trigger preformatting. (default: 5) .IP "\-\-prepend_file \fIfilename\fR | \-\-prepend_body \fIfilename\fR | \-\-pp \fIfilename\fR" 4 .IX Item "--prepend_file filename | --prepend_body filename | --pp filename" If you want something prepended to the processed body text, put the filename here. The prepended text will not be processed at all, so make sure it's plain text or decent \s-1HTML\s0. .Sp (default: nothing) .IP "\-\-preserve_indent | \-pi" 4 .IX Item "--preserve_indent | -pi" Preserve the first-line indentation of paragraphs marked with indents by replacing the spaces of the first line with non-breaking spaces. (default: false) .IP "\-\-short_line_length \fIn\fR | \-\-shortline \fIn\fR | \-s \fIn\fR" 4 .IX Item "--short_line_length n | --shortline n | -s n" Lines this short (or shorter) must be intentionally broken and are kept that short. (default: 40) .IP "\-\-style_url \fIstylesheet_url\fR" 4 .IX Item "--style_url stylesheet_url" This gives the \s-1URL\s0 of a stylesheet; a \s-1LINK\s0 tag will be added to the output. .IP "\-\-tab_width \fIn\fR | \-\-tabwidth \fIn\fR | \-tw \fIn\fR" 4 .IX Item "--tab_width n | --tabwidth n | -tw n" How many spaces equal a tab? (default: 8) .IP "\-\-table_type \fItype\fR=0/1" 4 .IX Item "--table_type type=0/1" .Vb 1 \& \-\-table_type ALIGN=1 \-\-table_type BORDER=0 .Ve .Sp This determines which types of tables will be recognised when \*(L"make_tables\*(R" is true. The possible types are \s-1ALIGN\s0, \s-1PGSQL\s0, \s-1BORDER\s0 and \s-1DELIM\s0. (default: all types are true) .IP "\-\-title \fItitle\fR | \-t \fItitle\fR" 4 .IX Item "--title title | -t title" You can specify a title. Otherwise it will use a blank one. (default: nothing) .IP "\-\-titlefirst | \-tf" 4 .IX Item "--titlefirst | -tf" Use the first non-blank line as the title. .IP "\-\-underline_delimiter \fIstring\fR" 4 .IX Item "--underline_delimiter string" This defines what character (or string) is taken to be the delimiter of text which is to be interpreted as underlined (that is, to be given a tag). If this is empty, then no underlining of text will be done. This is \s-1NOT\s0 the same as the following \*(L"underline\*(R" options, which are about underlining of \*(L"header\*(R" sections. (default: _) .IP "\-\-underline_length_tolerance \fIn\fR | \-\-ulength \fIn\fR | \-ul \fIn\fR" 4 .IX Item "--underline_length_tolerance n | --ulength n | -ul n" How much longer or shorter can header underlines be and still be header underlines? (default: 1) .IP "\-\-underline_offset_tolerance \fIn\fR | \-\-uoffset \fIn\fR | \-uo \fIn\fR" 4 .IX Item "--underline_offset_tolerance n | --uoffset n | -uo n" How far offset can header underlines be and still be header underlines? (default: 1) .IP "\-\-unhyphenation | \-\-unhypnenate | \-u" 4 .IX Item "--unhyphenation | --unhypnenate | -u" Enables unhyphenation of text. (default: true) .IP "\-\-use_mosaic_header | \-\-mosaic | \-mh" 4 .IX Item "--use_mosaic_header | --mosaic | -mh" Use this option if you want to force the heading styles to match what Mosaic outputs. (Underlined with \*(L"***\*(R"s is H1, with \*(L"===\*(R"s is H2, with \*(L"+++\*(R" is H3, with \*(L"\-\-\-\*(R" is H4, with \*(L"~~~\*(R" is H5 and with \*(L"...\*(R" is H6) This was the behavior of txt2html up to version 1.10. (default: false) .IP "\-\-use_preformat_marker | \-\-preformat_marker | \-pm" 4 .IX Item "--use_preformat_marker | --preformat_marker | -pm" Turn on preformatting when encountering \*(L"<\s-1PRE\s0>\*(R" on a line by itself, and turn it off when there's a line containing only \*(L"\*(R". When such preformatted text is detected, the \s-1PRE\s0 tag will be given the class 'quote_explicit'. (default: off) .IP "\-\-xhtml" 4 .IX Item "--xhtml" Try to make the output conform to the \s-1XHTML\s0 standard, including closing all open tags and marking empty tags correctly. This turns on \-\-lower_case_tags and overrides the \-\-doctype option. Note that if you add a header or a footer file, it is up to you to make it conform; the header/footer isn't touched by this. Likewise, if you make link-dictionary entries that break \s-1XHTML\s0, then this won't fix them, except to the degree of putting all tags into lower\-case. .Sp (default: true) .SH "FILE FORMATS" .IX Header "FILE FORMATS" .Sh "Options Files" .IX Subsection "Options Files" Options can be given in files as well as on the command-line by flagging an option file with @\fIfilename\fR in the command\-line. Also, the files ~/.txt2htmlrc and ./.txt2htmlrc are checked for options. .PP The format is as follows: Lines starting with # are comments. Lines enclosed in PoD markers are also comments. Blank lines are ignored. The options themselves should be given the way they would be on the command line, that is, the option name (\fIincluding\fR the \-\-) followed by its value (if any). .PP For example: .PP .Vb 2 \& # set link dictionaries \& \-\-default_link_dict /home/kat/.TextToHTML.dict .Ve .PP .Vb 3 \& # set options for poetry \& \-\-titlefirst \& \-\-short_line_length 60 .Ve .PP See Getopt::ArgvFile for more information. .Sh "Link Dictionary" .IX Subsection "Link Dictionary" A link dictionary file contains patterns to match, and what to convert them to. It is called a \*(L"link\*(R" dictionary because it was intended to be something which defined what a href link was, but it can be used for more than that. However, if you wish to define your own links, it is strongly advised to read up on regular expressions (regexes) because this relies heavily on them. .PP The file consists of comments (which are lines starting with #) and blank lines, and link entries. Each entry consists of a regular expression, a \-> separator (with optional flags), and a link \*(L"result\*(R". .PP In the simplest case, with no flags, the regular expression defines the pattern to look for, and the result says what part of the regular expression is the actual link, and the link which is generated has the href as the link, and the whole matched pattern as the visible part of the link. The first character of the regular expression is taken to be the separator for the regex, so one could either use the traditional / separator, or something else such as | (which can be helpful with URLs which are full of / characters). .PP So, for example, an ftp \s-1URL\s0 might be defined as: .PP .Vb 1 \& |ftp:[\ew/\e.:+\e\-]+| \-> $& .Ve .PP This takes the whole pattern as the href, and the resultant link has the same thing in the href as in the contents of the anchor. .PP But sometimes the href isn't the whole pattern. .PP .Vb 1 \& /<URL:\es*(\eS+?)\es*>/ \-\-> $1 .Ve .PP With the above regex, a () grouping marks the first subexpression, which is represented as \f(CW$1\fR (rather than $& the whole expression). This entry matches a \s-1URL\s0 which was marked explicity as a \s-1URL\s0 with the pattern (note the < is shown as the entity, not the actual character. This is because by the time the links dictionary is checked, all such things have already been converted to their \s-1HTML\s0 entity forms) This would give us a link in the form <URL:foo> .PP \&\fBThe h flag\fR .PP However, if we want more control over the way the link is constructed, we can construct it ourself. If one gives the h flag, then the \&\*(L"result\*(R" part of the entry is taken not to contain the href part of the link, but the whole link. .PP For example, the entry: .PP .Vb 1 \& /<URL:\es*(\eS+?)\es*>/ \-h\-> $1 .Ve .PP will take and give us foo .PP However, this is a very powerful mechanism, because it can be used to construct custom tags which aren't links at all. For example, to flag *italicised words* the following entry will surround the words with \s-1EM\s0 tags. .PP .Vb 1 \& /\eB\e*([a\-z][a\-z \-]*[a\-z])\e*\eB/ \-hi\-> $1 .Ve .PP \&\fBThe i flag\fR .PP This turns on ignore case in the pattern matching. .PP \&\fBThe e flag\fR .PP This turns on execute in the pattern substitution. This really only makes sense if h is turned on too. In that case, the \*(L"result\*(R" part of the entry is taken as perl code to be executed, and the result of that code is what replaces the pattern. .PP \&\fBThe o flag\fR .PP This marks the entry as a once-only link. This will convert the first instance of a matching pattern, and ignore any others further on. .PP For example, the following pattern will take the first mention of HTML::TextToHTML and convert it to a link to the module's home page. .PP .Vb 1 \& "HTML::TextToHTML" \-io\-> http://www.example.com/tools/text_to_html/ .Ve .Sh "Input File Format" .IX Subsection "Input File Format" For the most part, this module tries to use intuitive conventions for determining the structure of the text input. Unordered lists are marked by bullets; ordered lists are marked by numbers or letters; in either case, an increase in indentation marks a sub-list contained in the outer list. .PP Headers (apart from custom headers) are distinguished by \*(L"underlines\*(R" underneath them; headers in all-capitals are distinguished from those in mixed case. All headers, both normal and custom headers, are expected to start at the first line in a \*(L"paragraph\*(R". .PP Tables require a more rigid convention. A table must be marked as a separate paragraph, that is, it must be surrounded by blank lines. Tables come in different types. For a table to be parsed, its \&\-\-table_type option must be on, and the \-\-make_tables option must be true. .PP \&\fB\s-1ALIGN\s0 Table Type\fR .PP Columns must be separated by two or more spaces (this prevents accidental incorrect recognition of a paragraph where interword spaces happen to line up). If there are two or more rows in a paragraph and all rows share the same set of (two or more) columns, the paragraph is assumed to be a table. For example .PP .Vb 3 \& \-e File exists. \& \-z File has zero size. \& \-s File has nonzero size (returns size). .Ve .PP becomes .PP .Vb 5 \& \& \& \& \&
\-eFile exists.
\-zFile has zero size.
\-sFile has nonzero size (returns size).
.Ve .PP This guesses for each column whether it is intended to be left, centre or right aligned. .PP \&\fB\s-1BORDER\s0 Table Type\fR .PP This table type has nice borders around it, and will be rendered with a border, like so: .PP .Vb 6 \& +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ \& | Column1 | Column2 | \& +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ \& | val1 | val2 | \& | val3 | val3 | \& +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ .Ve .PP The above becomes .PP .Vb 7 \& \& \& \& \& \& \&
Column1Column2
val1val2
val3val3
.Ve .PP It can also have an optional caption at the start. .PP .Vb 7 \& My Caption \& +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ \& | Column1 | Column2 | \& +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ \& | val1 | val2 | \& | val3 | val3 | \& +\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-+ .Ve .PP \&\fB\s-1PGSQL\s0 Table Type\fR .PP This format of table is what one gets from the output of a Postgresql query. .PP .Vb 5 \& Column1 | Column2 \& \-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\- \& val1 | val2 \& val3 | val3 \& (2 rows) .Ve .PP This can also have an optional caption at the start. This table is also rendered with a border and table-headers like the \s-1BORDER\s0 type. .PP \&\fB\s-1DELIM\s0 Table Type\fR .PP This table type is delimited by non-alphanumeric characters, and has to have at least two rows and two columns before it's recognised as a table. .PP This one is delimited by the '| character: .PP .Vb 2 \& | val1 | val2 | \& | val3 | val3 | .Ve .PP But one can use almost any suitable character such as : # $ % + and so on. This is clever enough to figure out what you are using as the delimiter if you have your data set up like a table. Note that the line has to both begin and end with the delimiter, as well as using it to separate values. .PP This can also have an optional caption at the start. .SH "EXAMPLES" .IX Header "EXAMPLES" \&\fBConvert one file to \s-1HTML\s0\fR .PP .Vb 1 \& txt2html \-\-infile thing.txt \-\-outfile thing.html .Ve .PP This will create a \s-1HTML\s0 file called \f(CW\*(C`thing.html\*(C'\fR from the plain text file \f(CW\*(C`thing.txt\*(C'\fR. .SH "BUGS" .IX Header "BUGS" Tell me about them. .SH "PREREQUISITES" .IX Header "PREREQUISITES" .Vb 7 \& Pod::Usage \& HTML::TextToHTML \& Getopt::Long \& Getopt::ArgvFile \& File::Basename \& YAML::Syck \& perldoc .Ve .SH "SCRIPT CATEGORIES" .IX Header "SCRIPT CATEGORIES" Web .SH "ENVIRONMENT" .IX Header "ENVIRONMENT" .IP "\s-1HOME\s0" 4 .IX Item "HOME" txt2html looks in the \s-1HOME\s0 directory for config files. .SH "FILES" .IX Header "FILES" These files are only read if the Getopt::ArgvFile module is available on the system. .ie n .IP """~/.txt2htmlrc""" 4 .el .IP "\f(CW~/.txt2htmlrc\fR" 4 .IX Item "~/.txt2htmlrc" User configuration file. .ie n .IP """.txt2htmlrc""" 4 .el .IP "\f(CW.txt2htmlrc\fR" 4 .IX Item ".txt2htmlrc" Configuration file in the current working directory; overrides options in \f(CW\*(C`~/.txt2htmlrc\*(C'\fR and is overridden by command-line options. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIperl\fR\|(1) \&\fIhtmltoc\fR\|(1) HTML::TextToHTML Getopt::Long Getopt::ArgvFile .SH "AUTHOR" .IX Header "AUTHOR" .Vb 3 \& Kathryn Andersen (RUBYKAT) \& perlkat AT katspace dot com \& http//www.katspace.com/ .Ve .PP based on txt2html by Seth Golub .SH "COPYRIGHT" .IX Header "COPYRIGHT" Original txt2html script copyright (c) 1994\-2000 Seth Golub seth \s-1AT\s0 aigeek.com .PP Copyright (c) 2002\-2005 Kathryn Andersen .PP This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.