XML-Grammar-Fiction - Markup Languages for Writing Prose

About

XML-Grammar-Fiction provides Fiction-Text, a lightweight plaintext-based markup language, which can be used to write such fiction as stories, novellas, or possibly even novels. Fiction-Text is in turn converted to Fiction-XML, which is an XML-based grammar (which can be used directly). Fiction-XML, in turn, is translated to such formats as XHTML and DocBook/XML, for rendering by web-browsers, and for conversions to different formats, including PDF.

Also provided are Screenplay-Text and Screenplay-XML which are used for writing screenplays (or scripts), and can be translated to XHTML or to TEI-XML (Text Encoding Initiative)

XML-Grammar-Fiction is part of the Web-CPAN XML-Grammar project that provides several specialised processors for XML grammars for various tasks.

Licence

XML-Grammar-Fiction is free and open-source software (FOSS) distributed under the MIT/Expat License, a permissive software licence.

Examples

Fiction-Text Examples

Screenplay-Text Examples

News

Coverage of XML-Grammar-Fiction

Coverage in Shlomi Fish’s Blogs

Demos

Fiction Demo 1

If we have this sample Fiction-Text document:

<body id="index" lang="en">

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

<s id="top">

<title>The Top Section</title>

<!-- David has Green hair here -->

King <a href="http://en.wikipedia.org/wiki/David">David</a> 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 has to reply to that. -->

Goliath was not amused.

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

</s>

</s>

</body>

Then after converting it to XML and then to XHTML we get this:

David vs. Goliath - Part I


The Top Section

King David and Goliath were standing by each other.

David said unto Goliath: “I will shoot you. I swear I will”

Goliath's Response

Goliath was not amused.

He said to David: “Oh, really. David, the red-headed!”.

Screenplay Demo 1

Source

If we have this sample screenplay:

<s id="humanity" title="'Humanity' - The Movie">

[Note: This screenplay was written by
<a href="http://www.shlomifish.org/">Shlomi Fish</a>, and is original artwork.]

<s id="the-well" title="The Well">

[ The Well is shown. Several women are standing nearby with large pots near
them. They are chatting. Three men approach. ]

Man #1: OK. Let's move it.

Man #2: You know, I heard of a guy called Moses who could move a stone like
this all by himself.

The Inventor's Voice from outside the frame: That's because he was using the
Mosesiom 3000!

Man #3: I beg your pardon?

[ The Inventor enters the frame with his invention that looks suspiciously
like a lever. ]

The Inventor: With this ingenious invention one man can move this stone
all by himself. Wanna try?

Man #1: OK. I'll try.

The Inventor: OK. First we tie the stone to the ropes here.

[ He ties the stone]

The Inventor: Now lift the other hand.

Man #1: [After lifting the stone.] Wow, it's so easy, look I can move the
stone here [moves it to the left], and here [ moves it to the right].

The Inventor: No! No! Don't misuse it.

[The stone falls down on the well, splits into two pieces which both fall down
the well. The men are amazed. ]

The Inventor: Don't worry, I can get down and tie the ropes to each stone and
we can lift it up in a flash...

Man #1: I'll get the ropes.

Man #2: I'll get the horses.

[ They leave the frame ]

The Inventor: This is not my day.

Woman #1: Who is John Galt?

</s>

</s>

Result

Then after converting it to XML and then to XHTML we get this:

'Humanity' - The Movie

[ Note: This screenplay was written by Shlomi Fish, and is original artwork. ]

The Well

[ The Well is shown. Several women are standing nearby with large pots near them. They are chatting. Three men approach. ]

Man #1: OK. Let's move it.

Man #2: You know, I heard of a guy called Moses who could move a stone like this all by himself.

The Inventor's Voice from outside the frame: That's because he was using the Mosesiom 3000!

Man #3: I beg your pardon?

[ The Inventor enters the frame with his invention that looks suspiciously like a lever. ]

The Inventor: With this ingenious invention one man can move this stone all by himself. Wanna try?

Man #1: OK. I'll try.

The Inventor: OK. First we tie the stone to the ropes here.

[ He ties the stone ]

The Inventor: Now lift the other hand.

Man #1: [After lifting the stone.] Wow, it's so easy, look I can move the stone here [moves it to the left], and here [ moves it to the right].

The Inventor: No! No! Don't misuse it.

[ The stone falls down on the well, splits into two pieces which both fall down the well. The men are amazed. ]

The Inventor: Don't worry, I can get down and tie the ropes to each stone and we can lift it up in a flash...

Man #1: I'll get the ropes.

Man #2: I'll get the horses.

[ They leave the frame ]

The Inventor: This is not my day.

Woman #1: Who is John Galt?

Design Goals

  1. All valid Screenplay-Text documents should translate to valid Screenplay-XML codes.

  2. All valid Screenplay-XML documents should translate to valid and mostly semantic XHTML5.

  3. Screenplay-Text should have a minimum of characters with special meaning, in order to generate predictable outputs.

  4. Screenplay-Text should support Unicode, UTF-8 and internationalisation well.

Similar Projects

  • TEI: Text Encoding Initiative - provides an XML grammar and related tools for encoding texts in digital form (including many artsy texts such as works of fiction, poems and scripts/screenplays).

  • Celtx - an open-source application that allows one to edit screenplays, novels, and other media pre-production resources. Uses well-formed HTML 4 for its data files, packaged in a .zip with many resources, so it may be less ideal than XML. It is also a GUI program that was quite sluggish from my experience.

  • AsciiDoc - a very rich and open-source markup language that can be used for notating text and can be converted into DocBook 4/5, directly into HTML, and to several other formats. Also see Asciidoctor.