[yelp-xsl] db2html-callout: Implement calloutlist, cleanup



commit 8f8837904953b5fc4a386eeef099b22abcf1b2db
Author: Shaun McCance <shaunm gnome org>
Date:   Mon May 16 11:24:21 2011 -0400

    db2html-callout: Implement calloutlist, cleanup

 xslt/docbook/html/db2html-callout.xsl |  154 +++++++++++----------------------
 xslt/docbook/html/db2html-css.xsl     |   21 ++++-
 2 files changed, 70 insertions(+), 105 deletions(-)
---
diff --git a/xslt/docbook/html/db2html-callout.xsl b/xslt/docbook/html/db2html-callout.xsl
index 12473ed..476c793 100644
--- a/xslt/docbook/html/db2html-callout.xsl
+++ b/xslt/docbook/html/db2html-callout.xsl
@@ -18,133 +18,79 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                 xmlns:db="http://docbook.org/ns/docbook";
+                xmlns:str="http://exslt.org/strings";
                 xmlns="http://www.w3.org/1999/xhtml";
+                exclude-result-prefixes="db str"
                 version="1.0">
 
 <!--!!==========================================================================
 DocBook to HTML - Callouts
+:Requires: db2html-block db2html-xref html
+:Revision:version="1.0" date="2011-05-16" status="final"
 
-REMARK: Describe this module
+This modules handles simple DocBook callouts using the #{co} and #{callout}
+elements. Currently, only callouts to #{co} elements are supported. The
+#{area} element is not supported.
 -->
 
-<!--@@==========================================================================
-db2html.co.color
-The text color for callout dingbats
 
-REMARK: Describe this param
--->
-<xsl:param name="db2html.co.color" select="'#FFFFFF'"/>
-
-<!--@@==========================================================================
-db2html.co.background_color
-The background color for callout dingbats
-
-REMARK: Describe this param
--->
-<xsl:param name="db2html.co.background_color" select="'#000000'"/>
-
-<!--@@==========================================================================
-db2html.co.border_color
-The border color for callout dingbats
-
-REMARK: Describe this param
--->
-<xsl:param name="db2html.co.border_color" select="'#000000'"/>
-
-<!--@@==========================================================================
-db2html.co.color.hover
-The text color for callout dingbats when hovering
-
-REMARK: Describe this param
--->
-<xsl:param name="db2html.co.color.hover" select="'#FFFFFF'"/>
-
-<!--@@==========================================================================
-db2html.co.background_color.hover
-The background color for callout dingbats when hovering
-
-REMARK: Describe this param
--->
-<xsl:param name="db2html.co.background_color.hover" select="'#333333'"/>
-
-<!--@@==========================================================================
-db2html.co.border_color.hover
-The border color for callout dingbats when hovering.
-
-REMARK: Describe this param
--->
-<xsl:param name="db2html.co.border_color.hover" select="'#333333'"/>
+<xsl:key name="db2html.callout.key" match="co | db:co" use="@id | @xml:id"/>
 
 
 <!--**==========================================================================
-db2html.co.dingbat
-Creates a callout dingbat for a #{co} element
-$co: The #{co} element to create a callout dingbat for
-
-REMARK: Describe this template
+db2html.callout.label
+Create a callout label for a #{co} element.
+:Revision:version="1.0" date="2011-05-16" status="final"
+$node: The #{co} element to create a callout label for.
+
+This template creates a label for a callout, taking a #{co} element as the
+${node} parameter. The label is numbered according to the position of #{co}
+in the document. To create the corresponding label for a #{callout} element,
+locate the corresponding #{co} element and call this template on it.
 -->
-<xsl:template name="db2html.co.dingbat">
-  <xsl:param name="co" select="."/>
+<xsl:template name="db2html.callout.label">
+  <xsl:param name="node" select="."/>
   <span class="co">
-    <xsl:value-of select="count(preceding::co) + count(preceding::db:co) + 1"/>
+    <xsl:value-of select="count($node/preceding::co) + count($node/preceding::db:co) + 1"/>
   </span>
 </xsl:template>
 
 
-<!--**==========================================================================
-db2html.co.dingbats
-Renders a callout dingbat for each #{co} referenced in ${arearefs}
-$arearefs: A space-separated list of #{co} elements
+<!-- == Matched Templates == -->
 
-REMARK: Describe this template
--->
-<xsl:template name="db2html.co.dingbats">
-  <xsl:param name="arearefs" select="@arearefs"/>
-  <!-- FIXME -->
+<!-- = co = -->
+<xsl:template match="co | db:co">
+  <xsl:call-template name="db2html.callout.label"/>
 </xsl:template>
 
-
-<!--**==========================================================================
-db2html.callout.css
-Outputs CSS that controls the appearance of callouts
-
-REMARK: Describe this template
--->
-<xsl:template name="db2html.callout.css">
-<xsl:text>
-span.co {
-  margin-left: 0.2em; margin-right: 0.2em;
-  padding-left: 0.4em; padding-right: 0.4em;
-  border: solid 1px </xsl:text>
-  <xsl:value-of select="$db2html.co.border_color"/><xsl:text>;
-  border-radius: 8px;
-  -moz-border-radius: 8px;
-  -webkit-border-radius: 8px;
-  background-color: </xsl:text>
-  <xsl:value-of select="$db2html.co.background_color"/><xsl:text>;
-  color: </xsl:text>
-  <xsl:value-of select="$db2html.co.color"/><xsl:text>;
-  font-size: 8px;
-}
-span.co:hover {
-  border-color: </xsl:text>
-  <xsl:value-of select="$db2html.co.border_color.hover"/><xsl:text>;
-  background-color: </xsl:text>
-  <xsl:value-of select="$db2html.co.background_color.hover"/><xsl:text>;
-  color: </xsl:text>
-  <xsl:value-of select="$db2html.co.color.hover"/><xsl:text>;
-}
-span.co a { text-decoration: none; }
-span.co a:hover { text-decoration: none; }
-</xsl:text>
+<!-- = calloutlist = -->
+<xsl:template match="calloutlist | db:calloutlist">
+  <xsl:call-template name="db2html.block">
+    <xsl:with-param name="formal" select="true()"/>
+  </xsl:call-template>
 </xsl:template>
 
-
-<!-- == Matched Templates == -->
-
-<!-- = co = -->
-<xsl:template match="co | db:co">
-  <xsl:call-template name="db2html.co.dingbat"/>
+<!-- = callout == -->
+<xsl:template match="callout | db:callout">
+  <xsl:variable name="node" select="."/>
+  <div class="callout">
+    <xsl:call-template name="html.lang.attrs"/>
+    <xsl:call-template name="db2html.anchor"/>
+    <div class="co">
+      <xsl:for-each select="str:split(@arearefs)">
+        <xsl:variable name="arearef" select="string(.)"/>
+        <xsl:for-each select="$node">
+          <xsl:variable name="co" select="key('db2html.callout.key', $arearef)"/>
+          <xsl:if test="$co">
+            <xsl:call-template name="db2html.callout.label">
+              <xsl:with-param name="node" select="$co"/>
+            </xsl:call-template>
+          </xsl:if>
+        </xsl:for-each>
+      </xsl:for-each>
+    </div>
+    <xsl:apply-templates/>
+  </div>
 </xsl:template>
 
 </xsl:stylesheet>
diff --git a/xslt/docbook/html/db2html-css.xsl b/xslt/docbook/html/db2html-css.xsl
index 5e3b69f..973e815 100644
--- a/xslt/docbook/html/db2html-css.xsl
+++ b/xslt/docbook/html/db2html-css.xsl
@@ -160,9 +160,28 @@ div.qanda-label {
   font-weight: bold;
 }
 dl.qandaset ol, dl.qandaset ul, dl.qandaset table { clear: both; }
+
+span.co {
+  font-size: 0.83em;
+  margin: 0 0.2em 0 0.2em;
+  padding: 0 0.5em 0 0.5em;
+  border-radius: 1em;
+  -moz-border-radius: 1em;
+  -webkit-border-radius: 1em;
+  background-color: </xsl:text>
+  <xsl:value-of select="$color.yellow_background"/><xsl:text>;
+  border: solid 1px </xsl:text>
+  <xsl:value-of select="$color.yellow_border"/><xsl:text>;
+}
+span.co a { text-decoration: none; }
+span.co a:hover { text-decoration: none; }
+div.co {
+  margin: 0;
+  float: </xsl:text><xsl:value-of select="$left"/><xsl:text>;
+  clear: both;
+}
 </xsl:text>
 <xsl:call-template name="db2html.footnote.css"/>
-<xsl:call-template name="db2html.callout.css"/>
 </xsl:template>
 
 </xsl:stylesheet>



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