Contents Previous Next

The Three User Interfaces: Gui, Web and Command Line

As different users have different needs and environments, txt2tags is very flexible on how it runs.

There are three User Interfaces for the program, each one with its own purpose and features.

Graphical Interface

Since version 1.0, there is a nice Graphical Interface, that works on Linux, Windows, Mac and others. Just call txt2tags with the --gui option to open it.

The interface is pretty simple and intuitive:

  1. You locate the source .t2t file on the disk and its options are loaded.

  2. If the target is still empty, you must choose one.

  3. Then there are some options you may choose, but none of them are required.

  4. Finally, press the "Convert!" button.

A nice option is the "Dump to screen", so you can check the resulting code on a separate window, no file is saved at all. When the code is OK, you uncheck it and the file will be saved.

The default interface colors can be changed on the configuration file, using the %!guicolors settings. For example:

% set my own colors for the graphical interface (bg1, fg1, bg2, fg2)
%!guicolors: blue white brown yellow

Web Interface

The Web Interface is up and running on the Internet at https://txt2tags.org/online.php, so you can use and test the program instantly, before download.

One can also put this interface on the local intranet avoiding to install txt2tags in all machines.

Command Line Interface

For command line power users, the --help should be enough:

Usage: txt2tags [OPTIONS] [infile.t2t ...]

      --targets       print a list of all the available targets and exit
  -t, --target=TYPE   set target document type. currently supported:
                      adoc, art, creole, dbk, doku, gwiki, html, lout, man,
                      mgp, moin, pm6, pmw, sgml, tex, txt, wiki, xhtml
  -i, --infile=FILE   set FILE as the input file name ('-' for STDIN)
  -o, --outfile=FILE  set FILE as the output file name ('-' for STDOUT)
      --encoding=ENC  set target file encoding (utf-8, iso-8859-1, etc)
      --toc           add an automatic Table of Contents to the output
      --toc-level=N   set maximum TOC level (depth) to N
      --toc-only      print the Table of Contents and exit
  -n, --enum-title    enumerate all titles as 1, 1.1, 1.1.1, etc
      --style=FILE    use FILE as the document style (like HTML CSS)
      --css-sugar     insert CSS-friendly tags for HTML/XHTML
      --css-inside    insert CSS file contents inside HTML/XHTML headers
  -H, --no-headers    suppress header and footer from the output
      --mask-email    hide email from spam robots. x@y.z turns <x (a) y z>
      --slides        format output as presentation slides (used by -t art)
      --width=N       set the output's width to N columns (used by -t art)
      --height=N      set the output's height to N rows (used by -t art)
  -C, --config-file=F read configuration from file F
      --gui           invoke Graphical Tk Interface
  -q, --quiet         quiet mode, suppress all output (except errors)
  -v, --verbose       print informative messages during conversion
  -h, --help          print this help information and exit
  -V, --version       print program version and exit
      --dump-config   print all the configuration found and exit
      --dump-source   print the document source, with includes expanded

Turn OFF options:
     --no-css-inside, --no-css-sugar, --no-dump-config, --no-dump-source,
     --no-encoding, --no-enum-title, --no-headers, --no-infile,
     --no-mask-email, --no-outfile, --no-quiet, --no-rc, --no-slides,
     --no-style, --no-targets, --no-toc, --no-toc-only

Example:
     txt2tags -t html --toc file.t2t

By default, converted output is saved to 'infile.<target>'.
Use --outfile to force an output file name.
If  input file is '-', reads from STDIN.
If output file is '-', dumps output to STDOUT.

Please read the txt2tags man page for detailed information about options and command line use.

Examples:

Convert to HTML$ txt2tags -t html file.t2t
The same, using redirection$ txt2tags -t html -o - file.t2t > file.html
.
Including Table Of Contents$ txt2tags -t html --toc file.t2t
And also, numbering titles$ txt2tags -t html --toc --enum-title file.t2t
.
Contents quick view$ txt2tags --toc-only file.t2t
Maybe enumerate them?$ txt2tags --toc-only --enum-title file.t2t
.
One liners from STDIN$ echo -e "\n**bold**" | txt2tags -t html --no-headers -
Testing Mask Email feature$ echo -e "\njohn.wayne@farwest.com" | txt2tags -t txt --mask-email --no-headers -

Contents Previous Next