In order to be able to share the common code and functionality more easily,
then XML::Grammar::Screenplay,
which provides similar XML grammar and text-based markup language for writing screenplays,
is now included in this CPAN distribution,
and you can refer to its documentation as well: XML::Grammar::Screenplay .

The rest of this page will document the syntax of the custom textual format.

Sections are placed in XML-like tags of <section> ...
</section> or abbreviated as <s> ...
</s>.
Opening tags in the format may have attributes whose keys are plaintext and whose values are surrounded by double quotes.
(Single-quotes are not supported).

The section tag must have an id attribute (for anchors,
etc.) and could contain an optional (but highly recommended) <title> sub-tag.
If the title is not specified,
it will default to the ID.

All other characters are reserved for special markup in the future.
If you need to use them at the beginning of the paragraph you can escape them with a backslash (\) or their SGML/XML entity (e.g: &qout;).

These are not delimited by anything - just a paragraph of text not containing an empty line.
If a paragraph starts with a Plus sign ( + ) then it is immediately expected to be followed by a styling tag (as opposed to a

<body id="index" lang="en-UK">
<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>

I (= Shlomi Fish) originated this CPAN distribution (after forking XML:Grammar::Screenplay which was similar enough) so I'll have a convenient way to edit a story I'm writing in Hebrew and similar fiction, as OpenOffice.org caused me many problems, and I found editing bi-directional DocBook/XML to be painful with either gvim or KDE 4's kate, so I opted for a more plain-texty format.

I hope a lightweight markup language like that for fiction (and possibly other types of manuscripts) will prove useful for other writers. At the moment, a lot of stuff in the proto-text format is subject to change, so you'll need to accept that some modifications to your sources will be required in the future. I hope you still find it useful and let me know if you need any feature or bug-fix.

The code is open to the world, and available for you to hack on. Please feel free to browse it and play with it, or whatever. If you want to contribute patches, please send me a diff or prod me to pull from your repository :)