Shlomif's Technical Posts Community - New CPAN Package: XML-Grammar-Fiction [entries|archive|friends|userinfo]
Shlomif's Technical Posts Community

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Links
[Links:| Shlomi Fish's Homepage Main Journal Homesite Blog Planet Linux-IL Amir Aharoni in Unicode open dot dot dot ]

New CPAN Package: XML-Grammar-Fiction [Nov. 6th, 2009|01:57 am]
Previous Entry Share Next Entry

shlomif_tech

[shlomif]
[Tags|, , , , , , , , , , , , , , , , , , , , , ]
[Current Location |Home]
[Current Mood |productive]
[Current Music |Grayscale - Thermals (from Jamendo.com)]

Earlier today, I uploaded version 0.0.1 of XML-Grammar-Fiction to CPAN. It is a fork of my own XML-Grammar-Screenplay, which was heavily modified in the recent days, with quite a lot of coding on my part (I felt encouraged by all this coding). The code is still pretty hairy and only the basic functionality was implemented, and there may be many bugs, but it passes all tests on my system, and I've already used it for one of my stories, so I'm happy.

So what is it about? XML-Grammar-Fiction provides the so-called Fiction-Text, a lightweight markup language of sorts to write prose (such as short stories, humorous bits, novellas or novels) in, which in turn gets converted to Fiction-XML, which is a dedicated XML grammar for representing fiction, and which can also be used directly. Fiction-XML in turns can be converted to DocBook/XML or directly to XHTML.

I needed it because I found it troublesome to work on one of my stories in Hebrew ("The Pope Died on Sunday") directly as DocBook/XML, using either gvim or the KDE 4 Kate Editor, due to the problem with the XML tags being in Latin whereas most of the text being in Hebrew, so I sought a more clean text-based format. As a result, XML-Grammar-Fiction was born, just in time for NaNoWriMo (= (Inter-)National November Writing Month), which I'm planning to spend some time investing on my stories and screenplays (for which I already have XML-Grammar-Screenplay).

So how does a sample Fiction-Text story look like? Here's the markup for one straight out of the t/data directory of the XML-Grammar-Fiction CPAN distribution.

<body id="index">

<title>David vs. Goliath - Part I</title>

<s id="top">

<title>The Top Section</title>

David and Goliath were standing by each other.    

David said unto Goliath: "I will shoot you. I <b>swear</b> I will"

<s id="goliath">

<title>Goliath's Response</title>

Goliath was not amused.

He said to David: "Oh, really. <i>David</i>, the red-headed!".

</s>

</s>

</body>

You can see the mixture of some XML-like tags and plain paragraphs.

Naturally everything is still subject to change, and I suppose only tech-savvy users will be able to install it and use it now, but I plan to work on it some more in the near future.

Happy writing!

LinkReply