[yelp-xsl] dita: Implement some reference elements



commit 7e39abc8b1a925e9a0ca662020ab23ffceaa8857
Author: Shaun McCance <shaunm gnome org>
Date:   Sun Nov 11 18:32:08 2012 -0500

    dita: Implement some reference elements

 xslt/common/html.xsl                |    3 +-
 xslt/dita/common/dita-selectors.mod |   42 ++++++++++++++++++++++++++--------
 xslt/dita/html/dita2html-block.xsl  |   25 +++++++++++++++++++-
 3 files changed, 57 insertions(+), 13 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index fa99eda..36a9796 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -1133,7 +1133,8 @@ ol.steps .steps {
 }
 li.steps { margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 1.44em; }
 li.steps li.steps { margin-</xsl:text><xsl:value-of select="$left"/><xsl:text>: 2.4em; }
-div.synopsis > div.inner > div.region > div.contents, div.synopsis > pre.contents {
+div.synopsis > div.inner > div.region > div.contents,
+div.synopsis > div.contents, div.synopsis > pre.contents {
   padding: 0.5em 1em 0.5em 1em;
   border-top: solid 1px;
   border-bottom: solid 1px;
diff --git a/xslt/dita/common/dita-selectors.mod b/xslt/dita/common/dita-selectors.mod
index 1910828..d456628 100644
--- a/xslt/dita/common/dita-selectors.mod
+++ b/xslt/dita/common/dita-selectors.mod
@@ -55,15 +55,29 @@ topic/alt
 topic/body
 -->
 <!ENTITY topic_body "*[
-  name(.) = 'body' or name(.) = 'conbody' or name(.) = 'taskbody' or
+  name(.) = 'body' or name(.) = 'conbody' or name(.) = 'refbody' or
+  name(.) = 'taskbody' or
   starts-with(@class, '- topic/body ')
   ]">
 <!ENTITY topic_body_all "*[
-  name(.) = 'body' or name(.) = 'conbody' or name(.) = 'taskbody' or
+  name(.) = 'body' or name(.) = 'conbody' or name(.) = 'refbody' or
+  name(.) = 'taskbody' or
   starts-with(@class, '- topic/body ')
   ]">
 
 <!-- ===========================================================================
+topic/bodydiv
+-->
+<!ENTITY topic_bodydiv "*[
+  name(.) = 'bodydiv' or name(.) = 'conbodydiv' or name(.) = 'refbodydiv' or
+  starts-with(@class, '- topic/bodydiv ')
+  ]">
+<!ENTITY topic_bodydiv_all "*[
+  name(.) = 'bodydiv' or name(.) = 'conbodydiv' or name(.) = 'refbodydiv' or
+  starts-with(@class, '- topic/bodydiv ')
+  ]">
+
+<!-- ===========================================================================
 topic/desc
 -->
 <!ENTITY topic_desc "*[name(.) = 'desc' or starts-with(@class, '- topic/desc ')]">
@@ -288,6 +302,8 @@ topic/section
   name(.) = 'postreq' or starts-with(@class, '- topic/section task/postreq ')]">
 <!ENTITY topic_prereq  "*[
   name(.) = 'prereq'  or starts-with(@class, '- topic/section task/prereq ')]">
+<!ENTITY topic_refsyn  "*[
+  name(.) = 'refsyn'  or starts-with(@class, '- topic/section reference/refsyn ')]">
 <!ENTITY topic_result  "*[
   name(.) = 'result'  or starts-with(@class, '- topic/section task/result ')]">
 <!ENTITY topic_steps-informal "*[
@@ -298,12 +314,14 @@ topic/section
   and not(starts-with(@class, '- topic/section task/context '))
   and not(starts-with(@class, '- topic/section task/postreq '))
   and not(starts-with(@class, '- topic/section task/prereq '))
+  and not(starts-with(@class, '- topic/section reference/refsyn '))
   and not(starts-with(@class, '- topic/section task/result '))
   and not(starts-with(@class, '- topic/section task/steps-informal '))
   )]">
 <!ENTITY topic_section_all "*[
   name(.) = 'section' or name(.) = 'context' or name(.) = 'prereq' or
-  name(.) = 'postreq' or name(.) = 'result'  or name(.) = 'steps-informal' or
+  name(.) = 'postreq' or name(.) = 'refsyn'  or name(.) = 'result' or
+  name(.) = 'steps-informal' or
   starts-with(@class, '- topic/section ')
   ]">
 
@@ -316,7 +334,7 @@ topic/shortdesc
 topic/simpletable
 -->
 <!ENTITY topic_simpletable "*[
-  name(.) = 'simpletable' or name(.) = 'choicetable' or
+  name(.) = 'simpletable' or name(.) = 'choicetable' or name(.) = 'properties' or
   starts-with(@class, '- topic/simpletable ')
   ]">
 
@@ -334,8 +352,10 @@ topic/sli
 topic/stentry
 -->
 <!ENTITY topic_stentry "*[
-  name(.) = 'stentry' or name(.) = 'chdesc' or name(.) = 'chdeschd' or
-  name(.) = 'choption' or name(.) = 'choptionhd' or
+  name(.) = 'stentry'    or name(.) = 'chdesc'      or name(.) = 'chdeschd'   or
+  name(.) = 'choption'   or name(.) = 'choptionhd'  or name(.) = 'propdesc'   or
+  name(.) = 'proptype'   or name(.) = 'propvalue'   or name(.) = 'propdeschd' or
+  name(.) = 'proptypehd' or name(.) = 'propvaluehd' or
   starts-with(@class, '- topic/stentry ')
   ]">
 
@@ -343,7 +363,7 @@ topic/stentry
 topic/sthead
 -->
 <!ENTITY topic_sthead "*[
-  name(.) = 'sthead' or name(.) = 'chhead' or
+  name(.) = 'sthead' or name(.) = 'chhead' or name(.) = 'prophead' or
   starts-with(@class, '- topic/sthead ')
   ]">
 
@@ -351,7 +371,7 @@ topic/sthead
 topic/strow
 -->
 <!ENTITY topic_strow "*[
-  name(.) = 'strow' or name(.) = 'chrow' or
+  name(.) = 'strow' or name(.) = 'chrow' or name(.) = 'property' or
   starts-with(@class, '- topic/strow ')
   ]">
 
@@ -384,11 +404,13 @@ topic/titlealts
 topic/topic
 -->
 <!ENTITY topic_topic "*[
-  name(.) = 'topic' or name(.) = 'concept' or name(.) = 'task' or
+  name(.) = 'topic' or name(.) = 'concept' or name(.) = 'reference' or
+  name(.) = 'task' or
   starts-with(@class, '- topic/topic ')
   ]">
 <!ENTITY topic_topic_all "*[
-  name(.) = 'topic' or name(.) = 'concept' or name(.) = 'task' or
+  name(.) = 'topic' or name(.) = 'concept' or name(.) = 'reference' or
+  name(.) = 'task' or
   starts-with(@class, '- topic/topic ')
   ]">
 
diff --git a/xslt/dita/html/dita2html-block.xsl b/xslt/dita/html/dita2html-block.xsl
index e90cc26..7c0f068 100644
--- a/xslt/dita/html/dita2html-block.xsl
+++ b/xslt/dita/html/dita2html-block.xsl
@@ -58,7 +58,9 @@ FIXME
         <xsl:value-of select="$class"/>
       </xsl:attribute>
     </xsl:if>
-    <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
+    <div class="contents">
+      <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
+    </div>
   </div>
 </xsl:template>
 
@@ -105,13 +107,18 @@ FIXME
   <xsl:param name="node" select="."/>
   <xsl:param name="class" select="''"/>
   <xsl:variable name="conref" select="yelp:dita.ref.conref($node)"/>
-  <div class="code">
+  <div>
     <xsl:call-template name="dita.id">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
     <xsl:call-template name="html.lang.attrs">
       <xsl:with-param name="node" select="$node"/>
     </xsl:call-template>
+    <xsl:if test="$class != ''">
+      <xsl:attribute name="class">
+        <xsl:value-of select="$class"/>
+      </xsl:attribute>
+    </xsl:if>
     <pre class="contents">
       <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/>
     </pre>
@@ -121,6 +128,13 @@ FIXME
 
 <!-- == Matched Templates == -->
 
+<!-- = bodydiv = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_bodydiv_all;">
+  <xsl:call-template name="dita2html.div">
+    <xsl:with-param name="class" select="'bodydiv'"/>
+  </xsl:call-template>
+</xsl:template>
+
 <!-- = cmd = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_cmd;">
   <xsl:call-template name="dita2html.p"/>
@@ -257,6 +271,13 @@ FIXME
   </xsl:call-template>
 </xsl:template>
 
+<!-- = refsyn = -->
+<xsl:template mode="dita2html.topic.mode" match="&topic_refsyn;">
+  <xsl:call-template name="dita2html.div">
+    <xsl:with-param name="class" select="'synopsis'"/>
+  </xsl:call-template>
+</xsl:template>
+
 <!-- = result = -->
 <xsl:template mode="dita2html.topic.mode" match="&topic_result;">
   <xsl:call-template name="dita2html.div">



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