NAME
XML::Grammar::Screenplay - CPAN distribution implementing an XML grammar for screenplays.
VERSION
Version 0.04
SYNOPSIS
See XML::Grammar::Screenplay::FromProto, XML::Grammar::Screenplay::ToDocBook and XML::Grammar::Screenplay::ToHTML.
DESCRIPTION
XML::Grammar::Screenplay is a Perl module for:
- 1. Converting a well-formed plain text format to a specialized XML format.
- 2. Converting the XML to DocBook/XML or directly to HTML for rendering.
The best way to use it non-programatically is using XML::Grammar::Screenplay::App::FromProto, XML::Grammar::Screenplay::App::ToDocBook and XML::Grammar::Screenplay::App::ToHTML, which are modules implementing command line applications for their processing.
The rest of this page will document the syntax of the custom textual format.
FORMAT
Scenes
Scenes 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 scene tag must have an id
attribute (for anchors, etc.) and could have an optional title
attribute. If the title is not specified, it will default to the ID.
Scenes may be nested. There cannot be any sayings or descriptions (see below) except inside scenes.
Text
Text is any of:
- 1. Plaintext
-
Regular text
-
Supported tags are
<b>
for bold tags,<a href="...">
for hyperlinks, and an empty<br />
tag for line-breaks. - 3. Entities
-
The text format supports SGML-like entities such as
&
,<
,"
and all other entities that are supported by HTML::Entities. - 4. Text between [ ... ]
-
Text between square brackets (
[ ... ]
) is reserved for descriptions or inline descriptions (see below).
Sayings
The first paragraph when a character talks starts with the name of the character followed by a colon (:
) and the rest of the text. Like this:
David: Goliath, I'm going to kill you! You'll see -
I will.
If a character says more than one paragraph, the next paragraph should start with any number of "+"-signs followed by a colon:
David: Goliath, I'm going to kill you! You'll see -
I will.
++++: I will sling you and bing you till infinity!
Descriptions.
Descriptions that are not part of saying start with a [
at the first character of a line and extend till the next ]
. They can span several paragraphs.
There are also internal descriptions to the saying which are placed inside the paragraph of the saying and describe what happens while the character talks.
EXAMPLES
Examples can be found in the t/data
directory, and here:
The One with the Fountainhead
Humanity - The Movie
Star Trek - "We The Living Dead"
http://www.shlomifish.org/humour/Star-Trek/We-the-Living-Dead/
DEBUGGING
When trying to convert the well-formed text to XML, one will often encounter an obscure "Parse Error". This is caused by Parse::RecDescent, which is used for parsing. The best way I found to deal with it is to gradually eliminate parts of the document until the offending markup is isolated.
In the future, I plan on writing a custom parser that will provide better diagnostics and will hopefully also be faster.
AUTHOR
Shlomi Fish, http://www.shlomifish.org/.
BUGS
Please report any bugs or feature requests to bug-xml-grammar-screenplay at rt.cpan.org
, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=XML-Grammar-Screenplay. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
TODO
Empty
SUPPORT
You can find documentation for this module with the perldoc command.
perldoc XML::Grammar::Screenplay
You can also look for information at:
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=XML-Grammar-Screenplay
Search CPAN
ACKNOWLEDGEMENTS
COPYRIGHT & LICENSE
Copyright 2007 Shlomi Fish, all rights reserved.
This program is released under the following license: MIT X11.