Last year, I used to write my NaNoWriMo entry. The problem is, I really don’t like, but I want to be able to easily generate an HTML copy of my entry. I also want to be able to keep statistics about my progress.

Thus this trio of NaNoWriMo support scripts were born.

This year, I’ll be writing my NaNoWriMo entry in the One True Text Editor, Vim. I’ll be writing mostly in plain text, with a few special markers interspersed to give my scripts more information about what’s going on.

The first of the three scripts is nano-html. It takes the novel text and generates an HTML page out of it, complete with hypertext anchors at the beginning of each chapter and at the beginning of each day’s work.

The second script is nano-index. It generates the index and stats page for the novel. It contains the links to each chapter and to each day’s additions. It also generates some interesting statistics: how may words were written each day, the average number of words per day, what time I’m estimated to finish, and how many words per day I need to write in order to meet various goals. The script relies on the novel text being stored in a CVS repository, so it can see how many words have been written at the end of each day.

The third script is nano-wc. It’s a wrapper around the Unix wc command that filters out all my special tags before counting the number of words I’ve written. It’s used mainly by nano-index to generate its stats, but it can also be used in isolation.

The special markup is really pretty simple. A tag appears on a line by itself and always begins with >>>. Here’s what they are:

>>> TITLE title_of_novel
>>> AUTHOR your_name
>>> CHAPTER number chapter_title
>>> DAY number
>>> —

TITLE and AUTHOR are self-explanatory. MAINTEXT separates the header (TITLE and AUTHOR) from the novel text itself. DAY identifies the beginning of one day’s work, and CHAPTER identifies the beginning of a chapter. — marks a section boundary within a chapter.

All three scripts are written in Perl. They should work anywhere Perl can be run, although you’ll need an implementation of wc to use nano-wc on a non-Unix system. I’m releasing them under the GNU GPL for whoever wants to use them. If you do use them, make sure to modify the hard-coded URLs that appear in them; fortunately, they appear at the top of each script, so they’ll be easy to find.

Starting Saturday you can expect daily updates on my progress writing my NaNoWriMo entry while still somehow keeping up on everything else that I really should be doing instead. Now if only I could think of a catchy title….

5 Responses

  1. Paul! Write something more…funny, more interesting…something kinda worth reading…I mean, it’s cool and all what you figure out but…for someone with my short attention span…yes, i admit it! Well BB, that’s about it. Peace!

  2. Expect whatever I manage to throw into my NaNoWriMo entry, and a rant about Visual Studio to appear soon….

  3. No more stories about shoelaces or car batteries…those self-check things at stores? You know what I’m talking about! You know you love me for it. haha! you’re an hour ahead of us now. Expect an e-mail from me in the future about CD(s).

  4. When I participated in NaNoWriMo, I just wrote my story in HTML outright. I did write a bunch of scripts for it, though, like to put them into one big HTML file and to do the word count and so on, but I also wrote some silly things to parse the current standings on the website and generate graphs and other statistics (percentiles of completed novels, average “momentum,” etc.) and published all that stuff on the web as the contest went on, though for some reason the NaNoWriMo people never linked to it when I showed it to them (when they’d linked to all sorts of dumb vaguely-NaNoWriMo-related things).

    Between that and the fact they didn’t even care about the submitted file (it was just an honor system for announcing completeness) it put rather a sour taste in my mouth, after spending two weeks on more or less non-stop writing just to have it become just another self-professed number in a database… Though lots of people do like my novel for some reason, and I still occasionally get comments on it. (It also gets cited a lot on dream-related websites, or at least the page which reads like something out of a medical textbook but is almost as much fabrication as it is truth…)

    Oh, and back to the geeky aspect: I also maintained it in a CVS repository. :D

  5. Oh, and I used vim too. :D

    Also, wc still works for HTML. To it, a ‘word’ is a series of non-whitespace characters. So, for example, ‘foo bar baz blech<p>’ is four words.

Comments are closed.