NEWWWSBOY

a system for maintaining web pages

Released to the public domain in 1998 by Dan Lyke. The author assumes no responsibility for any damage resulting from the use or misuse of these scripts. As Wynn Wagner III used to say: "you break it, you own both pieces."

This is also released as half-baked software. It works well enough to run http://www.flutterby.com/ , but I've no idea how intelligent I have to make the interface or any of that stuff. If you set this up and use it, gimme a holler and let's talk about how it can be more useful. mailto:danlyke@flutterby.com


This is a set of scripts built for a running news sort of web page. It allows you to set up a couple of inputs, I just use mail messages, and have those inputs automatically formatted and stuffed into a set of configurable web pages.

I wrote it because I kept promising to update my web page, and never did, but managed to send tons of e-mail in the same time. I figured that e-mail was my preferred interface, and if I could write a formatting engine that took e-mail and inserted it into HTML pages , added a script to do some daily maintenance I'd actually update my pages fairly regularly.

To install, unzip the distribution tar (the doc assumes you'll put it in /usr/local/etc/ (the tar will unzip to a newwwsboy directory), it will create a "newwwsboy" directory and all the files. Edit the top of the domail script to tell it where to find the newwwsboy.ini file, and search for chmod and change it to what you want (I set the execute bit to take advantage of the Apache XBitHack mode), edit the newwwsboy.ini and the templates appropriately, set up domail to be called from your aliases file, and set up daily to run once a day (usually in a cron job).

Like most Perl hacks, it helps if you're willing to delve into the code to make this do what you want it to.

The Formatting Engine

The formatting engine is pretty smart, but not infallible. It tries its best to keep you from writing invalid HTML, and to turn what you write into reasonable HTML. The rules are:

domail

domail is a little script which takes an e-mail message as input and updates web pages appropriately. If you're using a Unix variant, you set it up to run from your aliases resource. In the case of sendmail , this means altering your /etc/aliases file to run the program with the message as input.

For instance, if I want e-mail to the address "bookreviews@flutterby.com" to go to my book reviews, I'd do something like:

bookreviews:"|/usr/local/etc/newwwsboy/domail -file:reviews

A note about security: If someone ever gets ahold of the address you're using for this, you're hosed. "bookreviews@flutterby.com" is not the address I use. This system is fairly low security, which works okay for me but consult with your system administrator before you plug it in.

Variables

Variables that can be used for substitution.

variabledescription
$title subject of the message
$filename title with any non alpha or numeric characters stripped
$mon month abbreviation ("Jan", "Feb", etc)
$dow day of the week ("Monday", "Tuesday", etc)
$day day of the month
$year 4 digit year.
$dayord ordinal extension ("st", "nd", "rd", "th", etc)
$month full month name

newwwsboy.ini

When you call domail with the "-file" option, it looks in the newwwsboy.ini file to see what to do with it. The first thing it does is look for the documentroot entry. This tells the root of the web server documents. Usually the entry will look something like:

documentroot=/usr/local/etc/httpd/htdocs

Then you'll need a templateroot entry. This is where to look for the template files from which your site is built. Usually this is:

templateroot=/usr/local/etc/newwwsboy/templates

Then domail looks for entries specific to the file you've told it you want to do operations on. For instance, if you've set up book reviews to get called with "-file:books", you might have entries that look like:

books.path=/reviews/books/$filename.html
books.template=bookreviews.html
books.links=root reviews

You can use any of the usual variables to do automatic substitution on filenames.

If the file exists, then it's read and the various macros are expanded appropriately. If it doesn't exist, then it's created, the ".template" file is parsed into the new file, then for each of the entries in the links, the processed gets repeated with "link" macro substitution turned on.

newday

Quite simple: Run once a day, it'll take all of the files specified with -file:filename, read them in, strip the text from between the first comment and the second occurrence, copy that text into another block, then delete any blocks over 30 (which is set via the variable $maxDayCount.