Commits

Anonymous committed caee3f4

Bug fix: inner-descriptions on the beginning of the line.

Fixed it along with a test.

  • Participants
  • Parent commits fcac1aa

Comments (0)

Files changed (6)

perl/modules/XML-Grammar-Fiction/Changes

 Revision history for XML-Grammar-Fiction.
 
+    * ::Screenplay - Fix the innerdesc on the start of the line in the middle 
+    of the paragraph. Like:
+
+-----------------
+Hi I went to the store and
+[walks around the room, nervous] bought a chocolate bar.
+-----------------
+
+        - this was caused by two bugs here
+
+-----------------
+-$self->_prev_line_is_empty($self->curr_line_ref() =~ m{\A\s*\z});
++$self->_prev_line_is_empty(scalar(${$self->curr_line_ref()} =~ m{\A\s*\z}));
+-----------------
+
+        - they cancelled each other most of the time except for in this 
+        case.
+
 0.1.3       Fri Dec 17 19:38:45 IST 2010
         - Moved some unused source files to the rejects directory.
         - Convert to the new XML-Grammar-Fiction-Builder which uses

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-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/proto-text/with-multi-para-desc.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-internal-description-at-start-of-line.xml
 t/screenplay/data/xml/with-internal-description.xml
 t/screenplay/data/xml/with-multi-line-comments.xml
 t/screenplay/data/xml/with-multi-para-desc.xml

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

 before 'next_line_ref' => sub {
     my $self = shift;
 
-    $self->_prev_line_is_empty($self->curr_line_ref() =~ m{\A\s*\z});
+    $self->_prev_line_is_empty(scalar(${$self->curr_line_ref()} =~ m{\A\s*\z}));
 
     return;
 };

perl/modules/XML-Grammar-Fiction/t/screenplay/data/proto-text/with-internal-description-at-start-of-line.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 
+<b>merciful</b>, real merciful</a>, I will show you the [sarcastically] 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.]
+
+David: as is written in the wikipedia 
+[See <a href="http://wiki.tld/">the Wiki site</a> for more information], you 
+are now dead, having been shot with my sling.
+
+</s>
+
+</s>

perl/modules/XML-Grammar-Fiction/t/screenplay/data/xml/with-internal-description-at-start-of-line.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 <bold>merciful</bold>, real merciful</ulink>, I will show you the 
+                <inlinedesc>sarcastically</inlinedesc> 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>
+    <saying character="David">
+        <para>
+            as is written in the wikipedia <inlinedesc>See <ulink url="http://wiki.tld/">the Wiki site</ulink>
+                for more information</inlinedesc>, you are now dead,
+            having been shot with my sling.
+        </para>
+    </saying>
+</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 => 26;
+use Test::XML tests => 28;
 
 use XML::LibXML;
 
-use XML::Grammar::Screenplay::FromProto;
+require XML::Grammar::Screenplay::FromProto;
 
-use XML::Grammar::Screenplay::FromProto::Parser::QnD;
+require XML::Grammar::Screenplay::FromProto::Parser::QnD;
 
 sub load_xml
 {
         scenes-with-titles
         with-entities
         with-brs
+        with-internal-description-at-start-of-line
     ));
 
-# TEST:$num_texts=13
+# TEST:$num_texts=14
 
 my $grammar = XML::Grammar::Screenplay::FromProto->new({
         parser_class => "XML::Grammar::Screenplay::FromProto::Parser::QnD",