Menu

dk-t2h manual

Dirk Krause
← Previous ↑ Home → Next

dk-t2h — Convert text → HTML

Synopsis

dk-t2h [_options_] [_file(s)_]

Description

The program converts text from the specified files or standard input to HTML. Alternatively you can use the -e (echo) option to convert text specified on the command line.


Options

Option Purpose
-i string
‑‑input‑encoding=string
Expected input encoding, see the Encoding names table below.
The encoding specified here is overwritten, if a BOM (byte order marker) is found at start of input.
The default is the systems native encoding and endianness.
-l
--code-lines
Wrap all lines into "<code title="001">…</code>".
-e
--echo
Convert the command line arguments, do not treat them as file names.
-f
--full
Produce a full HTML file, not just a fragment. Options -e and -f are mutually exclusive.
-t string
--title=string
Title for full HTML file, ignored if the -f option is not present.
--verbose Show error message upon interrupt by SIGPIPE.
Name Encoding
plain Bytes 0x00 to 0xFF represent 32 bit characters U+00000000 to U+000000FF.
win1252 Windows codepage 1252 used by GUI applications on Windows. Formerly named ansi as the Visual Studio documentation names the functions handling such strings as ANSI versions.
utf-8
utf8
UTF-8
utf-16
utf16
UTF-16 in the systems default endianness
utf-16-le
utf-16le
utf16le
utf-16-lsb
&utf-16lsb
utf16lsb
UTF-16 little-endian (least significant byte first)
utf-16-be
utf-16be
utf16be
utf-16-msb
utf-16msb
utf16msb
UTF-16 big-endian (most significant byte first)
c32 32 bit UNICODE in the systems default endianness
c32-le
c32le
c32-lsb
c32lsb
32 bit UNICODE little-endian (least significant byte first)
c32-be
c32be
c32-msb
c32msb
32 bit UNICODE big-endian (most significant byte first)

When producing UTF-16 or 32 bit UNICODE output a BOM is written at start of output. You can suppress the BOM by appending "nobom" to the encoding, i.e. "-o utf-16-le,nobom".
To require a BOM you can append "bom" to the encoding, i.e. "-o utf-8,bom".


Exit status

0 on success, all other status codes indicate an error.


Restrictions

On Windows the file name length is restricted to _MAX_PATH (260) characters if the file name contains a wildcard (* or ? character).


Notes

This program uses DK libraries version 4.


Examples

Convert text to a full HTML file

To convert a text file x.txt into a full HTML file:

dk-t2h -f -t "Page title" < x.txt > x.html
Option Purpose
-f Produce full HTML file. A complete HTML page
<html><body>…</body></html>
is produced. Some
<link rel=…>
are prepared as comments. When activating these links you should replace some placeholders by useful values manually.
-t "Page title" Page title for the HTML file.

Convert text to a HTML segment

To convert a text file x.txt into a HTML segment:

dk-t2h < x.txt > x.html

Convert source code to HTML segment

To convert source code file x.c into a HTML segment:

dk-t2h -l < x.c > x.html
Option Purpose
-l Mark input as source code. Each code line is placed in a
<code title="001">…</code>
construct. When the user moves the mouse over a line, the line number is shown as tooltip. The entire output should be placed in a
<pre>…</pre>
environment.

Specify text to convert on command line

To convert text specified as command line arguments:

dk-t2h -e Testing german umlauts ÄÖÜäöüß
Option Purpose
-e Use input text from command line arguments instead of standard input.

← Previous ↑ Home → Next

Related

Wiki: dk-t2h