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.
Project Links
For XML-Grammar-Fiction
- GitHub Repository - contains version control and other resources.
- XML-Grammar-Fiction on MetaCPAN - download, documentation, browsing and information.
- Freecode Record
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
Distributed Examples- there are some short examples under
t/fiction/data/
in the distribution (mostly in English).The Pope Died on Sunday - a story in Hebrew under CC-by-sa.
The Enemy and How I Helped to Fight it - the Hebrew version of this story is written in Fiction-Text.
The Human Hacking Field Guide - the Hebrew translation was written using Fiction-Text.
Screenplay-Text Examples
Distributed Examples- there are some short and silly examples in the
t/screenplay/data
directory in the distribution.The One with the Fountainhead - original text, but fan fiction of the T.V. show Friends.
Humanity - The Movie - all original text and concept. Under the CC-by-sa license.
Star Trek - “We The Living Dead” - all original text, but fan fiction of Star Trek.
Interviews with Open Source People - several interviews whose original hacky like-XML-but-not-quite source was converted to Screenplay-Text and then rendered into XML and XHTML.
The Hitchhiker’s Guide to Star Trek - The Next Generation - David T. Lu’s and Mickey McCarter’s old parodical screenplay crosses The Hitchhiker’s Guide to the Galaxy and Star Trek: The Next Generation. It was converted into Screenplay-Text format using a crude perl-5.10.x script and from that translated into XHTML.
Selina Mandrake - The Slayer - screenplay for a film in English. Original text, but fan-fiction of “Buffy the Vampire Slayer” and other works of popular culture.
Summerschool at the NSA - screenplay for a short film in English. Original text and idea and real person fiction.
Buffy - a Few Good Slayers - a Buffy fan fiction.
“So, who the Hell is Qoheleth?” - An Illustrated Screenplay
“Terminator: Liberation” - An Illustrated Screenplay for a self-referential Terminator parody.
Queen Padmé Tales - 5 screenplays for a web series (CC-by; Star Trek / Star Wars / Real Life crossover.).
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. ]
[ The Inventor enters the frame with his invention that looks suspiciously like a lever. ]
[ He ties the stone ]
[ The stone falls down on the well, splits into two pieces which both fall down the well. The men are amazed. ]
[ They leave the frame ]
Design Goals
All valid Screenplay-Text documents should translate to valid Screenplay-XML codes.
All valid Screenplay-XML documents should translate to valid and mostly semantic XHTML5.
Screenplay-Text should have a minimum of characters with special meaning, in order to generate predictable outputs.
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.