Anonymous avatar Anonymous committed d645f7f

Add <ol>,<li>,<ul> support to the -to-docbook XSLT.

Comments (0)

Files changed (4)

perl/modules/XML-Grammar-Fiction/MANIFEST

 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-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-invalid/inner-desc-inside-char-addressing.txt
 t/fiction/data/proto-text-invalid/leading-space-at-para-start.txt

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

             </xsl:choose> 
         </title>
     </info>
-        <xsl:apply-templates select="fic:section|fic:p" />
+        <xsl:apply-templates select="fic:section|fic:p|fic:ol|fic:ul" />
     </section>
 </xsl:template>
 
     </emphasis>
 </xsl:template>
 
+<xsl:template match="fic:ol">
+    <orderedlist>
+        <xsl:apply-templates/>
+    </orderedlist>
+</xsl:template>
+
+<xsl:template match="fic:ul">
+    <itemizedlist>
+        <xsl:apply-templates/>
+    </itemizedlist>
+</xsl:template>
+
+<xsl:template match="fic:li">
+    <listitem>
+        <xsl:apply-templates/>
+    </listitem>
+</xsl:template>
+
 <xsl:template match="fic:span">
     <xsl:choose>
         <xsl:when test="@xlink:href">

perl/modules/XML-Grammar-Fiction/t/fiction/data/docbook/with-ul-ol-li.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>
+    <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>
+    </section>
+  </section>
+</article>

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

 
 use Test::More;
 
-use Test::XML tests => 9;
+use Test::XML tests => 12;
 
 use File::Spec;
 
         sections-and-paras
         sections-p-b-i-comments
         sections-a-href
+        with-ul-ol-li
     ));
 
 sub load_xml
     return $contents;
 }
 
-# TEST:$num_texts=3
+# TEST:$num_texts=4
 
 my $converter = XML::Grammar::Fiction::ToDocBook->new({
         data_dir => File::Spec->catdir(File::Spec->curdir(), "extradata"),
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.