[gnome-doc-utils/mallard] [mallard] Finishing block_list and xslt implementation



commit d22c730ed4c964f5eb8e5970245bbc89a9ec5657
Author: Shaun McCance <shaunm gnome org>
Date:   Fri May 22 19:05:21 2009 -0500

    [mallard] Finishing block_list and xslt implementation
---
 doc/mallard/C/mal_block_list.xml    |   99 +++++++++++++++++++++++++++++++++-
 xslt/mallard/html/mal2html-list.xsl |   26 ++++++++-
 2 files changed, 119 insertions(+), 6 deletions(-)

diff --git a/doc/mallard/C/mal_block_list.xml b/doc/mallard/C/mal_block_list.xml
index 75f8643..7668397 100644
--- a/doc/mallard/C/mal_block_list.xml
+++ b/doc/mallard/C/mal_block_list.xml
@@ -3,7 +3,7 @@
       id="mal_block_list">
 
 <info>
-  <version number="0.1" date="2007-02-21" status="stub"/>
+  <version number="0.1" date="2009-05-22" status="review"/>
 
   <credit type="author">
     <name>Shaun McCance</name>
@@ -15,6 +15,8 @@
   </copyright>
 
   <include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude"; />
+
+  <desc>Create a basic bulleted or numbered list.</desc>
 </info>
 
 <title>Basic Lists</title>
@@ -62,12 +64,12 @@ element.</p>
     which affects the markers used for each list item.  Allowed values are those
     from the <link href="http://www.w3.org/TR/css3-lists/";>CSS
     <code>list-style-type</code> property</link>.  Additionally, the value of
-    <code>"numeric"</code> can be used to select a numeric list type appropriate
+    <code>"numbered"</code> can be used to select a numbered list type appropriate
     for the page's language.</p></item>
 
     <item><p>If no <code>type</code> attribute is present, it is assumed to be a
     <link href="http://www.w3.org/TR/css3-lists/#glyphs";>glyph type</link> such
-    as <code>"disc"</code> or <code>"circle"</code>.  That is, list default to
+    as <code>"disc"</code> or <code>"circle"</code>.  That is, lists default to
     bulleted lists.</p></item>
 
     <item><p>The <code>style</code> attribute takes a space-separated list of
@@ -85,6 +87,84 @@ element.</p>
 <!-- BEGIN examples -->
 <section id="examples">
   <title>Examples</title>
+
+  <p>Create a basic unordered list:</p>
+
+  <example>
+    <code><![CDATA[
+<list>
+  <item><p><code>GTK_MESSAGE_INFO</code></p></item>
+  <item><p><code>GTK_MESSAGE_WARNING</code></p></item>
+  <item><p><code>GTK_MESSAGE_QUESTION</code></p></item>
+  <item><p><code>GTK_MESSAGE_ERROR</code></p></item>
+  <item><p><code>GTK_MESSAGE_OTHER</code></p></item>
+</list>
+]]></code>
+    <list>
+      <item><p><code>GTK_MESSAGE_INFO</code></p></item>
+      <item><p><code>GTK_MESSAGE_WARNING</code></p></item>
+      <item><p><code>GTK_MESSAGE_QUESTION</code></p></item>
+      <item><p><code>GTK_MESSAGE_ERROR</code></p></item>
+      <item><p><code>GTK_MESSAGE_OTHER</code></p></item>
+    </list>
+  </example>
+
+  <p>Create an unordered list with a title:</p>
+
+  <example>
+    <code><![CDATA[
+<list>
+  <title>Message Types</title>
+  <item><p><code>GTK_MESSAGE_INFO</code></p></item>
+  <item><p><code>GTK_MESSAGE_WARNING</code></p></item>
+  <item><p><code>GTK_MESSAGE_QUESTION</code></p></item>
+  <item><p><code>GTK_MESSAGE_ERROR</code></p></item>
+  <item><p><code>GTK_MESSAGE_OTHER</code></p></item>
+</list>
+]]></code>
+    <list>
+      <title>Message Types</title>
+      <item><p><code>GTK_MESSAGE_INFO</code></p></item>
+      <item><p><code>GTK_MESSAGE_WARNING</code></p></item>
+      <item><p><code>GTK_MESSAGE_QUESTION</code></p></item>
+      <item><p><code>GTK_MESSAGE_ERROR</code></p></item>
+      <item><p><code>GTK_MESSAGE_OTHER</code></p></item>
+    </list>
+  </example>
+
+  <p>Create a simple numbered list:</p>
+
+  <example>
+    <code><![CDATA[
+<list type="numbered">
+  <item><p>First</p></item>
+  <item><p>Second</p></item>
+  <item><p>Third</p></item>
+</list>
+]]></code>
+    <list type="numbered">
+      <item><p>First</p></item>
+      <item><p>Second</p></item>
+      <item><p>Third</p></item>
+    </list>
+  </example>
+
+  <p>Create a numbered list with Roman numerals:</p>
+
+  <example>
+    <code><![CDATA[
+<list type="upper-roman">
+  <item><p>First</p></item>
+  <item><p>Second</p></item>
+  <item><p>Third</p></item>
+</list>
+]]></code>
+    <list type="upper-roman">
+      <item><p>First</p></item>
+      <item><p>Second</p></item>
+      <item><p>Third</p></item>
+    </list>
+  </example>
 </section>
 <!-- END examples -->
 
@@ -93,6 +173,19 @@ element.</p>
 <section id="processing">
   <title>Processing Expectations</title>
 
+  <p>Lists are displayed as block elements, with each child <code>item</code>
+  displayed as a list item.  When present, the title should be displayed in a
+  way that makes it clear that it is the title of the list.  List items are
+  interpreted in the same way as <code>li</code> elements in HTML, except that
+  the <code>item</code> element only allows block-level child content.</p>
+
+  <p>Item markers are taken from the <code>type</code> attribute, which is
+  either a valid value of the <link href="http://www.w3.org/TR/css3-lists/";>CSS
+  <code>list-style-type</code> property</link>, or the special value
+  <code>"numbered"</code>.  When the <code>"numbered"</code> type is used, a
+  numeric marker type is chosen that is appropriate for the language of the
+  page.  The default numeric marker type per language may vary between
+  implementations.</p>
 </section>
 <!-- END processing -->
 
diff --git a/xslt/mallard/html/mal2html-list.xsl b/xslt/mallard/html/mal2html-list.xsl
index 051248d..ebd3312 100644
--- a/xslt/mallard/html/mal2html-list.xsl
+++ b/xslt/mallard/html/mal2html-list.xsl
@@ -36,7 +36,7 @@ REMARK: Describe this template
 -->
 <xsl:template name="mal2html.list.css">
 <xsl:text>
-ul.list { margin: 0; padding: 0; }
+ol.list, ul.list { margin: 0; padding: 0; }
 li.item-list { margin-left: 1.44em; }
 
 ul.tree {
@@ -61,6 +61,18 @@ div.tree-lines ul.tree ul.tree ul.tree {
 <!-- = list = -->
 <xsl:template mode="mal2html.block.mode" match="mal:list">
   <xsl:param name="first_child" select="not(preceding-sibling::*)"/>
+  <xsl:variable name="el">
+    <xsl:choose>
+      <xsl:when test="not(@type) or (@type = 'none') or (@type = 'box')
+                      or (@type = 'check') or (@type = 'circle') or (@type = 'diamond')
+                      or (@type = 'disc') or (@type = 'hyphen') or (@type = 'square')">
+        <xsl:text>ul</xsl:text>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:text>ol</xsl:text>
+      </xsl:otherwise>
+    </xsl:choose>
+  </xsl:variable>
   <div>
     <xsl:attribute name="class">
       <xsl:text>list</xsl:text>
@@ -68,9 +80,17 @@ div.tree-lines ul.tree ul.tree ul.tree {
         <xsl:text> first-child</xsl:text>
       </xsl:if>
     </xsl:attribute>
-    <ul class="list">
+    <xsl:element name="{$el}" namespace="{$mal2html.namespace}">
+      <xsl:attribute name="class">
+        <xsl:text>list</xsl:text>
+      </xsl:attribute>
+      <xsl:if test="@type">
+        <xsl:attribute name="style">
+          <xsl:value-of select="concat('list-style-type:', @type)"/>
+        </xsl:attribute>
+      </xsl:if>
       <xsl:apply-templates mode="mal2html.list.list.mode" select="mal:item"/>
-    </ul>
+    </xsl:element>
   </div>
 </xsl:template>
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]