1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
|
t2html Test Page
#T2HTML-TITLE Page title is embedded inside text file
#t2HTML-EMAIL author@examle.com
#T2HTML-AUTHOR John Doe
#T2HTML-METAKEYWORDS test, html, example
#T2HTML-METADESCRIPTION This is test page of program t2html
Copyright (C) 1996-2016 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);
#REF #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 (R) is big character "R" in parentheses ( R )
.Euro sign is small character "e" right after digit: 400e
.Degree sign is number "0" in parentheses just after number: 5(0)C
.Superscript is maerked with bracket immediately attached to text[see 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.com/projects/emacs-tiny-tools
Bullets, lists, and links
This is ordinary text.
o This is a bullet paragraph with a continuation mark
(leading comma) in the last line. It will not work if the
,comma is on the same line as the bullet.
This is a continued bullet paragraph. You use a leading
comma in the last line of the previous block to make a
continued item. This is ok except the paragraph fill code
(for the previous paragraph) cannot deal with it. Maybe
it is a hint not to do continued bullets, or a hint not to
put the comma in until you are done formatting.
o The next bullet. the sldjf sldjf sldkjf slkdjf sldkjf
lsdkjf slkdjf sldkjf sldkjf lskdj flskdjf lskdjf lsdkjf.
. 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.
. Clickable email <gork@ork.com>.
. Non-clickable email gork@ork.com.
. Clickable link: http://this.com
. Non-clickable link: -http://this.com.
. 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 superscripts[1], multiple[(2)] and almost
any[(ab)] and imaginable[IV 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
#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
#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
#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
#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"
#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.
#t2html::td:class=color-white:table:cellpadding=0
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.
|