[yelp-xsl] dita2html-list: Support sli, @compact



commit 2312de371e2605f86200349553d1020db3ce8858
Author: Shaun McCance <shaunm gnome org>
Date:   Fri Oct 5 22:55:48 2012 -0400

    dita2html-list: Support sli, @compact

 xslt/dita/common/dita-selectors.mod |   10 +++++
 xslt/dita/html/dita2html-list.xsl   |   73 ++++++++++++++++++++++++++++++++++-
 xslt/dita/html/dita2html-topic.xsl  |    2 +
 3 files changed, 83 insertions(+), 2 deletions(-)
---
diff --git a/xslt/dita/common/dita-selectors.mod b/xslt/dita/common/dita-selectors.mod
index fe5f8ab..7232448 100644
--- a/xslt/dita/common/dita-selectors.mod
+++ b/xslt/dita/common/dita-selectors.mod
@@ -248,6 +248,16 @@ topic/simpletable
 <!ENTITY topic_simpletable "*[name(.) = 'simpletable' or starts-with(@class, '- topic/simpletable ')]">
 
 <!-- ===========================================================================
+topic/sl
+-->
+<!ENTITY topic_sl "*[name(.) = 'sl' or starts-with(@class, '- topic/sl ')]">
+
+ <!-- ===========================================================================
+topic/sli
+-->
+<!ENTITY topic_sli "*[name(.) = 'sli' or starts-with(@class, '- topic/sli ')]">
+
+<!-- ===========================================================================
 topic/stentry
 -->
 <!ENTITY topic_stentry "*[name(.) = 'stentry' or starts-with(@class, '- topic/stentry ')]">
diff --git a/xslt/dita/html/dita2html-list.xsl b/xslt/dita/html/dita2html-list.xsl
index 73eb809..bd5086a 100644
--- a/xslt/dita/html/dita2html-list.xsl
+++ b/xslt/dita/html/dita2html-list.xsl
@@ -48,17 +48,73 @@ REMARK: Describe this module
 <!-- = ol = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_ol;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
+  <xsl:variable name="compact">
+    <xsl:call-template name="dita.ref.conref.attr">
+      <xsl:with-param name="attr" select="'compact'"/>
+      <xsl:with-param name="node" select="."/>
+      <xsl:with-param name="conref" select="$conref"/>
+    </xsl:call-template>
+  </xsl:variable>
   <div class="list">
     <xsl:copy-of select="@id"/>
     <xsl:call-template name="html.lang.attrs"/>
     <div class="inner">
-      <ol class="list">
+      <ol>
+        <xsl:attribute name="class">
+          <xsl:text>list</xsl:text>
+          <xsl:if test="$compact = 'yes'">
+            <xsl:text> compact</xsl:text>
+          </xsl:if>
+        </xsl:attribute>
         <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
       </ol>
     </div>
   </div>
 </xsl:template>
 
+<!-- = sl = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_sl;">
+  <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
+  <xsl:variable name="compact">
+    <xsl:call-template name="dita.ref.conref.attr">
+      <xsl:with-param name="attr" select="'compact'"/>
+      <xsl:with-param name="node" select="."/>
+      <xsl:with-param name="conref" select="$conref"/>
+    </xsl:call-template>
+  </xsl:variable>
+  <div class="list">
+    <xsl:copy-of select="@id"/>
+    <xsl:call-template name="html.lang.attrs"/>
+    <div class="inner">
+      <ul>
+        <xsl:attribute name="class">
+          <xsl:text>list list-sli</xsl:text>
+          <!-- Non-compact sl is compact other lists. Compact sl is compacter. -->
+          <xsl:choose>
+            <xsl:when test="$compact = 'yes'">
+              <xsl:text> compact-sli</xsl:text>
+            </xsl:when>
+            <xsl:otherwise>
+              <xsl:text> compact</xsl:text>
+            </xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+        <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
+      </ul>
+    </div>
+  </div>
+</xsl:template>
+
+<!-- = sli = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_sli;">
+  <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
+  <li class="list">
+    <xsl:copy-of select="@id"/>
+    <xsl:call-template name="html.lang.attrs"/>
+    <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
+  </li>
+</xsl:template>
+
 <!-- = step = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_step;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
@@ -137,11 +193,24 @@ REMARK: Describe this module
 <!-- = ul = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_ul;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
+  <xsl:variable name="compact">
+    <xsl:call-template name="dita.ref.conref.attr">
+      <xsl:with-param name="attr" select="'compact'"/>
+      <xsl:with-param name="node" select="."/>
+      <xsl:with-param name="conref" select="$conref"/>
+    </xsl:call-template>
+  </xsl:variable>
   <div class="list">
     <xsl:copy-of select="@id"/>
     <xsl:call-template name="html.lang.attrs"/>
     <div class="inner">
-      <ul class="list">
+      <ul>
+        <xsl:attribute name="class">
+          <xsl:text>list</xsl:text>
+          <xsl:if test="$compact = 'yes'">
+            <xsl:text> compact</xsl:text>
+          </xsl:if>
+        </xsl:attribute>
         <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
       </ul>
     </div>
diff --git a/xslt/dita/html/dita2html-topic.xsl b/xslt/dita/html/dita2html-topic.xsl
index 3dde5c6..ac4acb4 100644
--- a/xslt/dita/html/dita2html-topic.xsl
+++ b/xslt/dita/html/dita2html-topic.xsl
@@ -91,6 +91,8 @@ li.stepsection {
   margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 0;
   list-style-type: none;
 }
+ul.list-sli { list-style-type: none; }
+ul.compact-sli li { margin-top: 0; line-height: 1.44em; }
 
 th, td { border: solid 1px; }
 



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