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 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498
|
<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:ASSI@cygwin.nonet" />
</head>
<body>
<ul id="index">
<li><a href="#NAME">NAME</a></li>
<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
<li><a href="#OPTIONS">OPTIONS</a>
<ul>
<li><a href="#Html:-Header-and-Footer-options">Html: Header and Footer options</a></li>
<li><a href="#Html:-Navigation-urls">Html: Navigation urls</a></li>
<li><a href="#Html:-Controlling-CSS-generation-HTML-tables">Html: Controlling CSS generation (HTML tables)</a></li>
<li><a href="#Html:-Controlling-the-body-of-document">Html: Controlling the body of document</a></li>
<li><a href="#Document-maintenance-and-batch-job-commands">Document maintenance and batch job commands</a></li>
<li><a href="#Miscellaneous-options">Miscellaneous options</a></li>
</ul>
</li>
<li><a href="#FORMAT-DESCRIPTION">FORMAT DESCRIPTION</a>
<ul>
<li><a href="#USED-HEADINGS">USED HEADINGS</a></li>
</ul>
</li>
<li><a href="#TEXT-PLACEMENT-RULES">TEXT PLACEMENT RULES</a>
<ul>
<li><a href="#General">General</a></li>
<li><a href="#Additional-tokens-for-use-at-column-8">Additional tokens for use at column 8</a></li>
<li><a href="#Special-text-markings">Special text markings</a></li>
<li><a href="#Http-and-email-marking-control">Http and email marking control</a></li>
<li><a href="#Lists-and-bullets">Lists and bullets</a></li>
<li><a href="#Line-breaks">Line breaks</a></li>
</ul>
</li>
<li><a href="#EMBEDDED-DIRECTIVES-INSIDE-TEXT">EMBEDDED DIRECTIVES INSIDE TEXT</a></li>
<li><a href="#TABLE-OF-CONTENT-HEADING">TABLE OF CONTENT HEADING</a></li>
<li><a href="#TROUBLESHOOTING">TROUBLESHOOTING</a>
<ul>
<li><a href="#Generated-HTML-document-did-not-look-what-I-intended">Generated HTML document did not look what I intended</a></li>
</ul>
</li>
<li><a href="#EXAMPLES">EXAMPLES</a></li>
<li><a href="#ENVIRONMENT">ENVIRONMENT</a></li>
<li><a href="#SEE-ALSO">SEE ALSO</a>
<ul>
<li><a href="#Related-programs">Related programs</a></li>
<li><a href="#Standards">Standards</a></li>
<li><a href="#ISO-standards">ISO standards</a></li>
</ul>
</li>
<li><a href="#BUGS">BUGS</a></li>
<li><a href="#SCRIPT-CATEGORIES">SCRIPT CATEGORIES</a></li>
<li><a href="#PREREQUISITES">PREREQUISITES</a></li>
<li><a href="#COREQUISITES">COREQUISITES</a></li>
<li><a href="#AVAILABILITY">AVAILABILITY</a></li>
<li><a href="#AUTHOR">AUTHOR</a></li>
</ul>
<h1 id="NAME">NAME</h1>
<p>t2html - Simple text to HTML converter. Relies on text indentation rules.</p>
<h1 id="SYNOPSIS">SYNOPSIS</h1>
<pre><code> t2html [options] file.txt > file.html</code></pre>
<h1 id="DESCRIPTION">DESCRIPTION</h1>
<p>Convert pure text files into nice looking, possibly framed, HTML pages. An example of conversion:</p>
<pre><code> 1. Plain text source code
http://pm-doc.git.sourceforge.net/git/gitweb.cgi?p=pm-doc/pm-doc;a=blob_plain;f=doc/index.txt;hb=HEAD
2. reusult of conversion with custom --css-file option:
http://pm-doc.sourceforge.net/pm-tips.html
http://pm-doc.sourceforge.net/pm-tips.css
3. An Emacs mode tinytf.el for writing the text files (optional)
https://savannah.nongnu.org/projects/emacs-tiny-tools</code></pre>
<p><b>Requirements for the input ascii files</b></p>
<p>The file must be written in Technical Format, whose layout is described in the this manual. Basically the idea is simple and there are only two heading levels: one at column 0 and the other at column 4 (halfway between the tab width). Standard text starts at column 8 (the position after pressed tab-key).</p>
<p>The idea of technical format is that each column represents different rendering layout in the generated HTML. There is no special markup needed in the text file, so you can use the text version as a master copy of a FAQ etc. Bullets, numbered lists, word emphasis and quotation etc. can expressed in natural way.</p>
<p><b>HTML description</b></p>
<p>The generated HTML includes embedded Cascading Style Sheet 2 (CSS2) and a small piece of Java code. The CSS2 is used to colorize the page loyout and to define suitable printing font sizes. The generated HTML also takes an approach to support XHTML. See page http://www.w3.org/TR/xhtml1/#guidelines where the backward compatibility recommendations are outlined:</p>
<pre><code> Legal HTML XHTML requires
<P> <p> ..</p>
<BR> <br></br>
<HR> <hr></hr></code></pre>
<p>XHTML does not support fragment identifiers #foo, with the <code>name</code> element, but uses <code>id</code> instead. For backward compatibility both elements are defined:</p>
<pre><code> < ..name="tag"> Is now <.. name="tag" id="tag"></code></pre>
<p>NOTE: This program was never designed to be used for XHTML and the strict XHTML validity is not to be expected.</p>
<p><b>Motivation</b></p>
<p>The easiest format to write large documents, like FAQs, is text. A text file offers WysiWyg editing and it can be turned easily into HTML format. Text files are easily maintained and there is no requirements for special text editors. Any text editor like notepad, vi, Emacs can be used to maintain the documents.</p>
<p>Text files are also the only sensible format if documents are kept under version control like RCS, CVS, SVN, Arch, Perforce, ClearCase. They can be asily compared with diff and patches can be easily received and sent to them.</p>
<p>To help maintining large documents, there is also available an <i>Emacs</i> minor mode, package called <i>tinytf.el</i>, which offers text fontification with colors, Indentation control, bullet filling, heading renumbering, word markup, syntax highlighting etc. See project http://freecode.com/projects/emacs-tiny-tools</p>
<h1 id="OPTIONS">OPTIONS</h1>
<h2 id="Html:-Header-and-Footer-options">Html: Header and Footer options</h2>
<dl>
<dt id="as-is"><b>--as-is</b></dt>
<dd>
<p>Any extra HTML formatting or text manipulation is suppressed. Text is preserved as it appears in file. Use this option if you plan to deliver or and print the text as seen.</p>
<pre><code> o If file contains "Table of Contents" it is not removed
o Table of Content block is not created (it usually would)</code></pre>
</dd>
<dt id="author--a-STR"><b>--author -a STR</b></dt>
<dd>
<p>Author of document e.g. <b>--author "John Doe"</b></p>
</dd>
<dt id="disclaimer-file-FILE"><b>--disclaimer-file</b> FILE</dt>
<dd>
<p>The text that appears at the footer is read from this file. If not given the default copyright text is added. Options <code>--quiet</code> and <code>--simple</code> suppress disclaimers.</p>
</dd>
<dt id="document-FILE"><b>--document FILE</b></dt>
<dd>
<p><b>Name</b> of the document or filename. You could list all alternative URLs to the document with this option.</p>
</dd>
<dt id="email--e-EMAIL"><b>--email -e EMAIL</b></dt>
<dd>
<p>The contact address of the author of the document. Must be pure email address with no "<" and ">" characters included. Eg. <b>--email foo@example.com</b></p>
<pre><code> --email "<me@here.com>" WRONG
--email "me@here.com" right</code></pre>
</dd>
<dt id="simple--s"><b>--simple</b> <b>-s</b></dt>
<dd>
<p>Print minimum footer only: contact, email and date. Use <code>--quiet</code> to completely discard footer.</p>
</dd>
<dt id="t2html-tags"><b>--t2html-tags</b></dt>
<dd>
<p>Allow processing embedded #T2HTML-<tag> directives inside file. See full explanation by reading topic <code>EMBEDDED DIRECTIVES INSIDE TEXT</code>. By default, you do not need to to supply this option - it is "on" by default.</p>
<p>To disregard embedded directives in text file, supply "no" option: <b>--not2html-tags</b>.</p>
</dd>
<dt id="title-STR--t-STR"><b>--title STR</b> <b>-t STR</b></dt>
<dd>
<p>The title text that appears in top frame of browser.</p>
</dd>
<dt id="url-URL"><b>--url URL</b></dt>
<dd>
</dd>
</dl>
<p>Location of the HTML file. When <b>--document</b> gave the name, this gives the location. This information is printed at the Footer.</p>
<h2 id="Html:-Navigation-urls">Html: Navigation urls</h2>
<dl>
<dt id="base-URL"><b>--base URL</b></dt>
<dd>
<p>URL location of the HTML file in the <b>destination site</b> where it will be put available. This option is needed only if the document is hosted on a FTP server (rare, but possible). A FTP server based document cannot use Table Of Contents links (fragment <i>#tag</i> identifiers) unless HTML tag BASE is also defined.</p>
<p>The argument can be full URL to the document:</p>
<pre><code> --base ftp://ftp.example.com/file.html
--base ftp://ftp.example.com/</code></pre>
</dd>
<dt id="button-heading-top"><b>--button-heading-top</b></dt>
<dd>
<p>Add additional <b>[toc]</b> navigation button to the end of each heading. This may be useful in long non-framed HTML files.</p>
</dd>
<dt id="button-top-URL"><b>--button-top URL</b></dt>
<dd>
<p>Buttons are placed at the top of document in order: [previous][top][next] and <i>--button-*</i> options define the URLs.</p>
<p>If URL is string <i>none</i> then no button is inserted. This may be handy if the buttons are defined by a separate program. And example using Perl:</p>
<pre><code> #!/usr/bin/perl
my $top = "index.html"; # set defaults
my $prev = "none";
my $next = "none";
# ... somewhere $prev or $next may get set, or then not
qx(t2html --button-top "$top" --button-prev "$prev" --button-next "$next" ...);
# End of sample program</code></pre>
</dd>
<dt id="button-prev-URL"><b>--button-prev URL</b></dt>
<dd>
<p>URL to go to previous document or string <i>none</i>.</p>
</dd>
<dt id="button-next-URL"><b>--button-next URL</b></dt>
<dd>
<p>URL to go to next document or string <i>none</i>.</p>
</dd>
<dt id="reference-tag-value"><b>--reference tag=value</b></dt>
<dd>
<p>You can add any custom references (tags) inside text and get them expand to any value. This option can be given multiple times and every occurrence of TAG is replaced with VALUE. E.g. when given following options:</p>
<pre><code> --reference "#HOME-URL=http://www.example.com/dir"
--reference "#ARCHIVE-URL=http://www.example.com/dir/dir2"</code></pre>
<p>When referenced in text, the generated HTML includes expanded expanded to values. An example text:</p>
<pre><code> The homepage is #HOME-URL/page.html and the mirrot page it at
#ARCHIVE-URL/page.html where you can find the latest version.</code></pre>
</dd>
<dt id="R---reference-separator-STRING"><b>-R, --reference-separator STRING</b></dt>
<dd>
<p>See above. String that is used to split the TAG and VALUE. Default is equal sign "=".</p>
</dd>
<dt id="T---toc-url-print"><b>-T, --toc-url-print</b></dt>
<dd>
<p>Display URLs (constructed from headings) that build up the Table of Contents (NAME AHREF tags) in a document. The list is outputted to stderr, so that it can be separated:</p>
<pre><code> % t2html --toc-url-print tmp.txt > file.html 2> toc-list.txt</code></pre>
<p>Where would you need this? If you want to know the fragment identifies for your file, you need the list of names.</p>
<pre><code> http://www.example.com/myfile.html#fragment-identifier</code></pre>
</dd>
</dl>
<h2 id="Html:-Controlling-CSS-generation-HTML-tables">Html: Controlling CSS generation (HTML tables)</h2>
<dl>
<dt id="css-code-bg"><b>--css-code-bg</b></dt>
<dd>
<p>This option affects how the code section (column 12) is rendered. Normally the section is surrounded with a <pre>..</pre> codes, but with this options, something more fancier is used. The code is wrapped inside a <table>...</table> and the background color is set to a shade of gray.</p>
</dd>
<dt id="css-code-note-REGEXP"><b>--css-code-note "REGEXP" </b></dt>
<dd>
<p>Option <b>--css-code-bg</b> is required to activate this option. A special word defined using regexp (default is 'Note:') will mark code sections specially. The <code>first word</code> is matched against the supplied Perl regexp.</p>
<p>The supplied regexp must not, repeat, must not, include any matching group operators. This simply means, that grouping parenthesis like <code>(one|two|three)</code> are not allowed. You must use the Perl non-grouping ones like <code>(?:one|two|three)</code>. Please refer to perl manual page [perlre] if this short introduction did not give enough rope.</p>
<p>With this options, instead of rendering column 12 text with <pre>..</pre>, the text appears just like regular text, but with a twist. The background color of the text has been changed to darker grey to visually stand out form the text.</p>
<p>An example will clarify. Suppose that you passed options <b>--css-code-bg</b> and <b>--css-code-note='(?:Notice|Note):'</b>, which instructed to treat the first paragraphs at column 12 differently. Like this:</p>
<pre><code> This is the regular text that appears somewhere at column 8.
It may contain several lines of text in this paragraph.
Notice: Here is the special section, at column 12,
and the first word in this paragraph is 'Notice:'.
Only that makes this paragraph at column 12 special.
Now, we have some code to show to the user:
for ( i = 0; i++; i < 10 )
{
// Doing something in this loop
}</code></pre>
<p>One note, text written with initial special word, like <code>Notice:</code>, must all fit in one full pragraph. Any other paragraphs that follow, are rendered as code sections. Like here:</p>
<pre><code> This is the regular text that appears somewhere
It may contain several lines of text in this paragraph
Notice: Here is the special section, at column 12,
and the first word in this paragraph is 'Notice:'
which makes it special
Hoewver, this paragraph IS NOT rendered specially
any more. Only the first paragraph above.
for ( i = 0; i++; i < 10 )
{
// Doing something in this loop
}</code></pre>
<p>As if this were not enough, there are some special table control directives that let you control the <table>..</table> which is put around the code section at column 12. Here are few examples:</p>
<pre><code> Here is example 1
#t2html::td:bgcolor=#F7F7DE
for ( i = 0; i++; i < 10 )
{
// Doing something in this loop
}
Here is example 2
#t2html::td:bgcolor=#F7F7DE:tableborder:1
for ( i = 0; i++; i < 10 )
{
// Doing something in this loop
}
Here is example 3
#t2html::td:bgcolor="#FFFFFF":tableclass:dashed
for ( i = 0; i++; i < 10 )
{
// Doing something in this loop
}
Here is example 4
#t2html::td:bgcolor="#FFFFFF":table:border=1_width=94%_border=0_cellpadding="10"_cellspacing="0"
for ( i = 0; i++; i < 10 )
{
// Doing something in this loop
}</code></pre>
<p>Looks cryptic? Cannot help that and in order for you to completely understand what these directives do, you need to undertand what elements can be added to the <table> and <td> tokens. Refer to HTML specification for available attributes. Here is briefing what you can do:</p>
<p>The start command is:</p>
<pre><code> #t2html::
|
After this comes attribute pairs in form key:value
and multiple ones as key1:value1:key2:value2 ...</code></pre>
<p>The <code>key:value</code> pairs can be:</p>
<pre><code> td:ATTRIBUTES
|
This is converted into <td attributes>
table:ATTRIBUTES
|
This is converted into <table attributes></code></pre>
<p>There can be no spaces in the ATTRIBUTES, because the <code>First-word</code> must be one contiguous word. An underscore can be used in place of space:</p>
<pre><code> table:border=1_width=94%
|
Interpreted as <table border="1" width="94%"></code></pre>
<p>It is also possible to change the default CLASS style with word <code>tableclass</code>. In order the CLASS to be useful, its CSS definitions must be either in the default configuration or supplied from a external file. See option <b>--script-file</b>.</p>
<pre><code> tableclass:name
|
Interpreted as <table class="name"></code></pre>
<p>For example, there are couple of default styles that can be used:</p>
<pre><code> 1) Here is CLASS "dashed" example
#t2html::tableclass:dashed
for ( i = 0; i++; i < 10 )
{
// Doing something in this loop
}
2) Here is CLASS "solid" example:
#t2html::tableclass:solid
for ( i = 0; i++; i < 10 )
{
// Doing something in this loop
}</code></pre>
<p>You can change any individual value of the default table definition which is:</p>
<pre><code> <table class="shade-note"></code></pre>
<p>To change e.g. only value cellpadding, you would say:</p>
<pre><code> #t2html::table:tablecellpadding:2</code></pre>
<p>If you are unsure what all of these were about, simply run program with <b>--test-page</b> and look at the source and generated HTML files. That should offer more rope to experiment with.</p>
</dd>
<dt id="css-file-FILE"><b>--css-file FILE</b></dt>
<dd>
<p>Include <LINK ...> which refers to external CSS style definition source. This option is ignored if <b>--script-file</b> option has been given, because that option imports whole content inside HEAD tag. This option can appear multiple times and the external CSS files are added in listed order.</p>
</dd>
<dt id="css-font-type-CSS-DEFINITION"><b>--css-font-type CSS-DEFINITION</b></dt>
<dd>
<p>Set the BODY element's font definition to CSS-DEFINITION. The default value used is the regular typeset used in newspapers and books:</p>
<pre><code> --css-font-type='font-family: "Times New Roman", serif;'</code></pre>
</dd>
<dt id="css-font-size-CSS-DEFINITION"><b>--css-font-size CSS-DEFINITION</b></dt>
<dd>
<p>Set the body element's font size to CSS-DEFINITION. The default font size is expressed in points:</p>
<pre><code> --css-font-size="font-size: 12pt;"</code></pre>
</dd>
</dl>
<h2 id="Html:-Controlling-the-body-of-document">Html: Controlling the body of document</h2>
<dl>
<dt id="delete-REGEXP"><b>--delete REGEXP</b></dt>
<dd>
<p>Delete lines matching perl REGEXP. This is useful if you use some document tool that uses navigation tags in the text file that you do not want to show up in generated HTML.</p>
</dd>
<dt id="delete-email-headers"><b>--delete-email-headers</b></dt>
<dd>
<p>Delete email headers at the beginning of file, until first empty line that starts the body. If you keep your document ready for Usenet news posting, they may contain headers and body:</p>
<pre><code> From: ...
Newsgroups: ...
X-Sender-Info:
Summary:
BODY-OF-TEXT</code></pre>
</dd>
<dt id="nodelete-default"><b>--nodelete-default</b></dt>
<dd>
<p>Use this option to suppress default text deletion (which is on).</p>
<p>Emacs <code>folding.el</code> package and vi can be used with any text or programming language to place sections of text between tags <b>{{{</b> and <b>}}}</b>. You can open or close such folds. This allows keeping big documents in order and manageable quite easily. For Emacs support, see. ftp://ftp.csd.uu.se/pub/users/andersl/beta/</p>
<p>The default value deletes these markers and special comments <code>#_comment</code> which make it possible to cinlude your own notes which are not included in the generated output.</p>
<pre><code> {{{ Security section
#_comment Make sure you revise this section to
#_comment the next release
The seecurity is an important issue in everyday administration...
More text ...
}}}</code></pre>
</dd>
<dt id="html-body-STR"><b>--html-body STR</b></dt>
<dd>
<p>Additional attributes to add to HTML tag <BODY>. You could e.g. define language of the text with <b>--html-body LANG=en</b> which would generate HTML tag <BODY LANG="en"> See section "SEE ALSO" for ISO 639.</p>
</dd>
<dt id="html-column-beg-SPEC-HTML-SPEC"><b>--html-column-beg="SPEC HTML-SPEC"</b></dt>
<dd>
<p>The default interpretation of columns 1,2,3 5,6,7,8,9,10,11,12 can be changed with <i>beg</i> and <i>end</i> swithes. Columns 0,4 can't be changed because they are reserved for headings. Here are some samples:</p>
<pre><code> --html-column-beg="7quote <em class='quote7'>"
--html-column-end="7quote </em>"
--html-column-beg="10 <pre> class='column10'"
--html-column-end="10 </pre>"
--html-column-beg="quote <span class='word'>"
--html-column-end="quote </span>"</code></pre>
<p><b>Note:</b> You can only give specifications up till column 12. If text is beyound column 12, it is interpreted like it were at column 12.</p>
<p>In addition to column number, the <i>SPEC</i> can also be one of the following strings</p>
<pre><code> Spec equivalent word markup
------------------------------
quote `'
bold _
emp *
small +
big =
ref [] like: [Michael] referred to [rfc822]
Other available Specs
------------------------------
7quote When column 7 starts with double quote.</code></pre>
<p>For style sheet values for each color, refer to <i>class</i> attribute and use <b>--script-file</b> option to import definitions. Usually /usr/lib/X11/rgb.txt lists possible color values and the HTML standard at http://www.w3.org/ defines following standard named colors:</p>
<pre><code> Black #000000 Maroon #800000
Green #008000 Navy #000080
Silver #C0C0C0 Red #FF0000
Lime #00FF00 Blue #0000FF
Gray #808080 Purple #800080
Olive #808000 Teal #008080
White #FFFFFF Fuchsia #FF00FF
Yellow #FFFF00 Aqua #00FFFF</code></pre>
</dd>
<dt id="html-column-end-COL-HTML-SPEC"><b>--html-column-end="COL HTML-SPEC"</b></dt>
<dd>
<p>See <b>--html-column-beg</b></p>
</dd>
<dt id="html-font-SIZE"><b>--html-font SIZE</b></dt>
<dd>
<p>Define FONT SIZE. It might be useful to set bigger font size for presentations.</p>
</dd>
<dt id="F---html-frame-FRAME-PARAMS"><b>-F, --html-frame [FRAME-PARAMS]</b></dt>
<dd>
<p>If given, then three separate HTML files are generated. The left frame will contain TOC and right frame contains rest of the text. The <i>FRAME-PARAMS</i> can be any valid parameters for HTML tag FRAMESET. The default is <code>cols="25%,75%"</code>.</p>
<p>Using this implies <b>--out</b> option automatically, because three files cannot be printed to stdout.</p>
<pre><code> file.html
--> file.html The Frame file, point browser here
file-toc.html Left frame (navigation)
file-body.html Right frame (content)</code></pre>
</dd>
<dt id="language-ID"><b>--language ID</b></dt>
<dd>
<p>Use language ID, a two character ISO identifier like "en" for English during the generation of HTML. This only affects the text that is shown to end-user, like text "Table Of contents". The default setting is "en". See section "SEE ALSO" for standards ISO 639 and ISO 3166 for proper codes.</p>
<p>The selected language changes propgram's internal arrays in two ways: 1) Instead of default "Table of ocntents" heading the national langaugage equivalent will be used 2) The text "Pic" below embedded sequentially numbered pictures will use natinal equivalent.</p>
<p>If your languagae is not supported, please send the phrase for "Table of contents" and word "Pic" in your language to the maintainer.</p>
</dd>
<dt id="script-file-FILE"><b>--script-file FILE</b></dt>
<dd>
<p>Include java code that must be complete <script...></script> from FILE. The code is put inside <head> of each HTML.</p>
<p>The <b>--script-file</b> is a general way to import anything into the HEAD element. Eg. If you want to keep separate style definitions for all, you could only import a pointer to a style sheet. See <i>14.3.2 Specifying external style sheets</i> in HTML 4.0 standard.</p>
</dd>
<dt id="meta-keywords-STR"><b>--meta-keywords STR</b></dt>
<dd>
<p>Meta keywords. Used by search engines. Separate kwywords like "AA, BB, CC" with commas. Refer to HTML 4.01 specification and topic "7.4.4 Meta data" and see http://www.htmlhelp.com/reference/wilbur/ and</p>
<pre><code> --meta-keywords "AA,BB,CC"</code></pre>
</dd>
<dt id="meta-description-STR"><b>--meta-description STR</b></dt>
<dd>
<p>Meta description. Include description string, max 1000 characters. This is used by search engines. Refer to HTML 4.01 specification and topic "7.4.4 Meta data"</p>
</dd>
<dt id="name-uniq"><b>--name-uniq</b></dt>
<dd>
<p>First 1-4 words from the heading are used for the HTML <i>name</i> tags. However, it is possible that two same headings start with exactly the same 1-4 words. In those cases you have to turn on this option. It will use counter 00 - 999 instead of words from headings to construct HTML <i>name</i> references.</p>
<p>Please use this option only in emergencies, because referring to jump block <i>name</i> via</p>
<pre><code> httpI://example.com/doc.html#header_name</code></pre>
<p>is more convenient than using obscure reference</p>
<pre><code> httpI://example.com/doc.html#11</code></pre>
<p>In addition, each time you add a new heading the number changes, whereas the symbolic name picked from heading stays as long as you do not change the heading. Think about welfare of your netizens who bookmark you pages. Try to make headings to not have same subjects and you do not need this option.</p>
</dd>
</dl>
<h2 id="Document-maintenance-and-batch-job-commands">Document maintenance and batch job commands</h2>
<dl>
<dt id="A---auto-detect"><b>-A, --auto-detect</b></dt>
<dd>
<p>Convert file only if tag <code>#T2HTML-</code> is found from file. This option is handy if you run a batch command to convert all files to HTML, but only if they look like HTML base files:</p>
<pre><code> find . -name "*.txt" -type f \
-exec t2html --auto-detect --verbose --out {} \;</code></pre>
<p>The command searches all *.txt files under current directory and feeds them to conversion program. The <b>--auto-detect</b> only converts files which include <code>#T2HTML-</code> directives. Other text files are not converted.</p>
</dd>
<dt id="link-check--l"><b>--link-check -l</b></dt>
<dd>
<p>Check all http and ftp links. <i>This option is supposed to be run standalone</i> Option <b>--quiet</b> has special meaning when used with link check.</p>
<p>With this option you can regularly validate your document and remove dead links or update moved links. Problematic links are outputted to <i>stderr</i>. This link check feature is available only if you have the LWP web library installed. Program will check if you have it at runtime.</p>
<p>Links that are big, e.g. which match <i>tar.gz .zip ...</i> or that run programs (links with ? character) are ignored because the GET request used in checking would return whole content of the link and it would. be too expensive.</p>
<p>A suggestion: When you put binary links to your documents, add them with space:</p>
<pre><code> http://example.com/dir/dir/ filename.tar.gz</code></pre>
<p>Then the program <i>does</i> check the http addresses. Users may not be able to get the file at one click, checker can validate at least the directory. If you are not the owner of the link, it is also possible that the file has moved of new version name has appeared.</p>
</dd>
<dt id="L---link-check-single"><b>-L, --link-check-single</b></dt>
<dd>
<p>Print condensed output in <i>grep -n</i> like manner <i>FILE:LINE:MESSAGE</i></p>
<p>This option concatenates the url response text to single line, so that you can view the messages in one line. You can use programming tools (like Emacs M-x compile) that can parse standard grep syntax to jump to locations in your document to correct the links later.</p>
</dd>
<dt id="o---out"><b>-o, --out</b></dt>
<dd>
<p>write generated HTML to file that is derived from the input filename.</p>
<pre><code> --out --print /dir/file --> /dir/file.html
--out --print /dir/file.txt --> /dir/file.html
--out --print /dir/file.this.txt --> /dir/file.this.html</code></pre>
</dd>
<dt id="link-cache-CACHE_FILE"><b>--link-cache CACHE_FILE</b></dt>
<dd>
<p>When links are checked periodically, it would be quite a rigorous to check every link every time that has already succeeded. In order to save link checking time, the "ok" links can be cached into separate file. Next time you check the links, the cache is opened and only links found that were not in the cache are checked. This should dramatically improve long searches. Consider this example, where every text file is checked recursively.</p>
<pre><code> $ t2html --link-check-single \
--quiet --link-cache ~tmp/link.cache \
`find . -name "*.txt" -type f`</code></pre>
</dd>
<dt id="O---out-dir-DIR"><b>-O, --out-dir DIR</b></dt>
<dd>
<p>Like <b>--out</b>, but chop the directory part and write output files to DIR. The following would generate the HTML file to current directory:</p>
<pre><code> --out-dir .</code></pre>
<p>If you have automated tool that fills in the directory, you can use word <b>none</b> to ignore this option. The following is a no-op, it will not generate output to directory "none":</p>
<pre><code> --out-dir none</code></pre>
</dd>
<dt id="p---print"><b>-p, --print</b></dt>
<dd>
<p>Print filename to stdout after HTML processing. Normally program prints no file names, only the generated HTML.</p>
<pre><code> % t2html --out --print page.txt
--> page.html</code></pre>
</dd>
<dt id="P---print-url"><b>-P, --print-url</b></dt>
<dd>
<p>Print filename in URL format. This is useful if you want to check the layout immediately with your browser.</p>
<pre><code> % t2html --out --print-url page.txt | xargs lynx
--> file: /users/foo/txt/page.html</code></pre>
</dd>
<dt id="split-REGEXP"><b>--split REGEXP</b></dt>
<dd>
<p>Split document into smaller pieces when REGEXP matches. <i>Split commands are standalone</i>, meaning, that it starts and quits. No HTML conversion for the file is engaged.</p>
<p>If REGEXP is found from the line, it is a start point of a split. E.g. to split according to toplevel headings, which have no numbering, you would use:</p>
<pre><code> --split '^[A-Z]'</code></pre>
<p>A sequential numbers, 3 digits, are added to the generated partials:</p>
<pre><code> filename.txt-NNN</code></pre>
<p>The split feature is handy if you want to generate slides from each heading: First split the document, then convert each part to HTML and finally print each part (page) separately to printer.</p>
</dd>
<dt id="S1---split1"><b>-S1, --split1</b></dt>
<dd>
<p>This is shorthand of <b>--split</b> command. Define regexp to split on toplevel heading.</p>
</dd>
<dt id="S2---split2"><b>-S2, --split2</b></dt>
<dd>
<p>This is shorthand of <b>--split</b> command. Define regexp to split on second level heading.</p>
</dd>
<dt id="SN---split-named-files"><b>-SN, --split-named-files</b></dt>
<dd>
<p>Additional directive for split commands. If you split e.g. by headings using <b>--split1</b>, it would be more informative to generate filenames according to first few words from the heading name. Suppose the heading names where split occur were:</p>
<pre><code> Program guidelines
Conclusion</code></pre>
<p>Then the generated partial filenames would be as follows.</p>
<pre><code> FILENAME-program_guidelines
FILENAME-conclusion</code></pre>
</dd>
<dt id="X---xhtml"><b>-X, --xhtml</b></dt>
<dd>
<p>Render using strict XHTML. This means using <hr/>, <br/> and paragraphs use <p>..</p>.</p>
<p><code>Note: this option is experimental. See BUGS</code></p>
</dd>
</dl>
<h2 id="Miscellaneous-options">Miscellaneous options</h2>
<dl>
<dt id="debug-LEVEL"><b>--debug LEVEL</b></dt>
<dd>
<p>Turn on debug with positive LEVEL number. Zero means no debug.</p>
</dd>
<dt id="help--h"><b>--help -h</b></dt>
<dd>
<p>Print help screen. Terminates program.</p>
</dd>
<dt id="help-css"><b>--help-css</b></dt>
<dd>
<p>Print default CSS used. Terminates program. You can copy and modify this output and instruct to use your own with <b>--css-file=FILE</b>. You can also embed the option to files with <code>#T2HTML-OPTION</code> directive.</p>
</dd>
<dt id="help-html"><b>--help-html</b></dt>
<dd>
<p>Print help in HTML format. Terminates program.</p>
</dd>
<dt id="help-man"><b>--help-man</b></dt>
<dd>
<p>Print help page in Unix manual page format. You want to feed this output to <b>nroff -man</b> in order to read it. Terminates program.</p>
</dd>
<dt id="test-page"><b>--test-page</b></dt>
<dd>
<p>Print the test page: HTML and example text file that demonstrates the capabilities.</p>
</dd>
<dt id="time"><b>--time</b></dt>
<dd>
<p>Print to stderr time spent used for handling the file.</p>
</dd>
<dt id="v---verbose-LEVEL"><b>-v, --verbose [LEVEL]</b></dt>
<dd>
<p>Print verbose messages.</p>
</dd>
<dt id="q---quiet"><b>-q, --quiet</b></dt>
<dd>
<p>Print no footer at all. This option has different meaning if <i>--link-check</i> option is turned on: print only erroneous links.</p>
</dd>
<dt id="V---version"><b>V, --version</b></dt>
<dd>
<p>Print program version information.</p>
</dd>
</dl>
<h1 id="FORMAT-DESCRIPTION">FORMAT DESCRIPTION</h1>
<p>Program converts text files to HTML. The basic idea is to rely on indentation level, and the layout used is called 'Technical format' (TF) where only minimal conventions are used to mark italic, bold etc. text. The Basic principles can be demonstrated below. Notice the column poisiton ruler at the top:</p>
<pre><code> --//-- description start
123456789 123456789 123456789 123456789 123456789 column numbers
Heading 1 starts with a big letter at leftmost column 1
The column positions 1,2,3 are currently undefined and may not
format correctly. Do not place text at columns 1,2 or 3.
Heading level 2 starts at half-tab column 4 with a big letter
Normal but colored text at columns 5
Normal but colored text at columns 6
Heading 3 can be considered at position TAB minus 1, column 7.
"Special <em> text at column 7 starts with double quote"
Standard text starts at column 8, you can *emphatize* text or
make it _strong_ and write =SmallText= or +BigText+ show
variable name `ThisIsAlsoVariable'. You can `_*nest*_' `the'
markup. more txt in this paragraph txt txt txt txt txt txt
txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt
txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt
txt txt
Strong text at column 9
Column 10 is reserved for quotations
Column 10 is reserved for quotations
Column 10 is reserved for quotations
Column 10 is reserved for quotations
Strong text at column 11
Column 12 and further is reserved for code examples
Column 12 and further is reserved for code examples
All text here are surrounded by <pre> HTML codes
This CODE column in affected by the --css-code* options.
Heading 2 at column 4 again
If you want something like Heading level 3, use column 7 (bold)
Column 8. Standard tab position. txt txt txt txt txt txt txt
txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt
txt txt txt txt txt txt txt txt txt txt txt txt txt txt
[1998-09-10 Mr. Foo said]:
cited text at column 10. cited text cited text cited text
cited text cited text cited text cited text cited text
cited text cited text cited text cited text cited text
cited text
* Bullet at column 8. Notice 3 spaces after (*), so
text starts at half-tab forward at column 12.
* Bullet. txt txt txt txt txt txt txt txt txt txt txt txt
* Bullet. txt txt txt txt txt txt txt txt txt txt txt txt
,txt txt txt txt
Notice that previous paragraph ends to P-comma
code, it tells this paragraph to continue in
bullet mode, otherwise this text at column 12
would be interpreted as code section surrounded
by <pre> HTML codes.
. This is ordered list.
. This is ordered list.
. This is ordered list.
.This line starts with dot and is displayed in line by itself.
.This line starts with dot and is displayed in line by itself.
!! This adds an <hr> HTML code, text in line is marked with
!! <strong> <em>
Make this email address clickable <account@tt.com> Do not
make this email address clickable bar@example.com, because it
is only an example and not a real address. Notice that the
last one was not surrounded by <>. Common login names like
foo, bar, quux, or internet site 'example' are ignored
automatically.
Also do not make < this@example.com> because there is extra
white space. This may be more convenient way to disable email
addresses temporarily.
Heading1 again at column 0
Subheading at column 4
And regular text, column 8 txt txt txt txt txt txt txt txt txt
txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt txt
txt txt txt txt txt txt txt txt txt txt txt
--//-- description end</code></pre>
<p>That is it, there is the whole layout described. More formally the rules of text formatting are secribed below.</p>
<h2 id="USED-HEADINGS">USED HEADINGS</h2>
<ul>
<li><p>There are only <i>two</i> heading levels in this style. Heading columns are 0 and 4 and the heading must start with big letter ("Heading") or number ("1.0 Heading")</p>
</li>
<li><p>At column 4, if the text starts with small letter, that line is interpreted as <strong></p>
</li>
<li><p>A HTML <hr> mark is added just before printing heading at level 1.</p>
</li>
<li><p>The headings are gathered, the TOC is built and inserted to the beginning of HTML page. The HTML <name> references used in TOC are the first 4 sequential words from the headings. Make sure your headings are uniquely named, otherwise there will be same NAME references in the generated HTML. Spaces are converted into underscore when joining the words. If you can not write unique headings by four words, then you must use <b>--name-uniq</b> switch</p>
</li>
</ul>
<h1 id="TEXT-PLACEMENT-RULES">TEXT PLACEMENT RULES</h1>
<h2 id="General">General</h2>
<p>The basic rules for positioning text in certain columns:</p>
<ul>
<li><p>Text at column 1 is undefined if it does not start with big letter or number to indicate Heading level 1.</p>
</li>
<li><p>Text between columns 2 and 3 is marked with <em></p>
</li>
<li><p>Column 4 is reserved for heading level 2</p>
</li>
<li><p>Text between columns 5-7 is marked with <strong></p>
</li>
<li><p>Text at column 7 is <em> if the first character is double quote.</p>
</li>
<li><p>Column 10 is reserved for <em> text. If you want to quote someone or to add reference text, place the text in this column.</p>
</li>
<li><p>Text at columns 9 and 11 are marked with <strong></p>
</li>
</ul>
<p>Column 8 for text and special codes</p>
<ul>
<li><p>Column 8 is reserved for normal text</p>
</li>
<li><p>At the start of text, at column 8, there can be DOT-code or COMMA-code.</p>
</li>
</ul>
<p>Column 12 is special</p>
<ul>
<li><p>Column 12 is treated specially: block is started with <pre> and lines are marked as <samp></samp>. When the last text at <i>column</i> 12 is found, the block is closed with </pre>. An example:</p>
<pre><code> txt txt txt ;evenly placed block, fine, do it like this
txt txt
txt txt txt txt ;Can not terminate the /pre, because last
txt txt txt txt ;column is not at 12
txt txt txt txt
txt txt txt txt
txt txt txt txt
txt txt txt txt
;; Finalizing comment, now the text is evenly placed</code></pre>
</li>
</ul>
<h2 id="Additional-tokens-for-use-at-column-8">Additional tokens for use at column 8</h2>
<ul>
<li><p>If there is <code>.</code>(dot) at the beginning of a line and immediately non-whitespace, then <br> code is added to the end of line.</p>
<pre><code> .This line will have a <BR> HTML tag at the end.
While these two line are joined together
by the browser, depending on the frame width.</code></pre>
</li>
<li><p>If there is <code>,</code>(comma) then the <p> code is not inserted if the previous line is empty. If you use both <code>.</code>(dot) and <code>,</code>(comma), they must be in order dot-comma. The <code>,</code>(comma) works differently if it is used in bullet</p>
<p>A <p> is always added if there is separation of paragraphs, but when you are writing a bullet, there is a problem, because a bullet exist only as long as text is kept together</p>
<pre><code> * This is a bullet and it has all text ketp together
even if there is another line in the bullet.</code></pre>
<p>But to write bullets tat spread multiple paragraphs, you must instruct that those are to kept together and the text in next paragraph is not <sample> while it is placed at column 12</p>
<pre><code> * This is a bullet and it has all text ketp together
,even if there is another line in the bullet.
This is new paragrah to the previous bullet and this is
not a text sample. See continued COMMA-code above.
* This is new bullet
// and this is code sample after bullet
if ( $flag ) { ..do something.. }</code></pre>
</li>
</ul>
<h2 id="Special-text-markings">Special text markings</h2>
<dl>
<dt id="italic-bold-code-small-big-tokens">italic, bold, code, small, big tokens</dt>
<dd>
<pre><code> _this_ is interpreted as <strong class='word'>this</strong>
*this* is interpreted as <em class='word'>this</em>
`this' is interpreted as <sample class='word'>this</sample> `</code></pre>
<p>Exra modifiers that can be mixed with the above. Usually if you want bigger font, CAPITALIZE THE WORDS.</p>
<pre><code> =this= is interpreted as <span class="word-small">this</span>
+this+ is interpreted as <span class="word-big">this</span>
[this] is interpreted as <span class="word-ref">this</span></code></pre>
</dd>
<dt id="superscripting">superscripting</dt>
<dd>
<pre><code> word[this] is interpreted as superscript. You can use like
this[1], multiple[(2)] and almost any[(ab)] and
imaginable[IV superscritps] as long as the left
bracket is attached to the word.</code></pre>
</dd>
<dt id="subscripting">subscripting</dt>
<dd>
<pre><code> 12[[10]] is representation of value 12 un base 10.
This is interpreted as subscript. You can use like
this[[1]], multiple[[(2)]] and almost any[[(ab)]] and
imaginable[[IV superscritps]] as long as *two* left
brackets are attached to the word.</code></pre>
</dd>
<dt id="embedding-standard-HTML-tokens">embedding standard HTML tokens</dt>
<dd>
<p>Stanadard special HTML entities can be added inside text in a normal way, either using sybolic names or the hash code. Here are exmples:</p>
<pre><code> &times; &lt; &gt; &le; &ge; &ne; &radic; &minus;
&alpha; &beta; &gamma; &divide;
&laquo; &raquo; &lsaquo; &rsaquo; - &ndash; &mdash;
&asymp; &equiv; &sum; &fnof; &infin;
&deg; &plusmn;
&trade; &copy; &reg;
&euro; &pound; &yen;</code></pre>
</dd>
<dt id="embedding-PURE-HTML-into-text">embedding PURE HTML into text</dt>
<dd>
<p><b>This feature is highly experimental</b>. It is possible to embed pure HTML inside text in occasions, where e.g. some special formatting is needed. The idea is simple: you write HTML as usual but double every '<' and '>' characters, like:</p>
<pre><code> <<p>></code></pre>
<p>The other rule is that all PURE HTML must be kept together. There must be no line breaks between pure HTML lines. This is incorrect:</p>
<pre><code> <<table>>
<<tr>>one
<<tr>>two
<</table>></code></pre>
<p>The pure HTML must be written without extra newlines:</p>
<pre><code> <<table>>
<<tr>>one
<<tr>>two
<</table>></code></pre>
<p>This "doubling" affects normal text writing rules as well. If you write documents, where you describe Unix styled HERE-documents, you MUST NOT put the tokens next to each other:</p>
<pre><code> bash$ cat<<EOF # DON'T, this will confuse parser.
one
EOF</code></pre>
<p>You must write the above code example using spaces to prevent "<<" from interpreting as PURE HTML:</p>
<pre><code> bash$ cat << EOF # RIGHT, add spaces
one
EOF</code></pre>
</dd>
</dl>
<dl>
<dt id="drawing-a-short-separator">drawing a short separator</dt>
<dd>
<p>A !! (two exclamation marks) at text column (position 8) causes adding immediate <hr> code. any text after !! in the same line is written with <strong> <em> and inserted just after <hr> code, therefore the word formatting commands have no effect in this line.</p>
</dd>
</dl>
<h2 id="Http-and-email-marking-control">Http and email marking control</h2>
<ul>
<li><p>All http and ftp references as well as <foo@example.com> email addresses are marked clickable. Email must have surrounding <> characters to be recognized.</p>
</li>
<li><p>If url is preceded with hyphen, it will not be clickable. If a string foo, bar, quux, test, site is found from url, then it is not counted as clickable.</p>
<pre><code> <me@here.com> clickable
http://example.com clickable
< me@here.com> not clickable; contains space
<5dko56$1@news02.deltanet.com> Message-Id, not clickable
-http://example.com hyphen, not clickable
http://$EXAMPLE variable. not clickable</code></pre>
</li>
</ul>
<h2 id="Lists-and-bullets">Lists and bullets</h2>
<ul>
<li><p>The bulletin table is constructed if there is "o" or "*" at column 8 and 3 spaces after it, so that text starts at column 12. Bulleted lines are advised to be kept together; no spaces between bullet blocks.</p>
<pre><code> * This is a bullet
* This is a bullte</code></pre>
<p>Another example:</p>
<pre><code> o This is a bullet
o This is a bullet</code></pre>
<p>List example:</p>
<pre><code> . This is an ordered list
. This is an ordered list</code></pre>
</li>
<li><p>The ordered list is started with ".", a dot, and written like bullet where text starts at column 12.</p>
</li>
</ul>
<h2 id="Line-breaks">Line breaks</h2>
<ul>
<li><p>All line breaks are visible in your document, do not use more than one line break to separate paragraphs.</p>
</li>
<li><p>Very important is that there is only <i>one</i> line break after headings.</p>
</li>
</ul>
<h1 id="EMBEDDED-DIRECTIVES-INSIDE-TEXT">EMBEDDED DIRECTIVES INSIDE TEXT</h1>
<dl>
<dt id="Command-line-options">Command line options</dt>
<dd>
<p>You can cancel obeying all embedded directives by supplying option <b>--not2html-tags</b>.</p>
<p>You can include these lines anywhere in the document and their content is included in HTML output. Each directive line must fit in one line and it cannot be broken to separate lines.</p>
<pre><code> #T2HTML-TITLE <as passed option --title>
#T2HTML-EMAIL <as passed option --email>
#T2HTML-AUTHOR <as passed option --author>
#T2HTML-DOC <as passed option --doc>
#T2HTML-METAKEYWORDS <as passed option --meta-keywords>
#T2HTML-METADESCRIPTION <as passed option --meta-description></code></pre>
<p>You can pass command line options embedded in the file. Like if you wanted the CODE section (column 12) to be coloured with shade of gray, you could add:</p>
<pre><code> #T2HTML-OPTION --css-code-bg</code></pre>
<p>Or you could request turning on particular options. Notice that each line is exactly as you have passed the argument in command line. Imagine surrounding double quoted around lines that are arguments to the associated options.</p>
<pre><code> #T2HTML-OPTION --as-is
#T2HTML-OPTION --quiet
#T2HTML-OPTION --language
#T2HTML-OPTION en
#T2HTML-OPTION --css-font-type
#T2HTML-OPTION Trebuchet MS
#T2HTML-OPTION --css-code-bg
#T2HTML-OPTION --css-code-note
#T2HTML-OPTION (?:Note|Notice|Warning):</code></pre>
<p>You can also embed your own comments to the text. These are stripped away:</p>
<pre><code> #T2HTML-COMMENT You comment here
#T2HTML-COMMENT You another comment here</code></pre>
</dd>
<dt id="Embedding-files">Embedding files</dt>
<dd>
<p>#INCLUDE- command</p>
<p>This is used to include the content into current current position. The URL can be a filename reference, where every $VAR is substituted from the environment variables. The tilde(~) expansion is not supported. The included filename is operating system supported path location.</p>
<p>A prefix <code>raw:</code> disables any normal formatting. The file content is included as is.</p>
<p>The URL can also be a HTTP reference to a remote location, whose content is included at the point. In case of remote content or when filename ends to extension <code>.html</code> or <code>.html</code>, the content is stripped in order to make the inclusion of the content possible. In picture below, only the lines within the BODY, marked with !!, are included:</p>
<pre><code> <html>
<head>
...
</head>
<body>
this text !!
and more of this !!
</body>
</html></code></pre>
<p>Examples:</p>
<pre><code> #INCLUDE-$HOME/lib/html/picture1.html
#INCLUDE-http://www.example.com/code.html
#INCLUDE-raw:example/code.html</code></pre>
</dd>
<dt id="Embedding-pictures">Embedding pictures</dt>
<dd>
<p>#PIC command is used to include pictures into the text</p>
<pre><code> #PIC picture.png#Caption Text#Picture HTML attributes#align#
(1) (2) (3) (4)
1. The NAME or URL address of the picture. Like image/this.png
2. The Text that appears below picture
3. Additional attributes that are attached inside <img> tag.
For <img width="200" height="200">, the line would
read:
#PIC some.png#Caption Text#width=200 length=200##
4. The position of image: "left" (default), "center", "right"</code></pre>
<p>Note: The <code>Caption Text</code> will also become the ALT text of the image which is used in case the browser is not capable of showing pictures. You can suppress the ALT text with option <b>--no-picture-alt</b>.</p>
</dd>
<dt id="Fragment-identifiers-for-named-tags">Fragment identifiers for named tags</dt>
<dd>
<p>#REF command is used for referring to HTML <name> tag inside current document. The whole command must be placed on one single line and cannot be broken to multiple lines. An example:</p>
<pre><code> #REF #how_to_profile;(Note: profiling);
(1) (2)
1. The NAME HTML tag reference in current document, a single word.
This can also be a full URL link.
You can get NAME list by enabling --toc-url-print option.
2. The clickable text is delimited by ; characters.</code></pre>
</dd>
<dt id="Referring-to-external-documents">Referring to external documents.</dt>
<dd>
<p><code>#URL</code> tag can be used to embed URLs inline, so that the full link is not visible. Only the shown text is used to jump to URL. This directive cannot be broken to separate lines,</p>
<pre><code> #URL<FULL-URL><embedded inline text>
| |
| Displayed, clickable, text
Must be kept together</code></pre>
<p>An example:</p>
<pre><code> See search engine #URL<http://www.google.com><Google></code></pre>
</dd>
</dl>
<h1 id="TABLE-OF-CONTENT-HEADING">TABLE OF CONTENT HEADING</h1>
<p>If there is heading 1, which is named exactly "Table of Contents", then all text up to next heading are discarded from the generated HTML file. This is done because program generates its own TOC. It is supposed that you use some text formatting program to generate the toc for you in .txt file and you do not maintain it manually. For example Emacs package <i>tinytf.el</i> can be used.</p>
<h1 id="TROUBLESHOOTING">TROUBLESHOOTING</h1>
<h2 id="Generated-HTML-document-did-not-look-what-I-intended">Generated HTML document did not look what I intended</h2>
<p>Did you use editor that inseted TABs which inserts single ascii code (\t) and 8 spaces? check our editor's settings and prefer writing in-all-space format.</p>
<p>The most common mistake is that there are extra newlines in the document. Keeep <i>one</i> empty line between headings and text, keep <i>one</i> empty line between paragraphs, keep <i>one</i> empty line between body text and bullet. Make it your mantra: <i>one</i> <i>one</i> <i>one</i> ...</p>
<p>Next, you may have put text at wrong column position. Remember that the regular text is at column 8.</p>
<p>If generated HTML suddendly starts using only one font, eg <pre>, then you have forgot to close the block. Make it read even, like this:</p>
<pre><code> Code block
Code block
Code block
;; Add empty comment here to "close" the code example at column 12</code></pre>
<p>Headings start with a big letter or number, likein "Heading", not "heading". Double check the spelling.</p>
<h1 id="EXAMPLES">EXAMPLES</h1>
<p>To print the test page and demonstrate possibilities:</p>
<pre><code> t2html --test-page</code></pre>
<p>To make simple HTML page without any meta information:</p>
<pre><code> t2html --title "Html Page Title" --author "Mr. Foo" \
--simple --out --print file.txt</code></pre>
<p>If you have periodic post in email format, use <b>--delete-email-headers</b> to ignore the header text:</p>
<pre><code> t2html --out --print --delete-email-headers page.txt</code></pre>
<p>To make page fast</p>
<pre><code> t2html --out --print page.txt</code></pre>
<p>To convert page from a text document, including meta tags, buttons, colors and frames. Pay attention to switch <i>--html-body</i> which defines document language.</p>
<pre><code> t2html \
--print \
--out \
--author "Mr. foo" \
--email "foo@example.com" \
--title "This is manual page of page BAR" \
--html-body LANG=en \
--button-prev previous.html \
--button-top index.html \
--buttion-next next.html \
--document http://example.com/dir/this-page.html \
--url manual.html \
--css-code-bg \
--css-code-note '(?:Note|Notice|Warning):' \
--html-frame \
--disclaimer-file $HOME/txt/my-html-footer.txt \
--meta-keywords "language-en,manual,program" \
--meta-description "Bar program to do this that and more of those" \
manual.txt</code></pre>
<p>To check links and print status of all links in par with the http error message (most verbose):</p>
<pre><code> t2html --link-check file.txt | tee link-error.log</code></pre>
<p>To print only problematic links:</p>
<pre><code> t2html --link-check --quiet file.txt | tee link-error.log</code></pre>
<p>To print terse output in egep -n like manner: line number, link and error code:</p>
<pre><code> t2html --link-check-single --quiet file.txt | tee link-error.log</code></pre>
<p>To check links from multiple pages and cache good links to separate file, use <b>--link-cache</b> option. The next link check will run much faster because cached valid links will not be fetched again. At regular intervals delete the link cache file to force complete check.</p>
<pre><code> t2html --link-check-single \
--link-cache $HOME/tmp/link.cache \
--quiet file.txt</code></pre>
<p>To split large document into pieces, and convert each piece to HTML:</p>
<pre><code> t2html --split1 --split-name file.txt | t2html --simple --out</code></pre>
<h1 id="ENVIRONMENT">ENVIRONMENT</h1>
<dl>
<dt id="EMAIL"><b>EMAIL</b></dt>
<dd>
<p>If environment variable <i>EMAIL</i> is defined, it is used in footer for contact address. Option <b>--email</b> overrides environment setting.</p>
</dd>
<dt id="LANG"><b>LANG</b></dt>
<dd>
<p>The default language setting for switch <code>--language</code> Make sure the first two characters contains the language definition, like in: LANG=en.iso88591</p>
</dd>
</dl>
<h1 id="SEE-ALSO">SEE ALSO</h1>
<p>asciidoc(1) html2ps(1) htmlpp(1) markdown(1)</p>
<h2 id="Related-programs">Related programs</h2>
<p>Jan K�rrman <jan@tdb.uu.se> has written Perl html2ps which was 2004-11-11 available at http://www.tdb.uu.se/~jan/html2ps.html</p>
<p>HTML validator is at http://validator.w3.org/</p>
<p>iMATIX created htmlpp which is available from http://www.imatix.com and seen 2014-03-05 at http://legacy.imatix.com/html/htmlpp</p>
<p>Emacs minor mode to help writing documents based on TF layout is available. See package tinytf.el in project http://freecode.com/projects/emacs-tiny-tools</p>
<h2 id="Standards">Standards</h2>
<p>RFC <b>1766</b> contains list of language codes at http://www.rfc.net/</p>
<p>Latest HTML/XHTML and CSS specifications are at http://www.w3c.org/</p>
<h2 id="ISO-standards">ISO standards</h2>
<p><b>639</b> Code for the representation of the names of languages http://www.oasis-open.org/cover/iso639a.html</p>
<p><b>3166</b> Standard Country Codes http://www.niso.org/3166.html and http://www.netstrider.com/tutorials/HTMLRef/standards/</p>
<h1 id="BUGS">BUGS</h1>
<p>The implementation was originally designed to work linewise, so it is unfortunately impossible to add or modify any existing feature to look for items that span more than one line.</p>
<p>As the options <b>--xhtml</b> was much later added, it may not produce completely syntactically valid markup.</p>
<h1 id="SCRIPT-CATEGORIES">SCRIPT CATEGORIES</h1>
<p>CPAN/Administrative html</p>
<h1 id="PREREQUISITES">PREREQUISITES</h1>
<p>No additional Perl CPAN modules needed for text to HTML conversion.</p>
<h1 id="COREQUISITES">COREQUISITES</h1>
<p>If link check feature is used to to validate URL links, then following modules are needed from Perl CPAN <code>use LWP::UserAgent</code> <code>HTML::FormatText</code> and <code>HTML::Parse</code></p>
<p>If you module <code>HTML::LinkExtractor</code> is available, it is used instead of included link extracting algorithm.</p>
<h1 id="AVAILABILITY">AVAILABILITY</h1>
<p>Homepage is at http://freecode.com/projects/perl-text2html</p>
<h1 id="AUTHOR">AUTHOR</h1>
<p>Copyright (C) 1996-2016 <jari.aalto@cante.net></p>
<p>This program is free software; you can redistribute and/or modify program under the terms of GNU General Public license either version 2 of the License, or (at your option) any later version.</p>
<p>This documentation may be distributed 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).</p>
</body>
</html>
|