home *** CD-ROM | disk | FTP | other *** search
/ Hot Shareware 32 / hot34.iso / ficheros / DINET / H2T150B.ZIP / HTML2TXT.TXT < prev    next >
Text File  |  1998-04-03  |  56KB  |  933 lines

  1.                             -= HTML2TEXT v1.50 =-
  2.  
  3.  
  4.                                        
  5.                                        
  6.                                HTML2TEXT v1.50
  7.                                        
  8.                         1997-1998 (c) Gavin Spearhead
  9.                                        
  10. ─────────────────────────────────────────────────────────────────────────────
  11.  
  12.   I. What is it?
  13.     
  14.     HTML2TEXT is a utility that converts HTML files to plain text. Optionally
  15.     it also tries to figure out if the HTML file is well-constructed.
  16.     
  17.     
  18.   II. What's the legal stuff?
  19.     
  20.     All Rights Reserved.
  21.     
  22.     Permission to use, copy, and distribute this software and its
  23.     documentation for any purpose and without fee is hereby granted, provided
  24.     that the above copyright notice appear in all copies and that both that
  25.     copyright notice and this permission notice appear in supporting
  26.     documentation, and that the name Gavin Spearhead not be used in
  27.     advertising or publicity pertaining to distribution of the software
  28.     without specific, written prior permission.
  29.     
  30.                                 *** DISCLAIMER ***
  31.     
  32.     GAVIN SPEARHEAD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  33.     INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  34.     EVENT SHALL GAVIN SPEARHEAD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  35.     CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  36.     USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  37.     OTHER TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  38.     PERFORMANCE OF THIS SOFTWARE.
  39.     
  40.                                        ***
  41.     
  42.     
  43.   III. General information
  44.     
  45.     This documentation is written in HTML format in way that it is readable in
  46.     a text viewer as good as possible and as long as the HTML format allows
  47.     it. A to-text-converted version is also included.
  48.     
  49.     All my documentations are, since about June 1997, written in HTML. Prior
  50.     to that date they were written in plain text. This means a) that I can put
  51.     them on the big web, b) they're readable at all time and c) at all
  52.     machines that have a browser for it and d) they're easily converted to
  53.     other formats, such as Postscript, Wordperfect and of course plain-text e)
  54.     I can easily make formatted documentations.
  55.     
  56.     Any bugs, errors, suggestions, thought, ideas, etc should be sent to the
  57.     author, these also includes errors in the documentation. Also the
  58.     existence of not supported HTML-tags or entity sequences can be sent to
  59.     the author, along with a description, restrictions and options. No matter
  60.     how puny or important your help is, I need your help to improve this
  61.     program. 
  62.     If you want to become a beta tester of this program contact me and I'll
  63.     send you the details. Unfortunately I cannot give rewards other then
  64.     gratitude.
  65.     
  66.     You are encouraged to register this piece of software. This means that you
  67.     will either receive the latest version when it is released or a note that
  68.     a new version is released. It also gives me an idea about how many people
  69.     use this program and how it's spread. The information provided to register
  70.     will not be used for other purpose then HTML2TEXT and by any other persons
  71.     other then me.
  72.     There are three ways to register: 
  73.       i. Start your web-browser and fill in the form. 
  74.       ii. Convert register.htm to a text file, edit it to fill in the
  75.         entries and email it to me. 
  76.       iii. Same as above but print it and send it to my postal address. 
  77.     Be sure to enter the correct email address on the form! If not I might not
  78.     be able to send you the registration key.
  79.     
  80.     Note that registration is Free of charge!
  81.     
  82.     When you're registered you will become a private registration key, so that
  83.     your name is written when you execute the program instead of Unregistered.
  84.     However no other function will be available in the registered version. In
  85.     other words the unregistered version is not crippled This file will be
  86.     sent via email if possible. This is currently the only way to receive the
  87.     registration key. When you order (see below) you will automatically be
  88.     registered and the key can be found on the disk.
  89.     
  90.     
  91.   IV. Which files are contained in the package?
  92.     
  93.     
  94.     HTML2TXT.EXE  The executable.                                           
  95.     HTML2TXT.CFG  Configuration file with options.                          
  96.     HTML2TXT.INI  Ini-file with entity references.                          
  97.     HTML2TXT.HTM  Documentation for HTML2TEXT in HTML format.               
  98.     HTML2TXT.TXT  Documentation for HTML2TEXT in plain text format.         
  99.     REGISTER.HTM  Registration form in HTML format.                         
  100.     LONGFILE.BTM  4DOS batch file to convert HTML files which does support  
  101.                   Windows 95 long filenames.                                
  102.     
  103.     If one of the files is missing, throw the package away and ask the author
  104.     for a new and complete copy. The address is at the end of the file.
  105.     
  106.     
  107.   V. What does it do?
  108.     
  109.     HTML2TEXT converts HyperText Mark-up Language (HTML) files to plain-text
  110.     (ASCII) files. The following rules are applies for this: 
  111.       * The title is optionally displayed on the first line of the output
  112.         file. Optionally the complete filename plus path are written too. 
  113.       * Entity references (&...;) are converted to character sequences
  114.         according to the input file or pre-programmed characters. 
  115.       * Any tags will perform the task according to the HTML specification
  116.         as good as possible, note that some tags cannot have any output in
  117.         plain ASCII text files (eg. blinking, fonts, colours). 
  118.       * Newlines and tabs are converted to spaces and are removed if
  119.         obsolete, as are spaces. 
  120.       * Lines are written and justified according to settings, lines are
  121.         wrapped by words when they are too long. Word delimiters are
  122.         user-definable. 
  123.       * Tables are reformatted and forms are output so that they can be
  124.         filled in after conversion. The output of forms is highly
  125.         user-specifiable. 
  126.       * Warnings are generated on ill-constructed tags or entity references.
  127.         
  128.     
  129.     
  130.   VI. How to start it?
  131.     
  132.     A quick start instruction is to type on the commandline:
  133.       HTML2TXT file.htm
  134.     This will convert the file "file.htm" to "file.txt".
  135.     
  136.     The full syntax of HTML2TEXT is:
  137.     
  138.       HTML2TXT <filespecification> @<listfile> <options>
  139.     
  140.     <Filespecification> is the name of the files to convert, it may include
  141.     wildcards (* and ?). More than one file specification may appear on the
  142.     command line. Note that long filenames (Windows 95/NT) are not supported.
  143.     This means that input filenames have to be of the 8.3 format (Every W95/NT
  144.     file has a 8.3 filename and optionally a long filename). The output will
  145.     always be a 8.3 filename. 4DOS users (v5.5+) can use the %@SFN[...]
  146.     function to get the short filename of a long filename (see 4DOS
  147.     documentation for details). A 4DOS batch file is also included to perform
  148.     conversion of files with long filenames, see below. Windows 95 users can
  149.     drag and drop files to the executable, Windows then uses the short
  150.     filename anyway.
  151.     
  152.     @<listfile> is a name of a file that contains the names of files to
  153.     convert. The <listfile> may not contain wildcards. Each of these filenames
  154.     must appear on a single line. Empty lines are permitted and files may have
  155.     leading or trailing whitespace characters. The names of these files have
  156.     the same restrictions as the files from the <filespecification>. You
  157.     cannot use options in a listfile.
  158.     
  159.     <options> can be the following:
  160.     
  161.     -a-         Do not display text for links.                              
  162.     -b-         Do not mark bold text.                                      
  163.     -b+         Mark bold text by embracing it with stars (*).              
  164.     -b:<chars>  Specifies the two characters used to mark bold text.        
  165.                 Exactly two characters have to be given.                    
  166.     -B-         Don't print borders for tables.                             
  167.     -B:<num>    Use predefined border <num>, where <num> is                 
  168.                   1. 7 bit ASCII (using -|+)                                
  169.                   2. Single lines                                           
  170.                   3. Double lines                                           
  171.                   4. Double horizontal lines and single vertical lines      
  172.                   5. Single horizontal lines and double vertical lines      
  173.                   6. Single frame only                                      
  174.                   7. Double frame only                                      
  175.                   8. Double frame, single cell separators                   
  176.                   9. Single frame, double cell separators                   
  177.                 For a graphical example of those tables look at the config  
  178.                 file.                                                       
  179.     -c          Automatically create directory when the specified output    
  180.                 path does not exist.                                        
  181.     -c-         Ask to create when the specified output path does not       
  182.                 exist.                                                      
  183.     -C:<num>    Sets the charset to use. <num> can be any number from 1 to  
  184.                 9. By default one is chosen, except when windows is         
  185.                 detected (in enhanced mode, but who cares) then the         
  186.                 default is 3.                                               
  187.                 1 : ASCII (7 bit)                                           
  188.                 2 : Extended ASCII (8 bit)                                  
  189.                 3 : Windows ISO 8859/1                                      
  190.                 4-9: user definable                                         
  191.                                                                             
  192.     -f          Get input from standard input, then read the files          
  193.                 specified. Input from standard input will be converted and  
  194.                 then output to standard output.                             
  195.     -f-         Only read the files specified.                              
  196.     -F-         Do not display input fields in forms.                       
  197.     -h          Do not display HTML2TEXT messages. (hush)                   
  198.     -h-         Do display HTML2TEXT messages.                              
  199.     -H          Stop after reading </html>.                                 
  200.     -H-         Continue after reading </html>.                             
  201.     -i-         Do not mark italic text.                                    
  202.     -i+         Mark italic text by embracing it with slashes (/).          
  203.     -i:<chars>  Specifies the two characters used to mark italic text.      
  204.                 Exactly two characters have to be given.                    
  205.     -I-         Don't display any text for images.                          
  206.     -l:<chars>  Specifies the characters used for list elements of          
  207.                 unordered lists. The first is for the type Square, the      
  208.                 second for Disc and the third for Circle. None of the       
  209.                 three may be omitted.                                       
  210.     -L:<char>   Specifies the character to use for filling up empty spaces  
  211.                 in text fields of forms.                                    
  212.     -m          Mark errors in the output file.                             
  213.     -m-         Do not mark errors in the output file.                      
  214.     -N          Display the full path of the converted file in the output.  
  215.     -N-         Do not display the full path of the converted file in the   
  216.                 output.                                                     
  217.     -o:<char>   Controls the overwriting policy for existing files <char>   
  218.                 can be one of the following:                                
  219.                   * A: Always overwrite                                     
  220.                   * V: Never overwrite                                      
  221.                   * D: Always append                                        
  222.                 No suffix means that the user will be asked.                
  223.     -O-         Don't use a log file.                                       
  224.     -O+         Use a log file. If none is specified previously             
  225.                 HTML2TXT.LOG will be used.                                  
  226.     -O:<File>   Use <File> as a log file.                                   
  227.     -p:<num>    Set the indenting for lists to <num>.                       
  228.     -P-         Do not display a progress indicator                         
  229.     -P+         Display a progress indicator. In the upper left corner a    
  230.                 wheel will be shown                                         
  231.     -q          Treat balancing of quotes strictly.                         
  232.     -q-         Treat balancing of quotes relaxed. A '>' always ends a      
  233.                 tag.                                                        
  234.     -s          Output will be redirected to standard output.               
  235.     -s-         Files will be used for output, the output filename will be  
  236.                 derived from the output path and the filename entered.      
  237.     -S          Stretch tables to the full width of the page. This looks    
  238.                 neat when you've more short tables with similar data.       
  239.     -S-         Do not stretch tables to the full width of the page. The    
  240.                 width of the table is the minimum width required.           
  241.     -t          Reformat tables.                                            
  242.     -t-         Simple table conversion. Just insert a number of spaces     
  243.                 between elements.                                           
  244.     -T          Display the title in the output file as -= <title> =-.      
  245.     -T2         The same as -T but omits the -= and =-.                     
  246.     -T-         Do not display any title.                                   
  247.     -u-         Do not mark underlined text.                                
  248.     -u+         Mark underlined text by embracing it with underscores (_).  
  249.     -u:<chars>  Specifies the two characters used to mark underlined text.  
  250.                 Exactly two characters have to be given.                    
  251.     -v          Display version info.                                       
  252.     -w          Warn for HTML-errors in the source file.                    
  253.     -w-         Do not warn for HTML-errors in the source file.             
  254.     -W:<num>    Set the line length to <num>. Maximum line length is 255.   
  255.     -W-         No line wrapping will be performed.                         
  256.     -W          Set line length to the screenwidth (usually 80).            
  257.     -y-         Do not use hyphenation.                                     
  258.     -?          Displays short a help.                                      
  259.     
  260.     I know the program suffers from creeping featuritis!
  261.     
  262.     WARNING
  263.     Most options are different from the options of the previous versions of
  264.     HTML2TEXT. This was necessary to maintain some logic in the naming of the
  265.     options, which have increased immensely in number. Otherwise the
  266.     characters used would be quite cryptic. Please read the section above
  267.     carefully. And options are now case-sensitive.
  268.     
  269.     You can concatenate options to save space. Except -O:<File> which must be
  270.     the last. Better use the config file to set this variable.
  271.     
  272.     The result file will have the same name as the original file, but with the
  273.     extension specified in the config-file (default is .txt), unless the
  274.     original extension was the same as the extension of the output file, then
  275.     the extension will be `.tx1' (always).
  276.     
  277.     All messages are written to standard error, unless hush is set. 4DOS users
  278.     can also redirect standard error or use the Windows clipboard by the
  279.     device `clip:'.
  280.     
  281.     
  282.   VII. Can I use another way to specify options?
  283.     
  284.     Yes, you can. There are two other ways to specify the options. First of
  285.     all you can use the HTML2TXT.CFG file (see next section). And second you
  286.     can use the environment variable H2T_SW. You can set all options in this
  287.     variable.
  288.      Eg. set H2T_SW=-b-u-T2
  289.     will switch marking of underlined text and bold text off and switch the
  290.     title to setting 2. The leading `-' can be omitted. 
  291.     
  292.     
  293.   VIII. What do the files HTML2TXT.INI & HTML2TXT.CFG do?
  294.     
  295.     
  296.       * HTML2TXT.INI
  297.         
  298.         This file contains the translation table for ampersand sequences also
  299.         known as entity references, ie. a sequence of characters of the form:
  300.         &some_text;. The lines are of following format: 
  301.         <identifier>="<result>" 
  302.         Where the <identifier> is the text between the `&' and the `;'.
  303.         <result> is the text that will replace entity reference. The quotes
  304.         are optional. The text can contain escape sequences (C-style) of the
  305.         format \<char> where <char> can be: 
  306.           # s : a space 
  307.           # n : a newline 
  308.         
  309.         Or of the format \<number> then the character which ASCII value equals
  310.         <number> is inserted. Every other character is literally insert,
  311.         including quotes and bashes.
  312.         
  313.         entity references of the format &#nnn; not specified in the
  314.         config-file will be converted to the ASCII value nnn, as are entity
  315.         references of the format &#xnn;, the hexadecimal representation.
  316.         
  317.         
  318.       * HTML2TXT.CFG 
  319.         
  320.         This file contains the various options that can be set. These are all
  321.         eloquently commented in the file itself. So take a peek at that file.
  322.         
  323.         Beware that some options have side effects, eg. turning off line
  324.         wrapping means also that text will not be centered.
  325.         
  326.         In both files any line starting with a semicolon (;) is treated as
  327.         comments and thus ignored. In the config-file lines starting with a
  328.         double cross (#) are also treated as comments.
  329.         
  330.         Both files will be sought for in the current directory first and then
  331.         the directory from where HTML2TEXT was started. Usually these files
  332.         will be placed in the same directory as HTML2TXT.EXE, a directory in
  333.         your path. The path to ini-file can also be specified in the
  334.         config-file, if so it will be sought there first.
  335.         
  336.         
  337.   IX. What is the order of reading options?
  338.     
  339.     When HTML2TEXT starts all options are set to the default value. Then the
  340.     HTML2TXT.CFG file is read. Next the environment variable H2T_SW is read
  341.     and finally the commandline options are read. This means that any
  342.     redefining of options will overwrite the previous settings.
  343.     
  344.     
  345.   X. Which tags does it recognise?
  346.     
  347.     
  348.     Tag         What it does in HTML2TEXT                                   
  349.     A           Checks optionally link_text or name_text is written         
  350.                 contrary to previous versions, this one always needs a      
  351.                 closing tag.                                                
  352.     ABBR        Checks.                                                     
  353.     ADDRESS     See tag: I.                                                 
  354.     APPLE       Checks, ignores text between <APPLET></APPLET>.             
  355.     AREA        Ignores.                                                    
  356.     B           Checks, Optionally writes BOLD-token.                       
  357.     BASE        Ignores.                                                    
  358.     BASEFONT    Ignores.                                                    
  359.     BDO         Checks.                                                     
  360.     BGSOUND     Ignores.                                                    
  361.     BIG         Checks.                                                     
  362.     BLINK       Checks.                                                     
  363.     BLOCKQUOTE  Checks, indents.                                            
  364.     BODY        Checks.                                                     
  365.     BR          Writes a newline.                                           
  366.     BUTTON      Writes a button and uses button_text.                       
  367.     CAPTION     Determines a caption for tables, Checks.                    
  368.     COLGROUP    Ignores.                                                    
  369.     CENTER      Checks, centers when linewrap is on.                        
  370.     CITE        see tag: I.                                                 
  371.     CODE        See tag: Pre.                                               
  372.     COL         Checks.                                                     
  373.     COMMENT     Ignores anything between <COMMENT></COMMENT>,. Checks.      
  374.     DD          Inserts newline and indents.                                
  375.     DEL         Checks.                                                     
  376.     DFN         See tag: I.                                                 
  377.     DIR         See tag: OL.                                                
  378.     DIV         Checks, writes a newline at both open and close tag.        
  379.     DL          Starts a definition list, Checks.                           
  380.     DT          Inserts a newline.                                          
  381.     EM          see tag: I.                                                 
  382.     EMBED       Ignores.                                                    
  383.     FIELDSET    Checks.                                                     
  384.     FRAME       Ignores.                                                    
  385.     FRAMESET    Checks.                                                     
  386.     FONT        Checks.                                                     
  387.     FORM        Checks.                                                     
  388.     H           Checks.                                                     
  389.     HD1         Writes the text to screen with embracing newlines.          
  390.     HD2                                                                     
  391.     HD3                                                                     
  392.     HD4                                                                     
  393.     HD5                                                                     
  394.     HD6                                                                     
  395.     HEAD        Checks.                                                     
  396.     HR          Writes a line of `='s in case size >3 or else a line of     
  397.                 `-'s. The length is absolute or relative set according to   
  398.                 the width value.                                            
  399.     HTML        Everything after </HTML> is optionally ignored, Checks.     
  400.     I           Checks, Optionally writes ITALIC-token.                     
  401.     IFRAME      Checks.                                                     
  402.     IMG         Ignored, Optionally writes image_text.                      
  403.     INPUT       Ignored.                                                    
  404.     ISINDEX     Write a prompt plus optionally [ Input ].                   
  405.     KBD         See B.                                                      
  406.     LI          Writes a list element identifier, for ULs a * or specified  
  407.                 in config-file, for OL a number, parameter type and value   
  408.                 used.                                                       
  409.     LEGEND      Checks.                                                     
  410.     LINK        Ignores.                                                    
  411.     LISTING     See tag: Pre.                                               
  412.     MAP         Checks.                                                     
  413.     MARQUEE     Checks.                                                     
  414.     MENU        See tag: OL.                                                
  415.     META        Ignores.                                                    
  416.     NEXTID      Ignores.                                                    
  417.     NOBR        Checks.                                                     
  418.     NOFRAMES    Checks.                                                     
  419.     NOSCRIPT    Checks.                                                     
  420.     OBJECT      Checks.                                                     
  421.     OL          An ordered list, Checks, type parameter used.               
  422.     OPTION      Ignores.                                                    
  423.     OPTGROUP    Checks.                                                     
  424.     P           Starts a new paragraph and adjusts alignment.               
  425.     PARAM       Ignores.                                                    
  426.     PRE         Output as is, Checks (line wrap is not ignored, if on).     
  427.     Q           Checks.                                                     
  428.     S           see tag: strike.                                            
  429.     SAMP        Checks.                                                     
  430.     SCRIPT      Ignores anything between <SCRIPT></SCRIPT>, Checks.         
  431.     SELECT      Checks.                                                     
  432.     SMALL       Checks.                                                     
  433.     SOUND       Ignores.                                                    
  434.     SPACER      Ignores.                                                    
  435.     SPAN        Checks.                                                     
  436.     STRIKE      Checks.                                                     
  437.     STRONG      See tag: B.                                                 
  438.     STYLE       This is treated as it were a comment. Technically it sets   
  439.                 info on various colours, etc.                               
  440.     SUB         Checks.                                                     
  441.     SUP         Checks.                                                     
  442.     TABLE       Checks, starts/finishes a table.                            
  443.     TBODY       Checks.                                                     
  444.     TD          Defines a table cell.                                       
  445.     TEXTAREA    Ignores.                                                    
  446.     TFOOT       Checks.                                                     
  447.     THEAD       Checks.                                                     
  448.     TH          Defines a table header cell.                                
  449.     TITLE       Writes the title, if within <HEAD></HEAD>, Checks.          
  450.     TR          Defines a table row.                                        
  451.     TT          Checks.                                                     
  452.     U           Checks.                                                     
  453.     UL          An unordered list, Checks, type parameter used.             
  454.     VAR         See tag: Pre.                                               
  455.     WBR         Ignores.                                                    
  456.     !DOCTYPE    Ignores.                                                    
  457.     
  458.     These are all the tags from the HTML-specification version 4.0. Not all
  459.     are currently fully implemented although most are. Also included are some
  460.     browser specific tags, for either Netscape as Microsoft Internet Exploder.
  461.     The full specification of HTML can be found here.
  462.     
  463.     Here Checks means that for every open tag a matching closing tag is
  464.     sought. In most cases the order of the closing tags are not relevant, but
  465.     sometimes the output will be unexpected when tags are closed in the wrong
  466.     order.
  467.     
  468.     Here Ignores means that the tag is just ignored, no output is generated
  469.     and no checks are performed. Mostly these will be tag that set options to
  470.     the output that have no meaning in plain text files. What would a client
  471.     side map, for example do in a text file?
  472.     
  473.     Some tags may have optional closing tags, these are ignored and not
  474.     checked. Eg. <tr>,<td>,<th>,<p>. Changed from previous versions is that
  475.     the anchor tag (<a ...>) now always needs a closing tag, although for most
  476.     name definitions these are usually left out. Some of those tags need a
  477.     closing tag (preceded by a slash), these will be checked, if the tag was
  478.     opened before. It will also be checked if those tags are closed in the
  479.     right order. Furthermore is checked that tags are not nested if not
  480.     necessary (eg. bold), this might indicate a missing slash in the tag in
  481.     the second tag. Lots of tags are simply ignored and thus generate no
  482.     output. Some tags optionally generate output. Any text after </html> is
  483.     optionally ignored. Mainly to prevent garbage output. Some tags cause the
  484.     following text to be ignored until a closing tag appears.
  485.     
  486.     Unknown tags are ignored and optionally a message is generated.
  487.     
  488.     Note that this just specifies the actions taken by HTML2TEXT and not what
  489.     the HTML specification says about tags, however I have tried to implement
  490.     the tags close to the specification as possible.
  491.     
  492.     Tables generate the following output. Every table row is written on at
  493.     least one line, and every row yields a linefeed. Table columns are
  494.     separated by at least one space or other cell separator. Some options are
  495.     implemented for tables, but currently do not all work very well, a row can
  496.     only be affected by at most one rowspan and one colspan. Also text won't
  497.     be stretched to the full length of cells with rowspans, the cells below
  498.     will be empty instead. Colspan is currently implemented, the content of
  499.     the cells will be stretched of the number of columns according to the
  500.     collspan. Tables are squeezed to a minimum size or strectched to the full
  501.     width, if linewrap is chosen. Otherwise a cell will be of the length of
  502.     the longest cell in the column. The squeezing and stretching of cells is
  503.     done is quite a rough fashion. For long tables check out the config-file
  504.     to set some parameters so that those are handled well too (who uses tables
  505.     larger than 256 x 10 with cells of more than 64 KB, however some people
  506.     build their whole pages in a table...). if you do you will have to
  507.     increase the max_rows and the max_cols in the config-file. If this is
  508.     necessary the most likely error messages are error 13 and error 14. Also
  509.     possible are error 7 and error 12. Except for error 12 these errors are
  510.     fatal errors. Occasionally this may also lead a situation in which your
  511.     machine seems not to respond. Too long cells, ie larger than 64k will be
  512.     truncated.
  513.     Nested tables aren't supported either, those will be treated as if the
  514.     notables option is set to on. Only the outer-table will be formatted.
  515.     
  516.     
  517.   XI. What does it output?
  518.     
  519.     HTML2TEXT can have two kinds of output: 
  520.       1. It can just throw all output to standard output. This means that
  521.         all files specified are concatenated to stdout. This also means that
  522.         one can `pipe' or redirect the output directly.
  523.         
  524.         
  525.       2. It can create files with extension specified in the config-file (or
  526.         `tx1' in case the input has that extension). If the output already
  527.         exists, the user is asked to confirm overwriting of the file.
  528.         
  529.         
  530.     Note that all messages are written to standard error. This is because one
  531.     needs to make a distinction between the converted text and the additional
  532.     info output by HTML2TEXT. Thus any messages are written to the screen even
  533.     if stdout is redirected. Standard error can be redirected as well btw
  534.     (however command.com does not support it). Also the hush option will
  535.     prevent output to stderr.
  536.     
  537.     When the output path specified in the config file does not exist, by
  538.     default, the user is asked whether the path should be created. When the
  539.     answer is no or the creation did not succeed the current path is used.
  540.     
  541.     HTML2TEXT sometimes uses temporary files to store data. These are of the
  542.     format H2T_xxxx.$$$. where the xxxx stands for a number. Those files can
  543.     safely be deleted after using HTML2TEXT. Most of the time the program
  544.     handles that itself. However the files are not deleted on fatal errors or
  545.     user interruptions.
  546.     
  547.     
  548.   XII. How does it get input?
  549.     
  550.     HTML2TEXT can get input from two sources. First it can read files
  551.     specified on the commandline, wildcards are permitted and from the
  552.     listfile. Secondly the input can be derived from the console. In other
  553.     words input can be redirected from standard input. Use the -f option to
  554.     set redirection on. If no filename is specified, it expects input from
  555.     standard input too. This means that programmes can `pipe' their output to
  556.     HTML2TEXT and also input can be redirected from files. Eg. 
  557.       type myhtml.htm | html2txt -f
  558.     This means that type will output the myhtml.htm file to stdout and it will
  559.     be `piped' to HTML2TXT. Practically this way will have the same effect as
  560.      html2txt myhtml.htm -s
  561.     The output from redirection from standard input will always be sent to
  562.     standard output, that means that if it has to be sent to a file,
  563.     redirection has to be used again. Eg. 
  564.       type myhtml.htm | html2txt -f > myhtml.txt
  565.     Now the output will be written to a file called myhtml.txt.
  566.     If files are specified on the command line as well, the output will still
  567.     depend on the standard_output parameter.
  568.     For usage of redirection and `piping' check the manuals of the commandline
  569.     interpreter (eg. command.com or 4dos.com).
  570.     
  571.     
  572.   XIII. What is printed in the log files?
  573.     
  574.     The log file contains for each file it converts the full path of the input
  575.     file and the full path of the output file. In addition to that the date
  576.     and time will be printed. When standard input or output is used <stdin>
  577.     and <stdout> will be printed instead. Also it contains all output written
  578.     to the screen during conversion. However each line will be preceded by two
  579.     double crosses (`#'). 
  580.     
  581.     
  582.   XIV. Errors and Warnings
  583.     Errors
  584.     
  585.     Error  Error string                    Description                      
  586.     1      Illegal parameter.              A command line parameter was     
  587.                                            not recognised.                  
  588.     2      No such file.                   No file was found matching the   
  589.                                            file name specification.         
  590.     3      No filename specified.          No file specification was found  
  591.                                            on the command line.             
  592.     4      Config-file not found.          The program could not locate     
  593.                                            the config-file, which is        
  594.                                            usually found in the current     
  595.                                            directory or in the directory    
  596.                                            containing html2txt.exe.         
  597.     5      Ini-file not found.             The program could not locate     
  598.                                            the ini-file (see error 4).      
  599.     6      Error in ini-file.              One entry in the ini-file was    
  600.                                            not defined.                     
  601.     7      Not enough memory.              There was not enough memory to   
  602.                                            execute the program.             
  603.     8      File could not be opened.       One input file could not be      
  604.                                            found or opened.                 
  605.     9      Error in config-file.           One entry in the config-file     
  606.                                            was not defined.                 
  607.     10     Too many entity references in   The ini-file contains too many   
  608.            ini-file.                       codes to hold in memory.         
  609.                                            Increase the value in the        
  610.                                            config file.                     
  611.     11     File skipped.                   The file could not be            
  612.                                            converted. The output file       
  613.                                            already exists and do not        
  614.                                            overwrite was chosen.            
  615.     12     Heap corrupted.                 Memory is being corrupted        
  616.                                            during the conversion, mostly    
  617.                                            of tables.                       
  618.     13     Too many rows in table.         The table contains more rows     
  619.                                            than the program can keep in     
  620.                                            memory.                          
  621.     14     Too many columns in table.      The table contains more columns  
  622.                                            than the program can keep in     
  623.                                            memory.                          
  624.     15     Specified path is illegal.      The ini-file could not be found  
  625.                                            in the specified path.           
  626.     16     Could not create temporary      There is not enough space on     
  627.            file.                           the disk or there are not        
  628.                                            enough handles to open a         
  629.                                            temporary file.                  
  630.     17     File writing error: Disk full.  An error occurred while writing  
  631.                                            a file, most like is that the    
  632.                                            disk is full.                    
  633.     Warnings
  634.     
  635.     Warning  Warning String                 Description                     
  636.     256      Unrecognised HTML-code.        The HTML-code was not           
  637.                                             recognised, probably not        
  638.                                             defined.                        
  639.     257      Ill-constructed HTML-code.     The HTML-code was different     
  640.                                             from the one expected,          
  641.                                             probably a closing tag          
  642.                                             forgotten or a missing `/' in   
  643.                                             a tag.                          
  644.     258      Illegal list item.             The list item or list was of    
  645.                                             an illegal type.                
  646.     259      Semicolon expected.            The semicolon after an entity   
  647.                                             reference is missing. However   
  648.                                             there seems to be some          
  649.                                             decreasing use of the           
  650.                                             semicolon.                      
  651.     260      Illegal token.                 A token was encountered which   
  652.                                             was not legal in the context.   
  653.                                             Mostly those will be > or &.    
  654.     261      Ill-constructed entity         The entity reference is not     
  655.              reference.                     defined in the ini-file.        
  656.     262      Misplaced tag, expected        The tag appeared outside of     
  657.              within <head>...</head>.       the head section, usually this  
  658.                                             is the title tag.               
  659.     263      HTML-tag starts with space.    The HTML tag starts with a      
  660.                                             space character.                
  661.     264      Invalid list type.             The type specified for a list   
  662.                                             item or a list was illegal.     
  663.     265      Unexpected `>' encountered.    A greater-than token was        
  664.                                             encountered without a matching  
  665.                                             less than token.                
  666.     266      LI without list.               An LI tag was encountered       
  667.                                             outside a list section.         
  668.     267      DD without definition list.    An DD tag was encountered       
  669.                                             outside a definition list.      
  670.     268      DT without definition list.    An DT tag was encountered       
  671.                                             outside a definition list.      
  672.     269      Tables within tables not       A table section within a table  
  673.              supported.                     was encountered.                
  674.     270      Table cell truncated.          A table cell contained more     
  675.                                             than 65K data.                  
  676.     271      Output path could not be       The specified output path       
  677.              created, default path used.    could not be used or created.   
  678.                                             Probably one of the             
  679.                                             directories in the path is a    
  680.                                             file.                           
  681.     
  682.   XV. What does LONGFILE.BTM do?
  683.     
  684.     LONGFILE.BTM is a simple 4DOS batch file that uses HTML2TEXT to convert
  685.     HTML-files to TEXT-files. This file will use Windows 95 long filenames.
  686.     However this batch file has some limitations. 
  687.       * Existing files will always be overwritten. 
  688.       * Extension of the ouput file will always be .txt. 
  689.       * No output to the screen is generated, such as error, warning etc. 
  690.       * It needs 4DOS 6.00 or better to run (maybe 4DOS 5.5 works too). 
  691.     There is no guarantee or whatsoever that this program will work correctly
  692.     or even something near that. It has been tested very little and is
  693.     probably error infested, when using commandline options. Use it at your
  694.     own reponsibility. Further you are encouraged to improve the working of
  695.     the batch file and send those versions to me.
  696.     
  697.     
  698.     Usage: 
  699.       LONGFILE.BTM <filespecification>
  700.     Where <filespecification> is the name of the file you want to convert.
  701.     Wildcards are permitted and you can have multiple file specification on a
  702.     line.
  703.     
  704.     Use this batch file at your own risk! It is not well tested. Future
  705.     edition will probably have more advanced methods of using W95 long
  706.     filenames. The source code is included, however, so that one can
  707.     experiment with it a little.
  708.     
  709.     
  710.   XVI. Why does it output look weird sometimes?
  711.     
  712.     Some people misuse HTML tags. For example <pre>...</pre> sections are used
  713.     to insert newlines in the output. Or tables are used to define the layout
  714.     of a whole page. In graphical browser, such as Netscape, this may lead to
  715.     the intended result. However in a text-based system this may lead to large
  716.     gaps of newlines and empty sections. And of course small columns with
  717.     useful information.This is not a bug in HTML2TEXT but usually a result of
  718.     lousy written HTML-codes, since HTML2TEXT tries to conform to the
  719.     specification as good as possible. Most of the authors of such pages do
  720.     not even bother to try and understand the HTML specs. 
  721.     
  722.     Other `weird things' happen when some one writes something similar to the
  723.     following fragment of HTML-code:
  724.      Some text and<b> this </b>is very important.
  725.     This would like like in the out as:
  726.      Some text and* this *is very important.
  727.     The spaces are at the `wrong' side of `*'. This is just what is done by
  728.     the program (This probably is what Netscape does too but you cannot see it
  729.     (or are the spaces slightly wider?)). The spaces are made bold too. Do
  730.     remember that most tags are not word delimiters. Some are tho treated that
  731.     way, such as <br> and <p>. 
  732.     
  733.     One final word about weird output. The program does not remove trailing
  734.     spaces. Mostly this is not necessary. But if it is necessary you'll have
  735.     to do it yourself. Most good editors however have an option to remove the,
  736.     The reason why the trailing spaces are not removed is that it will degrade
  737.     performance drastically.
  738.     
  739.     
  740.   XVII. The program works so slow what happened?
  741.     
  742.     In most cases the program does work quite fast. However on an older
  743.     machine it may be that it runs quite slow. Mostly this is due to
  744.     conversion of tables which takes quite some time. Anyway here are some
  745.     hints to make it run faster (some are quite obvious):
  746.     
  747.       * Run the program in DOS not in windoze mode. Especially windoze DOS
  748.         boxes are terribly slow. Also full screen DOS mode is slower than real
  749.         DOS mode. 
  750.       * Use diskcaches to speed up reading and writing data. Even though
  751.         HTML2TXT uses buffers for reading and writing. 
  752.       * Use a ramdrive for working directory. This will speed up conversion
  753.         of tables. Be sure however to have enough space free. 
  754.       * Removes any comment or empty lines from both the ini and config
  755.         files and remove lines that are set to default values from the config
  756.         file. 
  757.       * Remove any lines of entity references from the ini-file that you
  758.         will not use. And lines starting with a double cross (`#') that are
  759.         converted to the ASCII value. 
  760.       * Switch notables on. This converts tables quicker but uglier. 
  761.       * Turn warnings off. This slightly increases speed. 
  762.       * Disable printing of links, anchors, images and input. These can be
  763.         somewhat time consuming. Since the texts need to be parsed. 
  764.     
  765.   XVIII. What's with those version numbers
  766.     
  767.     Version numbers are defined into several sections.
  768.     In the first place there is a major version number, 1 currently. Which is
  769.     followed by a dot. Then there is the minor version number, 50 now. The
  770.     version is followed by a single character. `a' is a alpha release which is
  771.     never released, only for my usage, lots of new functions have to be
  772.     implemented or finished still. `b' is the beta release and most likely the
  773.     normal release, since this version would not change much more, except for
  774.     some bug fixes. `c' will denote an updated version from the beta release.
  775.     Then there are internal revision. This number will be increased as changes
  776.     are implemented each time. Plus a data of last editing will be entered (in
  777.     Frisian). This date should be the same as the date that your operating
  778.     system returns.
  779.     
  780.     
  781.   XIX. Problems & Open Issues
  782.     
  783.     
  784.       * Forms
  785.         Forms may look a bit silly when they are wider than the maximum width
  786.         of a line, especially within tables.
  787.         
  788.         
  789.       * Tables
  790.         Tables are reformatted in a rather simplified manner (see above)
  791.         Future editions will have improved table processing.
  792.         Large tables may produce erroneous output (one cell may not contain
  793.         more than 65k bytes the rest is truncated). Too many columns in a
  794.         table will terminate the program.
  795.         
  796.         
  797.       * Too many newline
  798.         Some combinations of tags will result in too many newlines. However
  799.         most of those are fixed now.
  800.         
  801.         
  802.   XX. How to obtain a new copy of HTML2TEXT?
  803.     
  804.     There are several ways to obtain a copy of html2text: 
  805.       1. Download it here: http://www.noord.bart.nl/~wieger1/h2t150b.zip
  806.         
  807.         
  808.       2. Write an email to me and ask. I will return the latest copy
  809.         attached to the reply as zipped archive.
  810.         
  811.         
  812.       3. Write to my postal address and ask. Be sure to include enough
  813.         (Dutch! no other currency will be accepted) money to cover the
  814.         postage. Also include the return address. For Dutch return addresses
  815.         include a SASE (with enough postage for a diskette). Only 3.5"
  816.         diskettes will be used.
  817.         
  818.         
  819.       4. Look at the nearest BBS or Internet site, for a copy. It is
  820.         uploaded to Simtel usually.
  821.         
  822.         
  823.   XXI. Is this program ported to other platforms?
  824.     
  825.     No, not yet. Currently it only works is DOS (3.3 or better). It should
  826.     work in Windows and OS/2 DOS boxes. It should also work with most DOS
  827.     emulators on other platforms.
  828.     
  829.     
  830.   XXII. What's left do work out?
  831.     
  832.     
  833.       * Better table formatting, include options of alignment, rowspan also
  834.         alignment on caption isn't supported well. 
  835.       * Windows 95 long filenames. 
  836.       * Ports to other platforms, such as various Unix variants and
  837.         Macintosh. 
  838.       * Lots of small things 
  839.     
  840.   XXIII. What changes were made?
  841.     
  842.     1.50                                                                    
  843.              * Added support for multiple character sets for the entity     
  844.            references.                                                      
  845.              * Redefined options, options are now case-sensitive too.       
  846.              * Optionally get rid of the `-=' and `=-' from the title.      
  847.              * Added customisability of displaying input, image and link    
  848.            tags.                                                            
  849.              * Added possibility to specify an output path.                 
  850.              * Added support for single and double quote for string         
  851.            enclosing within tags.                                           
  852.              * Added many new tags from HTML 4.0 Specification.             
  853.              * Re-wrote the larger part of this documentation.              
  854.              * Fixed a couple of bugs in generating warnings.               
  855.              * Fixed a bug in expanding wildcards. It doesn't expand        
  856.            directories anymore.                                             
  857.              * Many smaller bugs fixed.                                     
  858.              * Many small cosmetic changes.                                 
  859.              * Included LONGFILE.BTM.                                       
  860.              * Added support for list files.                                
  861.              * Now word delimiters besides spaces and tabs and newlines,    
  862.            etc can be defined.                                              
  863.              * Added borders for tables and implemented the colspan         
  864.            attribute.                                                       
  865.              * The entity references in tag attributes will be converted.   
  866.                                                                             
  867.     1.21.                                                                   
  868.              * Redirection of input from standard input, is the default     
  869.            when no filename was specified instead of an error.              
  870.              * Added performing of underlines.                              
  871.              * fixed a bug in reading a tag.                                
  872.                                                                             
  873.     1.20                                                                    
  874.              * Bugs fixed and internal revisions.                           
  875.              * Table reformatting improved (no more garbage output).        
  876.              * Multiple file specifications on commandline.                 
  877.                                                                             
  878.     1.10                                                                    
  879.              * Fixed some bugs.                                             
  880.              * Improved commandline options parsing.                        
  881.                                                                             
  882.     1.02                                                                    
  883.              * Added formatting of tables.                                  
  884.              * Better processing of user input (forms).                     
  885.              * Line wrapping added internally (WORDWRAP.EXE is not          
  886.            necessary anymore).                                              
  887.              * Option added to set line wrap.                               
  888.              * WORDWRAP package not included anymore.                       
  889.              * Amp sequences of the format &#nnn; can now be defined, but   
  890.            can be ignored.                                                  
  891.              * A very nasty bug fixed which corrupted the heap.             
  892.              * HTML warnings optional.                                      
  893.              * Added and removed commandline options.                       
  894.                                                                             
  895.     1.01                                                                    
  896.              * Fixed a nasty bug, when outputting to STDOUT, the number of  
  897.            errors was displayed before the last text.                       
  898.              * More intelligent algorithm for performing simple text.       
  899.              * Added value and type options to <LI> tag.                    
  900.              * Added option for title.                                      
  901.              * Decreased default value for stack and tag size.              
  902.              * Documentation converted to HTML format.                      
  903.                                                                             
  904.     1.00                                                                    
  905.              * First version, not released                                  
  906.                                                                             
  907.     
  908.     
  909.   XXIV. How to reach the author?
  910.     
  911.     Write email to:
  912.     wieger1@bart.nl
  913.     or
  914.     H.A.Schotanus@cs.utwente.nl
  915.     
  916.     Write to:
  917.     Gavin Spearhead
  918.     Witbreuksweg 387-302
  919.     7522 ZA Enschede
  920.     The Netherlands
  921.     
  922.     Note that previous email address (wieger@epsilon.nl and
  923.     wieger1@noord.bart.nl) are still valid.
  924.     
  925.     This the latest version of this file can be found at
  926.     http://www.noord.bart.nl/~wieger1/html2txt.htm. 
  927.  
  928. ─────────────────────────────────────────────────────────────────────────────
  929. Note 1: Anywhere I say Netscape, I mean browser ;-)
  930.  
  931. Greetings
  932.  
  933.