Commits

Anonymous committed ad2bff0

Add support for <blockquote> to Fiction-XML / Fiction-Text .

Comments (0)

Files changed (10)

perl/modules/XML-Grammar-Fiction/Changes

 
     * Updated some of the bug report URLs to read "XML-Grammar-Fiction"
     instead of "XML-Grammar-Screenplay".
+    * Add support for the <blockquote> tag to Fiction-XML / Fiction-Text.
 
 0.3.0       Tue May 17 22:59:17 IDT 2011
     * Add extradata/screenplay-xml-to-tei.xslt and 

perl/modules/XML-Grammar-Fiction/MANIFEST

 t/fiction/data/docbook/sections-a-href.docbook.xml
 t/fiction/data/docbook/sections-and-paras.docbook.xml
 t/fiction/data/docbook/sections-p-b-i-comments.docbook.xml
+t/fiction/data/docbook/with-blockquote.docbook.xml
 t/fiction/data/docbook/with-internal-description.docbook.xml
 t/fiction/data/docbook/with-ul-ol-li.docbook.xml
 t/fiction/data/proto-text/dialogue-with-several-paragraphs.txt
 t/fiction/data/proto-text/sections-p-b-i-comments.txt
 t/fiction/data/proto-text/sections-p-b-i.txt
 t/fiction/data/proto-text/two-nested-s.txt
+t/fiction/data/proto-text/with-blockquote.txt
 t/fiction/data/proto-text/with-brs.txt
 t/fiction/data/proto-text/with-comments.txt
 t/fiction/data/proto-text/with-description.txt
 t/fiction/data/xml/sections-p-b-i-comments.xml
 t/fiction/data/xml/sections-p-b-i.xml
 t/fiction/data/xml/two-nested-s.xml
+t/fiction/data/xml/with-blockquote.xml
 t/fiction/data/xml/with-brs.xml
 t/fiction/data/xml/with-comments.xml
 t/fiction/data/xml/with-description.xml

perl/modules/XML-Grammar-Fiction/extradata/fiction-xml-to-docbook.xslt

             </xsl:choose> 
         </title>
     </info>
-        <xsl:apply-templates select="fic:section|fic:p|fic:ol|fic:ul" />
+        <xsl:apply-templates select="fic:section|fic:blockquote|fic:p|fic:ol|fic:ul" />
     </section>
 </xsl:template>
 
     </para>
 </xsl:template>
 
-
 <xsl:template match="fic:b">
     <emphasis role="bold">
         <xsl:apply-templates/>
     </emphasis>
 </xsl:template>
 
+<xsl:template match="fic:blockquote">
+    <blockquote>
+        <xsl:apply-templates/>
+    </blockquote>
+</xsl:template>
+
 <xsl:template match="fic:i">
     <emphasis>
         <xsl:apply-templates/>

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

     <define name="several_paras">
         <zeroOrMore>
             <choice>
+                <ref name="blockquote"/>
                 <ref name="para"/>
                 <ref name="ol"/>
                 <ref name="ul"/>
             <ref name="inside_list" />
         </element>
     </define>
+    <define name="blockquote">
+        <element name="fic:blockquote">
+            <ref name="several_paras"/>
+        </element>
+    </define>
     <define name="li">
         <element name="fic:li">
             <oneOrMore>

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

     return;
 }
 
+sub _handle_elem_of_name_blockquote
+{
+    my ($self, $elem) = @_;
+
+    $self->_output_tag_with_childs(
+        {
+            start => ['blockquote'],
+            elem => $elem,
+        }
+    );
+
+    return;
+}
+
 
 sub _handle_elem_of_name_li
 {

perl/modules/XML-Grammar-Fiction/t/fiction/data/docbook/with-blockquote.docbook.xml

+<?xml version="1.0" encoding="UTF-8"?>
+<article xmlns="http://docbook.org/ns/docbook" xmlns:fic="http://web-cpan.berlios.de/modules/XML-Grammar-Fortune/fiction-xml-0.2/" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="index" xml:lang="">
+  <info>
+    <title>David vs. Goliath - Part I</title>
+  </info>
+  <section xml:id="top">
+    <info>
+      <title>The Top Section</title>
+    </info>
+    <para>
+        King <link xlink:href="http://en.wikipedia.org/wiki/David">David</link> and Goliath were standing by each other.    
+    </para>
+    <para>
+    David said unto Goliath: "I will shoot you. I <emphasis role="bold">swear</emphasis> I will"
+    </para>
+    <section xml:id="goliath">
+      <info>
+        <title>Goliath's Response</title>
+      </info>
+      <para>
+    Goliath was not amused.
+    </para>
+      <para>
+    He said to David: "Oh, really. <emphasis>David</emphasis>, the red-headed!".
+    </para>
+    <para>
+    David started listing Goliath's disadvantages:
+    </para>
+    <blockquote>
+    <orderedlist>
+    <listitem>
+    <para>
+    You're slow.
+    </para>
+    </listitem>
+    <listitem>
+    <para>
+    You're big.
+    </para>
+    </listitem>
+    <listitem>
+    <para>
+    You're stupid.
+    </para>
+    </listitem>
+    </orderedlist>
+    <para>
+    Goliath was insulted and told David he should use bullets for the
+    points, instead:
+    </para>
+    <itemizedlist>
+    <listitem>
+    <para>
+    David.
+    </para>
+    </listitem>
+    <listitem>
+    <para>
+    Saul.
+    </para>
+    </listitem>
+    <listitem>
+    <para>
+    Jonathan.
+    </para>
+    </listitem>
+    <listitem>
+    <para>
+    Michal.
+    </para>
+    </listitem>
+    <listitem>
+    <para>
+    Meyrav.
+    </para>
+    </listitem>
+    </itemizedlist>
+    </blockquote>
+    </section>
+  </section>
+</article>

perl/modules/XML-Grammar-Fiction/t/fiction/data/proto-text/with-blockquote.txt

+<body id="index">
+
+<title>David vs. Goliath - Part I</title>
+
+<s id="top">
+
+<title>The Top Section</title>
+
+<!-- David has Green hair here -->
+
+King <a href="http://en.wikipedia.org/wiki/David">David</a> 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!".
+
+David started listing Goliath's disadvantages:
+
+<blockquote>
+
+<ol>
+
+<li>
+
+You're slow.
+
+</li>
+
+<li>
+
+You're big.
+
+</li>
+
+<li>
+
+You're stupid.
+
+</li>
+
+</ol>
+
+Goliath was insulted and told David he should use bullets for the points, 
+instead:
+
+<ul>
+
+<li>
+
+David.
+
+</li>
+
+<li>
+
+Saul.
+
+</li>
+
+<li>
+
+Jonathan.
+
+</li>
+
+<li>
+
+Michal.
+
+</li>
+
+<li>
+
+Meyrav.
+
+</li>
+
+</ul>
+
+</blockquote>
+
+</s>
+
+</s>
+
+</body>
+

perl/modules/XML-Grammar-Fiction/t/fiction/data/xml/with-blockquote.xml

+<?xml version='1.0' encoding='utf-8'?>
+<document xmlns="http://web-cpan.berlios.de/modules/XML-Grammar-Fortune/fiction-xml-0.2/" xmlns:xlink="http://www.w3.org/1999/xlink" 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>
+    King <span xlink:href="http://en.wikipedia.org/wiki/David">David</span> 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>
+    <p>
+    David started listing Goliath's disadvantages:
+    </p>
+    <blockquote>
+    <ol>
+    <li>
+    <p>
+    You're slow.
+    </p>
+    </li>
+    <li>
+    <p>
+    You're big.
+    </p>
+    </li>
+    <li>
+    <p>
+    You're stupid.
+    </p>
+    </li>
+    </ol>
+    <p>
+    Goliath was insulted and told David he should use bullets for the
+    points, instead:
+    </p>
+    <ul>
+    <li>
+    <p>
+    David.
+    </p>
+    </li>
+    <li>
+    <p>
+    Saul.
+    </p>
+    </li>
+    <li>
+    <p>
+    Jonathan.
+    </p>
+    </li>
+    <li>
+    <p>
+    Michal.
+    </p>
+    </li>
+    <li>
+    <p>
+    Meyrav.
+    </p>
+    </li>
+    </ul>
+    </blockquote>
+    </section>
+    </section>
+</body>
+</document>

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

 use strict;
 use warnings;
 
-use Test::More tests => 10;
+use Test::More tests => 12;
 
 use Test::XML;
 
     sections-p-b-i-comments
     sections-a-href
     with-ul-ol-li
+    with-blockquote
     ));
 
-# TEST:$num_texts=5
+# TEST:$num_texts=6
 
 my $grammar = XML::Grammar::Fiction::FromProto->new({
         parser_class => "XML::Grammar::Fiction::FromProto::Parser::QnD",

perl/modules/XML-Grammar-Fiction/t/fiction/to-docbook.t

 
 use Test::More;
 
-use Test::XML tests => 12;
+use Test::XML tests => 15;
 
 use File::Spec;
 
         sections-p-b-i-comments
         sections-a-href
         with-ul-ol-li
+        with-blockquote
     ));
 
 sub load_xml
     return $contents;
 }
 
-# TEST:$num_texts=4
+# TEST:$num_texts=5
 
 my $converter = XML::Grammar::Fiction::ToDocBook->new({
         data_dir => File::Spec->catdir(File::Spec->curdir(), "extradata"),