[yelp-xsl] dita2html-list: Implemented choices and dl



commit 141956239d2beebb0d01850cb0ea5d8fe916450f
Author: Shaun McCance <shaunm gnome org>
Date:   Sat Oct 6 22:02:18 2012 -0400

    dita2html-list: Implemented choices and dl

 xslt/dita/common/dita-selectors.mod |   55 ++++++++++++++++++-
 xslt/dita/html/dita2html-list.xsl   |  101 +++++++++++++++++++++++++++++++++++
 xslt/dita/html/dita2html-topic.xsl  |    5 ++-
 3 files changed, 157 insertions(+), 4 deletions(-)
---
diff --git a/xslt/dita/common/dita-selectors.mod b/xslt/dita/common/dita-selectors.mod
index 7232448..539efeb 100644
--- a/xslt/dita/common/dita-selectors.mod
+++ b/xslt/dita/common/dita-selectors.mod
@@ -45,6 +45,41 @@ topic/desc
 <!ENTITY topic_desc "*[name(.) = 'desc' or starts-with(@class, '- topic/desc ')]">
 
 <!-- ===========================================================================
+topic/dd
+-->
+<!ENTITY topic_dd "*[name(.) = 'dd' or starts-with(@class, '- topic/dd ')]">
+
+<!-- ===========================================================================
+topic/ddhd
+-->
+<!ENTITY topic_ddhd "*[name(.) = 'ddhd' or starts-with(@class, '- topic/ddhd ')]">
+
+<!-- ===========================================================================
+topic/dl
+-->
+<!ENTITY topic_dl "*[name(.) = 'dl' or starts-with(@class, '- topic/dl ')]">
+
+<!-- ===========================================================================
+topic/dlentry
+-->
+<!ENTITY topic_dlentry "*[name(.) = 'dlentry' or starts-with(@class, '- topic/dlentry ')]">
+
+<!-- ===========================================================================
+topic/dlhead
+-->
+<!ENTITY topic_dlhead "*[name(.) = 'dlhead' or starts-with(@class, '- topic/dlhead ')]">
+
+<!-- ===========================================================================
+topic/dt
+-->
+<!ENTITY topic_dt "*[name(.) = 'dt' or starts-with(@class, '- topic/dt ')]">
+
+<!-- ===========================================================================
+topic/dthd
+-->
+<!ENTITY topic_dthd "*[name(.) = 'dthd' or starts-with(@class, '- topic/dthd ')]">
+
+<!-- ===========================================================================
 topic/fig
 -->
 <!ENTITY topic_fig "*[name(.) = 'fig' or starts-with(@class, '- topic/fig ')]">
@@ -79,6 +114,8 @@ topic/keyword
 <!-- ===========================================================================
 topic/li
 -->
+<!ENTITY topic_choice "*[
+  name(.) = 'choice' or starts-with(@class, '- topic/li task/choice ')]">
 <!ENTITY topic_step "*[
   name(.) = 'step' or starts-with(@class, '- topic/li task/step ')]">
 <!ENTITY topic_stepsection "*[
@@ -86,14 +123,16 @@ topic/li
 <!ENTITY topic_substep "*[
   name(.) = 'substep' or starts-with(@class, '- topic/li task/substep ')]">
 <!ENTITY topic_li "*[
-name(.) = 'li' or (
+  name(.) = 'li' or (
   starts-with(@class, '- topic/li ')
+  and not(starts-with(@class, '- topic/li task/choice '))
   and not(starts-with(@class, '- topic/li task/step '))
   and not(starts-with(@class, '- topic/li task/stepsection '))
   and not(starts-with(@class, '- topic/li task/substep '))
   )]">
 <!ENTITY topic_li_all "*[
-  name(.) = 'li' or name(.) = 'step' or name(.) = 'stepsection' or name(.) = 'substep' or
+  name(.) = 'li' or name(.) = 'choice' or name(.) = 'step' or
+  name(.) = 'stepsection' or name(.) = 'substep' or
   starts-with(@class, '- topic/li ')
   ]">
 
@@ -297,4 +336,14 @@ topic/topic
 <!-- ===========================================================================
 topic/ul
 -->
-<!ENTITY topic_ul "*[name(.) = 'ul' or starts-with(@class, '- topic/ul ')]">
+<!ENTITY topic_choices "*[
+  name(.) = 'choices' or starts-with(@class, '- topic/ul task/choices ')]">
+<!ENTITY topic_ul "*[
+  name(.) = 'ul' or (
+  starts-with(@class, '- topic/ul ')
+  and not(starts-with(@class, '- topic/ul task/choices '))
+  )]">
+<!ENTITY topic_ul_all "*[
+  name(.) = 'ul' or name(.) = 'choices' or
+  starts-with(@class, '- topic/ul ')
+  ]">
diff --git a/xslt/dita/html/dita2html-list.xsl b/xslt/dita/html/dita2html-list.xsl
index bd5086a..8d9fe5f 100644
--- a/xslt/dita/html/dita2html-list.xsl
+++ b/xslt/dita/html/dita2html-list.xsl
@@ -35,6 +35,107 @@ REMARK: Describe this module
 
 <!-- == Matched Templates == -->
 
+<!-- = choice = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_choice;">
+  <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>
+
+<!-- = choices = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_choices;">
+  <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
+  <div class="list">
+    <xsl:copy-of select="@id"/>
+    <xsl:call-template name="html.lang.attrs"/>
+    <div class="inner">
+      <ul class="list">
+        <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
+      </ul>
+    </div>
+  </div>
+</xsl:template>
+
+<!-- = dd = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_dd;">
+  <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
+  <dd class="terms">
+    <xsl:copy-of select="@id"/>
+    <xsl:call-template name="html.lang.attrs"/>
+    <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
+  </dd>
+</xsl:template>
+
+<!-- = ddhd = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_ddhd;">
+  <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
+  <dd class="terms ddhd">
+    <xsl:copy-of select="@id"/>
+    <xsl:call-template name="html.lang.attrs"/>
+    <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
+  </dd>
+</xsl:template>
+
+<!-- = dl = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_dl;">
+  <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="terms">
+    <xsl:copy-of select="@id"/>
+    <xsl:call-template name="html.lang.attrs"/>
+    <dl>
+      <xsl:attribute name="class">
+        <xsl:text>terms</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()"/>
+    </dl>
+  </div>
+</xsl:template>
+
+<!-- = dlentry = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_dlentry;">
+  <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
+  <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
+</xsl:template>
+
+<!-- = dlhead = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_dlhead;">
+  <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
+  <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
+</xsl:template>
+
+<!-- = dt = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_dt;">
+  <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
+  <dt class="terms">
+    <xsl:copy-of select="@id"/>
+    <xsl:call-template name="html.lang.attrs"/>
+    <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
+  </dt>
+</xsl:template>
+
+<!-- = dthd = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_dthd;">
+  <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
+  <dt class="terms dthd">
+    <xsl:copy-of select="@id"/>
+    <xsl:call-template name="html.lang.attrs"/>
+    <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
+  </dt>
+</xsl:template>
+
 <!-- = li = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_li;">
   <xsl:variable name="conref" select="yelp:dita.ref.conref(.)"/>
diff --git a/xslt/dita/html/dita2html-topic.xsl b/xslt/dita/html/dita2html-topic.xsl
index ac4acb4..602b9d7 100644
--- a/xslt/dita/html/dita2html-topic.xsl
+++ b/xslt/dita/html/dita2html-topic.xsl
@@ -93,7 +93,10 @@ li.stepsection {
 }
 ul.list-sli { list-style-type: none; }
 ul.compact-sli li { margin-top: 0; line-height: 1.44em; }
-
+dt.dthd, dd.ddhd {
+  font-weight: bold;
+  color: </xsl:text><xsl:value-of select="$color.text_light"/><xsl:text>;
+}
 th, td { border: solid 1px; }
 
 <!-- FIXME: perhaps into html.xsl? -->



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