Table of Contents

Samples per column (heading level h1)
Table rendering examples
Conversion program
t2html Test Page

Copyright © 1996-2007 Jari Aalto

License: This material may be distributed only subject to the terms and conditions set forth in GNU General Public License v2 or later; or, at your option, distributed under the terms of GNU Free Documentation License version 1.2 or later (GNU FDL).

This is a demonstration text of Perl Text To HTML converter.

Headings

The tool provides for two heading levels. Combined with bullets and numbered lists, it ought to be enough for most purposes, unless you really like section 1.2.3.4.5

You can insert links to headings or other documents. The convention is interior links are made by joining the first four words of the heading with underscores, so they must be unique. A link to a heading below looks like this in the text document and generates the link shown. There also is syntax for automatically inserting a base URL (see the tool documentation).

The following blue link is generated with markup code: # REF #Markup ;(Markup);

(Markup)

Markup

The markup here is mostly based on column position, meaning mostly no tags. The exceptions are special marks for bullets and for emphasis. See later sections for the effects of column position on the output HTML.

Text surrounded by = equals = comes out another color
Text surrounded by backquote/forward quote comes out color `
Text surrounded by * asterisks * comes out italic text
Text surrounded by _ underscores _ comes out bold
The long dash – is signified with two consequent dashes (-)
The plus-minus is signified with (+) and (-) markers combined ±4
Big character "C" in parentheses ( C ) make a copyright sign (C)
Registered trade mark sign ® is big character "R" in parentheses ( R )
Euro sign is small character "e" right after digit: 400 €
Degree sign is number "0" in parentheses just after number: 5°C
Superscript is maerked with bracket immediately attached to textsee this
Special HTML entities can embedded in a normal way, like: × < > ≤ ≥ ≠ √ − α β γ ƒ ÷ « » - – — ≈ ≡ ‹ › ∑ ∞ ™

Emacs minor mode

If you use the advertised Emacs minor mode (tinytf.el) you can easily renumber headings as you revise the text. Test is also colorized as you edit content.

The editing mode can automatically generate the table of contents and the HTML generator can use it to generate a two frame output with the TOC in the left frame as hotlinks to the sections and subsections. Visit http://freecode.net/projects/emacs-tiny-tools

Bullets, lists, and links

This is ordinary text.

  1. This is a numbered list, made with a '.' in column 8 of its first line and text in column 12. You may not have blank lines between the items.
  2. Clickable email gork@ork.com.
  3. Non-clickable email gork@ork.com.
  4. Clickable link: http://this.com
  5. Non-clickable link: http://this.com.
  6. Clickable file: file:/home/gork/x.txt.

Line breaking

Ordinary text with leading dot(.) forces line breaks in the HTML. Here is a line with forced break.
Here is another line thatcontains dot-code at the beginning.

Specials

You can use superscripts1, multiple(2) and almost any(ab) and imaginableIV superscripts


Samples per column (heading level h1)

These samples show the range of effects produced by writing text beginning in different columns. The column numbers referred to are columns in the source text, not (obviously) the output. The column numbering is counted starting from 0, not number 1. Column 1, is undefined and nothing special. Column 2, is undefined and nothing special.

Column 3, plain text, with color

Column 4, Next heading level (h2)

Column 5, plain text, with color

Column 6, This i used for long quotations. The text uses Georgia font, which is designed for web, but which is equally good for laser printing font.

Column 7, bold, italic

Column 7, start and end with double quote. Use for inner TOPICS

Column 8, standard text strong emphasized

Column 9, font weight bold, not italic.

Column 10, quotation text, italic serif. This text has been made a little smaller and condensed than the rest of the text. More quotation text. More quotation text. More quotation text. More quotation text. More quotation text. More quotation text. More quotation text. More quotation text. More quotation text. More quotation text. More quotation text. More quotation text.

Column 11, another color, for questions, exercise texts etc.

Note: It is possible to say something important at column 12, which is normally reserved for CODE. You must supply options --css-code-bg and --css-code-note=Note:

Here is the code column 12:

Note: Here is something important to tell you about this code This part of the text in first paragrah is rendered differently, because it started with magic word Note: The rest of the pararagraphs are rendered as CODE.
      /* Column 12 code */
      /* 10pt courier navy */
      // col 12 and beyond stay as is to preserve code formatting.

      for( i=0 ; i < 10 ; i++ )
      {
          more();
          whatever();
      }    

Another level 2 heading (column 4)

Here is more ordinary text.


Table rendering examples

These examples make sense only if the options --css-code-bg (use gray background for column 12) and --css-code-note=Note: have been turned on. If orfer to take full advantage of all the possibilities, you should introduce yourself to the HTML 4.01 specification and peek the CSS code in the generated HTML: the tableclass can take an attribute of the embedded default styles.

Note: This is example 1 and --css-code-note options reads 'First word' in paragraph at column 12 and renders it differently. You can attache code right after this note, which must occupy only one paragraph
      --css-code-note=REGEXP      Regexp matches 'First word'
      --css-code-bg    

Here is example 2 using table control code #t2html::tableborder:1

      for ( i = 0; i++; i < 10 )
      {
          //  Doing something in this loop
      }    

Here is example 3 using table control code #t2html::td:bgcolor=#FFEEFF:tableclass:solid

      for ( i = 0; i++; i < 10 )
      {
          //  Doing something in this loop
      }    

Here is example 4 using table control code #t2html::td:bgcolor=#CCFFCC

      for ( i = 0; i++; i < 10 )
      {
          //  Doing something in this loop
      }    

Here is example 5 using table control code. Due to bug in Opera 7-9.x, this exmaple may now show correctly. Please use Firefox to see the effect. #t2html::td:bgcolor=#FFFFFF:tableclass:dashed

      for ( i = 0; i++; i < 10 )
      {
          //  Doing something in this loop
      }    

Here is example 6 using multiple table control codes. Use underscore sccharacter to separate different table attributes from each other. The underscore will be vconverted into SPACE. The double quotes around the VALUE are not strictly required by HTML standard, but they are expected in XML. #t2html::td:bgcolor="#EAEAEA":table:border=1_border=0_cellpadding="10"_cellspacing="0"

      for ( i = 0; i++; i < 10 )
      {
          //  Doing something in this loop
      }    

Here is example 7 using table control code #t2html::td:class=color-navy:table:cellpadding=0 which cancels default grey coloring. The cellpadding must be zeroed, around the text to make room.

      for ( i = 0; i++; i < 10 )
      {
          //  Doing something in this loop
      }    


Conversion program

The perl program t2html turns the raw technical text format into HTML. Among other things it can produce HTML files with an index frame, a main frame, and a master that ties the two together. It has features too numerous to list to control the output. For details see the perldoc than is embeddedinside the program:

      perl -S t2html --help | more    

The frame aware html pages are generated by adding the --html-frame option.