. . . . . . . . . .=%%%=. . . . . . . .=%^"""^%=. . . . . . ""%%%%% .%' '%. % . . . . . . . . . .%" %!%%%%%"" !% %% . . . "%%%. !% %% %! %% . . . . "%% !% %%%%%%%%%%%%%%%%%%%%%%"" . . . .... %% . %! %% !% %% .... . . . ""%% %% '%. %% .%' . %% %%"" . . . . %% '=%.___.%=' %% . . . . . . "=%%%=" . . . . . . F A N F I C T I O N F O R M A T T I N G T O O L . . . . . . . . . . . * Version -------------------------------------------------------------- 0.80 * Copyright ------------------------------------------------------------ The Fan Fiction Formatting Tool (3FT) A program to make text files (.TXT extension) valid for submission to mailing lists, newsgroups, etc... Copyright (C) 2000 Sam Brown, also known as Subi. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Details can be found in the accompanying text file "gnu-gpl.txt", or at http://www.gnu.org/copyleft/gpl.html. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. The author of this program can be contacted by email at: subi@gameart.com. And his homepage is at: http://www.gameart.com/4ca. This archive should contain the following files: 3FT.EXE (the program) 3FT.C, REPLACE.H (source code) README.TXT (this file) GNU-GPL.TXT (copy of the GNU General Public License) * Why? ----------------------------------------------------------------- A common FFML (Fan Fiction Mailing List - the mailing list for anime & manga based fan fiction) complaint: "Great story, but WILL YOU _PLEASE_ FORMAT THE @#$%ING THING PROPERLY?!" This is a little program I came up with after spending the now traditional half-an-hour formatting my latest opus into a condition able to pass the standards required by the FFML. Why the hell I hadn't done it before I can't imagine, I _am_ a coder for a living, after all. ;) Besides, this might make up for the disaster than was Republic of Desire #4... ;) * What? ---------------------------------------------------------------- Basically, what it does is take a text file and wordwrap it. And some other stuff. That's it. Should save you some time. I (originally) knocked it up in about ten minutes, so don't expect anything fancy. Currently it will: * Wrap lines at or before the maximum line length set without splitting words unless it cannot be avoided (IE: if the word in question is longer than the maximum line length). * Recognise hyphens as the ideal splitting point for a word. * Convert tabs to spaces, formatting to columns. * Strip extraneous space characters from the ends of lines. * Strip spaces from the beginning of a line only if they've been wordwrapped. Tabs are handled separately, so the indenting in your scripts is safe. ;) * Cope as much as possible with those big long lines of hyphens and other characters that some writers use to split paragraphs up with. * Strip all control characters, such as bells (^G), with the exception of newlines. * Force the text in the file to conform to your choice of encoding. For more information try http://www.bbsinc.com/iso8859.html. The current options are: * CP1252 - The windows standard. Allows a lot of the characters, such as the curly speech marks so beloved of Microsoft Word, that cause unintelligible gibberish on most non-windows systems. Try not to use this one. Please. * ISO-8859-1 - Otherwise known as Latin-1, this is the REAL standard. Gets rid of the Window-specific characters whilst still allowing accented characters. Should be acceptable on all systems. Use this one, it's the default. * 7-Bit US ASCII - Older standard. For when you want to be REALLY sure it's going to look the same on all systems. Doesn't allow anything other than the basic Roman alphabet, in other words newlines, spaces, !"#$%&'()*+,./0123456789:;<=>?@ABCDEFGHIJKLMNOPQ RSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~- and . Ranma authors, note lack of the "half" character, which will be replaced with "1/2". ;) Only for the paranoid. * Unformat a file, in other words remove all single linebreaks. This is for people who maintain web archives and who want to use proportional fonts. Has a good guess as to the author's preferred number of spaces after a full stop (I usually use two), although that won't matter if you're planning on converting the file to HTML, as HTML files only display one space after a full stop no matter how many are actually there in the file, unless you use non-breaking spaces ( ) to tell it otherwise. ;) ...and basically format MY writing into a format I'm happy with. I'm open to ideas on what else to do with it. Try it on your own files and see what happens. This very file is an example of its output. Seems to work. Spaces are defined as space, formfeed, newline, and carriage returns. Tabs are dealt with separately. Anything else (including punctuation) is counted as a letter, so if a word _has_ to be split, you may end up with a comma or a full stop at the start of a line on its own in an absolute worst-case scenario. Naturally, it has limitations: * It is NOT a spellchecker! ;) Nor will it fix bad punctuation. * It will just make your fic acceptable to the FFML, it will NOT magically prettify it. Indeed, the 7-bit stripping may screw up any ASCII art you have in there, which you shouldn't have anyway. * If you start asking it to format files with a lot of words longer than the maximum line length (if you had a line length of 8, for example) then you're just asking for trouble, and I refuse to talk to you unless you've got a _really_ good reason for doing it. In fact, because all coders hate spending 90% of their time handling situations that no sane person would cause _anyway_, there's a minimum line length of 16, as setting it to 1 or 2 would probably cause the program to hang. * It's a console application, meaning it'll only run in a Win95/98/NT MS-DOS box. * You CAN NOT use the "standard in" or "standard out" functions of DOS, or their redirection arguments ("<" and ">"). I did have a go at allowing them, but it resulted in less optimised files (stray spaces at the ends of lines, etc) and, as the format had to be done in one pass instead of three, it made the code a mess. I can promise any coders out there who've had a look at the source that I _did_ carefully consider the pros and cons of both my current approach and the more elegant, pipe-friendly, less memory hungry one before copping out. * At the moment it only handles text files (.TXT extension), so save those Word documents as plain text before running them through this thing. Doing that will get rid of 90% of your invalid character problems anyway. NEVER paste text directly from a word processor to an email, that's just asking for your fic to be filled with what is technically known as unintelligible gibberish. This is caused by the WP using strings of characters as formatting codes for things like bold and italic text, curly speech marks, etc, and not showing them on its display. * As far as the unformatting function goes, changing a file back is somewhat less well defined than linebreaking one, so it may not be exact - for instance it won't be able to convert strings of spaces back to tabs. Strings of spaces will, in fact, be removed so scripts don't end up full of holes. And obviously it'll REALLY screw up any ASCII art in there. It'll do most of the work though, just be sure to check it afterwards. IIRC www.fanfiction.com had a similar problem with their auto-formatter... ;) * Don't expect it to handle Kanji. Wide-byte files are still on the "to do" list. And damn well staying there for the moment! ;) I appreciate the fact that other people may have their own preferred methods of formatting fics, and that they may have a nice set of Word macros or something that does all this for them. Maybe the WP you use already does all this for you. Fair enough. This is really for all the writers out there who struggle on with just WordPad, and don't even have access to a spellchecker. Oh, and "3FT" is a reference to The Dirty Pair's employers, the Worlds Welfare Work Association, or WWWA, or 3WA. ;) * How? ----------------------------------------------------------------- Installation ~~~~~~~~~~~~ [Note to people who are kindly compiling 3FT for other OSs, please change this bit as appropriate. - Subi] A brief MS-DOS tutorial for the uninitiated: 3FT is a command line program, which means that is can only be used from a Windows MS-DOS box. This means the 3FT.EXE file MUST be in a directory (or "folder") on your hard drive that is PATHED, IE when a command is entered in a MS-DOS box Windows knows to look in that directory for the .EXE or .COM file referred to by that command. So, firstly you should find out which directories are pathed on your machine. You can do this by starting an MS-DOS box and typing: path ...and hitting the ENTER key. You should see something like this: Microsoft(R) Windows 98 (C)Copyright Microsoft Corp 1981-1998. C:\WINDOWS>path PATH=C:\WINDOWS;C:\WINDOWS\COMMAND C:\WINDOWS> This tells us that the directories C:\WINDOWS and C:\WINDOWS\COMMAND are pathed, IE that Windows searches those directories for the relevant .EXE or .COM file when a command is entered in an MS-DOS box. Note that the name of your WINDOWS directory may vary in name (a common variant is WIN32) as you can change the name of the directory when installing Windows. Extract the file 3FT.EXE to one of those directories. As it happens, C:\WINDOWS\COMMAND is where Windows keeps all the programs you can run from MS-DOS boxes, so stick it there if you can. You can, of course, put 3FT.EXE somewhere else, somewhere that ISN'T pathed, and add that location to your path. But if you know how to do that you won't've needed to have read this bit anyway. ;) Using 3FT ~~~~~~~~~ Save your document as a plain text file (.TXT extension). THIS IS IMPORTANT! Then, in an MS-DOS box, type: 3ft [INPUT] <-l[N] -t[N] -e[C/I/7] -u -v -o[output]> ...with none or more of the following switches: -l[N] = Max length of a line, <= 16. Use -ld to disable word wrapping. (default: 72) -t[N] = Tab size. (default: 8) -e[C/I/7] = Force encoding to be CP1252 (C), ISO8859-1 (I) or 7-bit (7). (default: I) -u = Unformat a file. (default: OFF) -v = Enable verbose feedback. (default: OFF) -o[FILENAME] = Name of output file. (default: 3FTOUT.TXT) For example, to format a file called INPUT.TXT to a line length of 70 characters and a tab size of 4, allowing only 7-bit ASCII characters, and output it to a file called OUTPUT.TXT without being told what's going on type: 3ft INPUT.TXT -l70 -t4 -e7 -oOUTPUT.TXT ...and hit the ENTER key. NB: Enabling verbose feedback will DRASTICALLY slow 3FT down due to the time taken updating the screen. To send in an email simply load the file into an empty email. If your mail client doesn't let you do this open up the formatted file in a plain text viewer, such as Notepad or Wordpad, and cut and paste from there. If you do it from a more advanced WP, such as Microsoft Word, you stand a chance of copying the invisible formatting characters inserted by the WP, and believe me, some of them WILL insert invisible rubbish as soon as you load a file into them. Alternatively you can just attach the file to the email if the mailing list you're sending to supports them. For example, the FFML will simply copy the contents of an attached file to the email itself. Be warned, other lists may not be as forgiving. * Who? ----------------------------------------------------------------- Subi, also called Sam Brown. I've written better things that this, honest, but mostly you have to pay for those. :P Mail me at: subi@gameart.com. Also, BIG thanks to everyone who gave me feedback and support, particularly John Biles, who put up with me asking a LOT of stupid questions while researching this thing. If you're going to mail me about a bug, describe it as much as you can and SEND ME THE FILE THAT CAUSED THE BUG. This is important, that's why it's in capital letters. I can't debug without input. * Where? --------------------------------------------------------------- This program, some other programs, some art, some music, oh, and some fanfics (Five Minute Theatre amongst others) can be found at: http://www.gameart.com/4ca. * When? ---------------------------------------------------------------- My calendar says 2nd July 2000. Thanks for downloading. Cheers! * List of changes ------------------------------------------------------ V0.80 - Added disabling of wordwrapping. This is in case you just want to check the encoding of a file that's already wordwrapped. V0.72 - Bugfix: Missing ELSE statement meant the default was US 7-bit ASCII instead of ISO-8859-1. Blame it on lack of sleep. V0.71 - Bugfix: Due to a missing comma, the higher-end encoding replacements were getting replaced wrongly. Agh. - Bugfix: Some of the replacements were just plain wrong due to my lack of knowledge of languages other than English. :P Thanks to Rebeka Thomas for showing me the right ones! V0.7 - Added unformatting. Very beta, let me know if you have any trouble. - 3FT and its source code are now distributed under the terms of the GNU General Public License. By popular request. Don't laugh too hard at the source code, okay? ;) V0.6 - Added CP1252 and ISO-8859 encoding to the character stripper/replacer, so you can use those accents again now. - Added the standard moron checks [1], such as reading and writing to the same file, overwriting files, etc. - Added user feedback. [1] A "moron check" is defined in the Unofficial Coder's Handbook as "preventing something no sane person would attempt, but you can guarantee SOMEONE will try to do it". Don't blame me, I didn't invent the term! ;) Also included under the umbrella term "sanity check". V0.5 - Added replacement of non 7-bit US ASCII characters. - Added stripping of control characters. - Improved tab handling. Scripts should now be okay as long as you give 3FT the same settings your WP uses. - Fixed minor bug in the memory handling. Ooops. V0.1 - Initial release. ------------------------------------------------------------------------