WordWrap is a REXX script for eComStation and OS/2 which cleans up and reformats text files. WordWrap clears out extraneous whitespace characters and joins multi-line paragraphs into single lines, which would be useful for importing into a word processor program. WordWrap also has the ability to wrap those single lines to the line length you specify, for use in plain text editors, sending by email, etc.
WordWrap includes many powerful features such as user-defined character substitution, which may be useful for people trying to read text files created on other operating systems and codepages. I have included a brief example of converting curly quotes from codepage 1004 (ISO-Latin-1 from the Windows world) to standard ASCII quotes which look correct in all codepages. There is also an option to create DOS, Macintosh or UNIX style text files (each of which uses a diffeent end-of-line marker) so your files are more portable.
Another great feature of WordWrap is the ability to create HTML templates for output files. With this, you can quickly and easily add your cleaned-up and HTML-ized text into a specific web page design and layout.
The PM front-end WordWrap PM can be started by invoking its filename from the command line or by double clicking its icon on the desktop. If using the PM front-end, then wordwrap.cmd must be either in your system PATH or in the same directory as WordWrapPM.exe.
WordWrap /M Margin /I InFile /O OutFile [options]
Examples:
wordwrap /? wordwrap /M 72 /I filename.txt wordwrap /I "input file.txt" /O "output file.html" /F html /M 65 wordwrap -m 60 -f text -i InFile.txt -o OutFile -e unix
IMPORTANT: Filenames MUST be enclosed in quotation marks if the filenames contain blank spaces.
After running WordWrap, you will find a TEMP directory inside the current working directory. Within that you will find the original file, safe and sound in case anything went wrong during the reformatting or word wrapping steps. But please be aware that every time you run wordwrap.cmd, this backup copy will be overwritten with the version of the file on which you most recently performed the wordwrap command.
Additionally, you may run wordwrap.cmd with margin set to 0 to only get rid of extra whitespace characters and join multi-line paragraphs into single lines without wrapping to a margin. This is useful for importing into a full-fledged word processor program which will perform its own word wrapping. For example:
wordwrap /M 0 /I input_filename /O output_filename
The format of substitute.txt, the file containing character substitution information, is:
'OldChar(s)','NewChar(s)'
Note the single quotes and comma are required! WordWrap uses this standard convention to delimit the character(s) you want to replace from those you want to replace them with. Each substituion set must be on a line by itself and should contain no blank spaces unless they are within the characters you are changing from or changing to.
As you may guess, each string can contain multiple characters, so you can replace YO with YOU or replace SATAN with SANTA, etc.
When outputting your files as HTML, WordWrap will add basic HTML markup such as paragraph tags but will not try to create any fancy formatting. You may, however, create your own HTML template, named template.html, and WordWrap will use this when creating your output file. Anything you put into the template before the word [OUTPUT] (which must exist at the beginning of a line and must be the only text on that line) will be copied over as the "header" of your output file, and anything in the template after [OUTPUT] will be copied over as a "footer" on your output file. This allows you to, for example, create a framed or table-arranged web page and quickly add your HTML-formatted text into the correct frame or cell.
v1.61
v1.6
v1.5
v1.41
v1.4
v1.31
v1.3
v1.2
v1.1
v1.0
Making changes to the source code of WordWrap.cmd can be neither condoned nor prevented by the author. Therefore there is absolutely no guarantee or warranty of any kind on this software. If you edit the code and then experience problems, I am in no way responsible for any loss or damage. However, if you experience problems with WordWrap as-released by myself, then please contact me as I would like to make the program useful to as many eComStation and OS/2 users as possible.
If you report a bug, please tell me the version of OS/2 as well as any pertinent steps to recreate any errors you get when running WordWrap.
Under no circumstances should this software be used in a mission critical environment as it is not guaranteed to be bug free nor to be 99.9% reliable.
IMPORTANT: OUTPUT FILES MAY LOSE SOME FORMATTING! The idea behind WordWrap is to clean up extraneous whitespace and there's no way for the program to know if you wanted to keep a line of blank spaces or tabs for some visual layout reason. Also, HTML output may have browser compatibility problems if the input text file contains < or > symbols (used by HTML to denote formatting codes). It is always a good idea to review the output of WordWrap yourself to be certain the result is what you expected.
WordWrap and WordWrap PM are copyright 2001,2003 by Don Eitner
WordWrap is donation-ware. If you find it useful and appreciate the work the author has done, you are asked to send the author a small donation of US$5 to help encourage continued development and more advanced features. Please contact me for donation payment options.
drctl014.dll included in this release carries its own copyright. See drctl014.txt for details.
As of August 2003, Don Eitner can be contacted at:
Don Eitner (freiheit@syntheticdimension.net)
Updates and other programs by Don Eitner can be downloaded from:
http://freiheit.syntheticdimension.net