Up to Main Index Up to Journal for July, 2012
JOURNAL FOR MONDAY 30TH JULY, 2012
______________________________________________________________________________
SUBJECT: A short break
DATE: Mon Jul 30 20:57:15 BST 2012
Oh dear another two weeks without any update, so what's been happening?
Well I took a break for a while. I also rewrote my Perl jtconv tool in Go.
jtconv takes a text file and wraps it in a little HTML and converts some links
to hyperlinks. This utility is used to build this site from plain text files
and was initially developed for another of my sites.
The plain text files are actually a type of Record-Jar[1] - which is based on
RFC822: Standard for ARPA Internet Text Messages. It has headers of the form
label:text and can have an unstructured text element. For example the article
for the last journal entry started like this:
Title: Journal for Monday 9th July, 2012
Abstract: I feel a disturbance in my code...
Tags: embedding, structs
A blank, empty line then separates the 'headers' from the unstructured text
that follows - in this case the article text. This format will be familiar to
people who look at HTTP requests or responses:
Date: Mon, 30 Jul 2012 12:46:32 GMT
Server: Apache
Last-Modified: Fri, 19 Sep 2003 22:45:47 GMT
ETag: "20a5c9-7baf-3c7b67e4bbcc0"
Accept-Ranges: bytes
Content-Length: 31663
Content-Type: text/html
It will also be familiar to people who look at email headers:
Return-path: <alice@example.com>
Envelope-to: bob@example.com
Delivery-date: Mon, 30 Jul 2012 13:50:32 +0100
Received: from alice by example.com with local (Exim 4.80)
(envelope-from <alice@example.com>)
id 2SvpQe-0003ft-1D
for bob@example.com; Mon, 30 Jul 2012 13:50:32 +0100
To: bob@example.com
Subject: Testing
Message-Id: <E2SvpQe-0003ft-1D@example.com>
From: Alice <alice@example.com>
Date: Mon, 30 Jul 2012 13:50:32 +0100
I said based on the Record-Jar format as I've added a few additions. For
example comments that start with a leading hash (#) character. Also record
separators using a double percent - i.e. '%%'. These additions are recommended
on the same page referenced earlier, under the section titled 'Unix Textual
File Format Conventions'.
Now why am I writing about all this and why did I take a break from WolfMUD to
rewrite my jtconv tool in Go?
Well... this is one of the formats I'm considering for WolfMUD. It's simple
plain text. Works with many, many tools and utilities. Can be generated by a
nice world builder. Easily and quickly parsed. It can also be spell checked! A
simple example might look like:
Ref: L1
Type: PeacefulLocation
Title: Fireplace
Description: You are in the corner of a common room in the Dragon's Breath
tavern. There is a fire burning away merrily in an ornate
fireplace giving comfort to weary travellers. Shadows flicker
around the room, changing light to darkness and back again. To
the south the common room extends and east the common room
leads to the tavern entrance.
Aliases: Tavern, Fireplace
Exits: S:L2, E:L3, SE:L4
%%
Ref: L2
Type: PeacefulLocation
Title: Common Room
Description: You are in a small, cosy common room in the Dragon's Breath
tavern. Looking around you see a few chairs and tables for
patrons. To the east there is a bar and to the north you can
see a merry fireplace burning away.
Aliases: Tavern, Common
Exits: N:L1, E:L4, NE:L3
Well that's an idea anyway. The file can also be Unicode, handy for languages
other than English or for other symbols. For example the exits could be
written as:
Exits: N→L1, E→L4, NE→L3
Assuming your browser supports Unicode so you can see the right pointing
arrows ;) You could also drop the commas:
Exits: N→L1 E→L4 NE→L3
--
Diddymus
[1] http://www.catb.org/~esr/writings/taoup/html/ch05s02.html
Up to Main Index Up to Journal for July, 2012