Commits

shl...@52c325ad-5fd0-0310-8a0f-c43feede02cc  committed 500e124

Fixed a bug with the handling of the comments. Called the wrong method.

This was a regression since 0.0.1. Also added a test.

  • Participants
  • Parent commits ef6f2ce

Comments (0)

Files changed (5)

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

 t/data/proto-text/nested-s.txt
 t/data/proto-text/scenes-with-titles.txt
 t/data/proto-text/sections-and-paras.txt
+t/data/proto-text/sections-p-b-i-comments.txt
 t/data/proto-text/sections-p-b-i.txt
 t/data/proto-text/two-nested-s.txt
 t/data/proto-text/with-brs.txt
 t/data/xml/nested-s.xml
 t/data/xml/scenes-with-titles.xml
 t/data/xml/sections-and-paras.xml
+t/data/xml/sections-p-b-i-comments.xml
 t/data/xml/sections-p-b-i.xml
 t/data/xml/two-nested-s.xml
 t/data/xml/with-brs.xml

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

     {
         my $text = $self->_consume_up_to(qr{-->});
 
-        $self->_tags_stacks->[-1]->append_children(
+        $self->_tags_stack->[-1]->append_children(
             [
                 $self->_new_node({ t => "Comment", text => $text, })
             ]

File perl/modules/XML-Grammar-Fiction/t/data/proto-text/sections-p-b-i-comments.txt

+<body id="index">
+
+<title>David vs. Goliath - Part I</title>
+
+<s id="top">
+
+<title>The Top Section</title>
+
+<!-- David has Green hair here -->
+
+David 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>
+

File perl/modules/XML-Grammar-Fiction/t/data/xml/sections-p-b-i-comments.xml

+<?xml version='1.0' encoding='utf-8'?>
+<document xmlns="http://web-cpan.berlios.de/modules/XML-Grammar-Fortune/fiction-xml-0.2/" version="0.2">
+    <head>
+    </head>
+    <body xml:id="index">
+    <title>David vs. Goliath - Part I</title>
+    <section xml:id="top">
+    <title>The Top Section</title>
+    <!-- David has Green hair here -->
+    <p>
+    David and Goliath were standing by each other.    
+    </p>
+    <p>
+    David said unto Goliath: "I will shoot you. I <b>swear</b> I will"
+    </p>
+    <section xml:id="goliath">
+    <title>Goliath's Response</title>
+    <!-- Goliath has to reply to that. -->
+    <p>
+    Goliath was not amused.
+    </p>
+    <p>
+    He said to David: "Oh, really. <i>David</i>, the red-headed!".
+    </p>
+    </section>
+    </section>
+</body>
+</document>

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

 use strict;
 use warnings;
 
-use Test::More tests => 4;
+use Test::More tests => 6;
 
 use Test::XML;
 
 @tests = (qw(
     sections-and-paras
     sections-p-b-i
+    sections-p-b-i-comments
     ));
 
-# TEST:$num_texts=2
+# TEST:$num_texts=3
 
 my $grammar = XML::Grammar::Fiction::FromProto->new({
         parser_class => "XML::Grammar::Fiction::FromProto::Parser::QnD",