1. Shlomi Fish
  2. Fiction-XML

Commits

shl...@52c325ad-5fd0-0310-8a0f-c43feede02cc  committed 37a39f9

Add support for numeric entities.

[ ] etc.

  • Participants
  • Parent commits 9150edb
  • Branches default

Comments (0)

Files changed (6)

File perl/modules/XML-Grammar-Fiction/Changes

View file
 Revision history for XML-Grammar-Fiction.
 
+    * Add support for [ and other numeric entities.
+
 0.1.6       Sat Apr  9 16:15:17 IDT 2011
     * Now handling the <a /> element only in XML::Grammar::Screenplay - it
     does not exist in ::Fiction.

File perl/modules/XML-Grammar-Fiction/MANIFEST

View file
 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/proto-text/with-numeric-entities.txt
 t/screenplay/data/proto-text/with-tags-inside-paragraphs.txt
 t/screenplay/data/xml/dialogue-with-several-paragraphs.xml
 t/screenplay/data/xml/nested-s.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
+t/screenplay/data/xml/with-numeric-entities.xml
 t/screenplay/data/xml/with-tags-inside-paragraphs.xml
 t/screenplay/lib/run-test-1/XML/Grammar/Screenplay/ConfigData.pm
 t/screenplay/proto-text-invalid.t

File perl/modules/XML-Grammar-Fiction/lib/XML/Grammar/Fiction/FromProto/Parser/XmlIterator.pm

View file
 
         if ($$l =~ m{\G\&})
         {
-            if ($$l !~ m{\G(\&\w+;)}g)
+            if ($$l !~ m/\G(\&#?\w+;)/g)
             {
                 Carp::confess("Cannot match entity (e.g: \"&quot;\") at line " .
                     $self->line_num()

File perl/modules/XML-Grammar-Fiction/t/screenplay/data/proto-text/with-numeric-entities.txt

View file
+<s id="top">
+
+<s id="david_and_goliath">
+
+[David &amp; Goliath &lt;are&gt; standing by each other.
+
+David is a red-head. &quot;Hello&quot;&#91; Something in square brackets. &#93;
+
+Goliath is very tall.]
+
+David: I will kill you.
+
+Goliath: no way, you little idiot!
+
+David: yes way!
+
+++++: In the name of Allah, the merciful, 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 waiting.
+
+David: so you are.
+
+[David puts a stone in his sling and shoots Goliath. He hits.]
+
+</s>
+
+</s>

File perl/modules/XML-Grammar-Fiction/t/screenplay/data/xml/with-numeric-entities.xml

View file
+<?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 &amp; Goliath &lt;are&gt; standing by each other.
+        </para>
+        <para>
+            David is a red-head. "Hello"[ Something in square brackets. ]
+        </para>
+        <para>
+            Goliath is very tall.
+        </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 Allah, the merciful, 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 waiting.
+        </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>

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

View file
 
 use Test::More;
 
-use Test::XML tests => 32;
+use Test::XML tests => 34;
 
 use XML::LibXML;
 
         with-brs
         with-internal-description-at-start-of-line
         with-colon-inside-description
+        with-numeric-entities
     ));
 
-# TEST:$num_texts=16
+# TEST:$num_texts=17
 
 my $grammar = XML::Grammar::Screenplay::FromProto->new({
         parser_class => "XML::Grammar::Screenplay::FromProto::Parser::QnD",