Commits

Anonymous committed ad95a95

Add the <i> tag to Screenplay-Text.

And the <italics> tag.

Comments (0)

Files changed (8)

perl/modules/XML-Grammar-Fiction/MANIFEST

 t/screenplay/data/proto-text/with-description.txt
 t/screenplay/data/proto-text/with-dialogue.txt
 t/screenplay/data/proto-text/with-entities.txt
+t/screenplay/data/proto-text/with-i-element-inside-paragraphs.txt
 t/screenplay/data/proto-text/with-internal-description-at-start-of-line.txt
 t/screenplay/data/proto-text/with-internal-description.txt
 t/screenplay/data/proto-text/with-multi-line-comments.txt
 t/screenplay/data/xml/with-description.xml
 t/screenplay/data/xml/with-dialogue.xml
 t/screenplay/data/xml/with-entities.xml
+t/screenplay/data/xml/with-i-element-inside-paragraphs.xml
 t/screenplay/data/xml/with-internal-description-at-start-of-line.xml
 t/screenplay/data/xml/with-internal-description.xml
 t/screenplay/data/xml/with-multi-line-comments.xml

perl/modules/XML-Grammar-Fiction/extradata/screenplay-xml.rng

             <text/>
             <ref name="ulink"/>
             <ref name="bold"/>
+            <ref name="italics"/>
         </choice>
     </define>
     <define name="scene">
             <text />
         </element>
     </define>
+    <define name="italics">
+        <element name="sp:italics">
+            <text />
+        </element>
+    </define>
     <define name="ulink">
         <element name="sp:ulink">
                 <attribute name="url">
                     <choice>
                         <text />
                         <ref name="bold"/>
+                        <ref name="italics"/>
                     </choice>
             </zeroOrMore>
         </element>

perl/modules/XML-Grammar-Fiction/lib/XML/Grammar/Fiction/FromProto.pm

     return "b";
 }
 
-sub _handle_elem_of_name_i
+sub _italics_tag_name
 {
-    my ($self, $elem) = @_;
-
-    $self->_output_tag_with_childs(
-        {
-            start => ["i"],
-            elem => $elem,
-        }
-    );
-
-    return;
+    return "i";
 }
 
-
 sub _handle_text_start
 {
     my ($self, $elem) = @_;

perl/modules/XML-Grammar-Fiction/lib/XML/Grammar/FictionBase/TagsTree2XML.pm

     return;
 }
 
+sub _handle_elem_of_name_i
+{
+    my ($self, $elem) = @_;
+
+    $self->_output_tag_with_childs(
+        {
+            start => [$self->_italics_tag_name],
+            elem => $elem,
+        }
+    );
+
+    return;
+}
 =head2 meta()
 
 Internal - (to settle pod-coverage.).

perl/modules/XML-Grammar-Fiction/lib/XML/Grammar/Screenplay/FromProto.pm

     return "bold";
 }
 
+sub _italics_tag_name
+{
+    return "italics";
+}
+
 sub _write_elem
 {
     my ($self, $args) = @_;

perl/modules/XML-Grammar-Fiction/t/screenplay/data/proto-text/with-i-element-inside-paragraphs.txt

+<s id="top">
+
+<s id="david_and_goliath">
+
+[David and <a href="http://en.wikipedia.org/wiki/Goliath">Goliath</a> are 
+standing by each other.]
+
+David: I will kill you.
+
+Goliath: no way, you little idiot!
+
+David: yes way!
+
+++++: In the name of <a href="http://real-allah.tld/">Allah, the 
+<i>merciful</i>, real merciful</a>, I will show you the power of my sling. 
+
+++: I shall sling you and bing you till infinity.
+
+[David takes his sling.]
+
+Goliath: I'm still <a href="http://wait.tld/">waiting</a>.
+
+David: so you are.
+
+[David puts a stone in his sling and shoots Goliath. He hits.]
+
+</s>
+
+</s>

perl/modules/XML-Grammar-Fiction/t/screenplay/data/xml/with-i-element-inside-paragraphs.xml

+<?xml version='1.0' encoding='utf-8'?>
+<!DOCTYPE document SYSTEM "screenplay-xml.dtd">
+<document xmlns="http://web-cpan.berlios.de/modules/XML-Grammar-Screenplay/screenplay-xml-0.2/">
+    <head>
+    </head>
+    <body id="index">
+<scene id="top">
+    <scene id="david_and_goliath">
+        <description>
+            <para>
+                David and 
+                <ulink url="http://en.wikipedia.org/wiki/Goliath">Goliath</ulink> 
+                are standing by each other.
+            </para>
+        </description>
+        <saying character="David">
+            <para>
+                I will kill you.
+            </para>
+        </saying>
+        <saying character="Goliath">
+            <para>
+                no way, you little idiot!
+            </para>
+        </saying>
+        <saying character="David">
+            <para>
+                yes way!
+            </para>
+            <para>
+                In the name of <ulink url="http://real-allah.tld/">Allah, the <italics>merciful</italics>, real merciful</ulink>, I will show you the power 
+                of my sling.
+            </para>
+            <para>
+                I shall sling you and bing you till infinity.
+            </para>
+        </saying>
+        <description>
+            <para>
+                David takes his sling.
+            </para>
+        </description>
+    <saying character="Goliath">
+        <para>
+            I'm still <ulink url="http://wait.tld/">waiting</ulink>.
+        </para>
+    </saying>
+    <saying character="David">
+        <para>
+            so you are.
+        </para>
+    </saying>
+    <description>
+        <para>
+            David puts a stone in his sling and shoots Goliath. He hits.
+        </para>
+    </description>
+</scene>
+</scene>
+</body>
+</document>

perl/modules/XML-Grammar-Fiction/t/screenplay/proto-text-to-xml-using-custom-parser.t

 
 use Test::More;
 
-use Test::XML tests => 28;
+use Test::XML tests => 30;
 
 use XML::LibXML;
 
         dialogue-with-several-paragraphs
         with-description
         with-tags-inside-paragraphs
+        with-i-element-inside-paragraphs
         with-internal-description
         with-comments
         with-multi-para-desc
         with-internal-description-at-start-of-line
     ));
 
-# TEST:$num_texts=14
+# TEST:$num_texts=15
 
 my $grammar = XML::Grammar::Screenplay::FromProto->new({
         parser_class => "XML::Grammar::Screenplay::FromProto::Parser::QnD",