[yelp-xsl] db2html-footnote: Fixed footnote formatting
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp-xsl] db2html-footnote: Fixed footnote formatting
- Date: Fri, 11 Nov 2011 12:55:08 +0000 (UTC)
commit d10785f83382e6c9f0156957bf84cca81fda6abf
Author: Shaun McCance <shaunm gnome org>
Date: Thu Nov 10 15:05:50 2011 -0500
db2html-footnote: Fixed footnote formatting
xslt/docbook/html/db2html-css.xsl | 31 ++++++-
xslt/docbook/html/db2html-footnote.xsl | 160 ++++++++++----------------------
xslt/gettext/gettext.xsl | 5 -
3 files changed, 80 insertions(+), 116 deletions(-)
---
diff --git a/xslt/docbook/html/db2html-css.xsl b/xslt/docbook/html/db2html-css.xsl
index cdf7202..ac73352 100644
--- a/xslt/docbook/html/db2html-css.xsl
+++ b/xslt/docbook/html/db2html-css.xsl
@@ -79,6 +79,36 @@ div.programlisting .userinput {
}
div.verbatim { white-space: pre; }
+<!-- == footnotes == -->
+div.footnotes {
+ border-top: solid 2px </xsl:text>
+ <xsl:value-of select="$color.gray_border"/><xsl:text>;
+}
+div.footnote { margin-top: 1.44em; }
+sup.footnote { font-size: 0.83em; }
+a.footnote {
+ font-weight: bold;
+ text-decoration: none;
+ border-bottom: none;
+ padding: 0.2em 0.5em 0.2em 0.5em;
+ -moz-border-radius: 2px;
+ -webkit-border-radius: 2px;
+ border-radius: 2px;
+}
+div.footnote > a.footnote {
+ margin-</xsl:text><xsl:value-of select="$right"/><xsl:text>: 0.83em;
+ background-color: </xsl:text><xsl:value-of select="$color.gray_background"/><xsl:text>;
+}
+div.footnote > a.footnote + p { display: inline-block; margin: 0; }
+a.footnote:hover, div.footnote > a.footnote:hover {
+ background-color: </xsl:text><xsl:value-of select="$color.blue_background"/><xsl:text>;
+ -moz-box-shadow: 0 0 2px </xsl:text>
+ <xsl:value-of select="$color.blue_border"/><xsl:text>;
+ -webkit-box-shadow: 0 0 2px </xsl:text>
+ <xsl:value-of select="$color.blue_border"/><xsl:text>;
+ box-shadow: 0 0 2px </xsl:text>
+ <xsl:value-of select="$color.blue_border"/><xsl:text>;
+}
<!-- == unsorted == -->
dl.index dt { margin-top: 0; }
@@ -162,7 +192,6 @@ div.co {
clear: both;
}
</xsl:text>
-<xsl:call-template name="db2html.footnote.css"/>
</xsl:template>
</xsl:stylesheet>
diff --git a/xslt/docbook/html/db2html-footnote.xsl b/xslt/docbook/html/db2html-footnote.xsl
index 2710a89..e660bc7 100644
--- a/xslt/docbook/html/db2html-footnote.xsl
+++ b/xslt/docbook/html/db2html-footnote.xsl
@@ -24,20 +24,21 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
<!--!!==========================================================================
DocBook to HTML - Footnotes
-:Requires: db-chunk
FIXME: Describe this module
-->
<!--**==========================================================================
-db2html.footnote.ref
-Generates a superscript link to a footnote
-$node: The #{footnote} element to process
+db2html.footnote.link
+Output a link to a footnote.
+:Revision:version="3.4" date="2011-11-10" status="final"
+$node: The #{footnote} element to process.
-REMARK: Describe this template
+This templates outputs an inline link to the footnote displayed at the bottom
+of the page.
-->
-<xsl:template name="db2html.footnote.ref">
+<xsl:template match="footnote | db:footnote" name="db2html.footnote.link">
<xsl:param name="node" select="."/>
<xsl:variable name="anchor">
<xsl:text>-noteref-</xsl:text>
@@ -68,12 +69,9 @@ REMARK: Describe this template
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <a name="{$anchor}"/>
- <sup>
- <a class="footnote" href="{$href}">
- <xsl:call-template name="db.number">
- <xsl:with-param name="node" select="$node"/>
- </xsl:call-template>
+ <sup class="footnote">
+ <a class="footnote" href="{$href}" id="{$anchor}">
+ <xsl:value-of select="count($node/preceding::footnote | $node/preceding::db:footnote) + 1"/>
</a>
</sup>
</xsl:template>
@@ -81,10 +79,11 @@ REMARK: Describe this template
<!--**==========================================================================
db2html.footnote.note
-Generates a footnote
-$node: The #{footnote} element to process
+Output a footnote.
+:Revision:version="3.4" date="2011-11-10" status="final"
+$node: The #{footnote} element to process.
-REMARK: Describe this template
+This templates outputs the actual text of a footnote as a block-level element.
-->
<xsl:template name="db2html.footnote.note">
<xsl:param name="node" select="."/>
@@ -117,15 +116,10 @@ REMARK: Describe this template
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <div class="footnote">
- <a name="{$anchor}"/>
- <span class="footnote-number">
- <a class="footnote-ref" href="{$href}">
- <xsl:call-template name="db.number">
- <xsl:with-param name="node" select="$node"/>
- </xsl:call-template>
- </a>
- </span>
+ <div class="footnote" id="{$anchor}">
+ <a class="footnote" href="{$href}">
+ <xsl:value-of select="count($node/preceding::footnote | $node/preceding::db:footnote) + 1"/>
+ </a>
<xsl:apply-templates select="$node/node()"/>
</div>
</xsl:template>
@@ -133,11 +127,15 @@ REMARK: Describe this template
<!--**==========================================================================
db2html.footnote.footer
-Generates a foot containing all the footnotes in the chunk
-$node: The division element containing footnotes
-$depth_of_chunk: The depth of the containing chunk in the document
-
-REMARK: Describe this template
+Output all footnotes for a page.
+:Revision:version="3.4" date="2011-11-10" status="final"
+$node: The division-level element containing footnotes
+$depth_of_chunk: The depth of the containing chunk in the document.
+
+This template collects all #{footnote} elements under ${node} and outputs them
+with *{db2html.footnote.note}. It checks if each footnote would be displayed on
+a separate page by a child division-level element, and if so, it doesn't output
+that footnote.
-->
<xsl:template name="db2html.footnote.footer">
<xsl:param name="node" select="."/>
@@ -145,90 +143,32 @@ REMARK: Describe this template
<xsl:call-template name="db.chunk.depth-of-chunk"/>
</xsl:param>
<xsl:variable name="notes" select="$node//footnote | $node//db:footnote" />
- <xsl:if test="count($notes) != 0">
- <xsl:call-template name="db2html.footnote.footer.sibling">
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
- <xsl:with-param name="notes" select="$notes"/>
- <xsl:with-param name="pos" select="1"/>
- <xsl:with-param name="div" select="false()"/>
- </xsl:call-template>
- </xsl:if>
-</xsl:template>
-
-<!--#* db2html.footnote.footer.sibling -->
-<xsl:template name="db2html.footnote.footer.sibling">
- <xsl:param name="node"/>
- <xsl:param name="depth_of_chunk"/>
- <xsl:param name="notes"/>
- <xsl:param name="pos"/>
- <xsl:param name="div"/>
- <xsl:variable name="this" select="$notes[$pos]"/>
- <xsl:variable name="depth">
- <xsl:call-template name="db.chunk.depth-of-chunk">
- <xsl:with-param name="node" select="$this"/>
- </xsl:call-template>
+ <xsl:variable name="include">
+ <xsl:for-each select="$notes">
+ <xsl:variable name="depth">
+ <xsl:call-template name="db.chunk.depth-of-chunk"/>
+ </xsl:variable>
+ <xsl:choose>
+ <xsl:when test="$depth = $depth_of_chunk">
+ <xsl:text>y</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>x</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:for-each>
</xsl:variable>
- <xsl:choose>
- <xsl:when test="($depth = $depth_of_chunk) and not($div)">
- <div class="footnotes">
- <xsl:call-template name="db2html.footnote.note">
- <xsl:with-param name="node" select="$this"/>
- </xsl:call-template>
- <xsl:if test="$pos < count($notes)">
- <xsl:call-template name="db2html.footnote.footer.sibling">
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
- <xsl:with-param name="notes" select="$notes"/>
- <xsl:with-param name="pos" select="$pos + 1"/>
- <xsl:with-param name="div" select="true()"/>
+ <xsl:if test="contains($include, 'y')">
+ <div class="footnotes">
+ <xsl:for-each select="$notes">
+ <xsl:if test="substring($include, position(), 1) = 'y'">
+ <xsl:call-template name="db2html.footnote.note">
+ <xsl:with-param name="node" select="."/>
</xsl:call-template>
</xsl:if>
- </div>
- </xsl:when>
- <xsl:otherwise>
- <xsl:if test="$depth = $depth_of_chunk">
- <xsl:call-template name="db2html.footnote.note">
- <xsl:with-param name="node" select="$this"/>
- </xsl:call-template>
- </xsl:if>
- <xsl:if test="$pos < count($notes)">
- <xsl:call-template name="db2html.footnote.footer.sibling">
- <xsl:with-param name="node" select="$node"/>
- <xsl:with-param name="depth_of_chunk" select="$depth_of_chunk"/>
- <xsl:with-param name="notes" select="$notes"/>
- <xsl:with-param name="pos" select="$pos + 1"/>
- <xsl:with-param name="div" select="$div"/>
- </xsl:call-template>
- </xsl:if>
- </xsl:otherwise>
- </xsl:choose>
-</xsl:template>
-
-
-<!--**==========================================================================
-db2html.footnote.css
-Outputs CSS that controls the appearance of footnotes
-
-REMARK: Describe this template
--->
-<xsl:template name="db2html.footnote.css">
-<xsl:text>
-div.footnotes { font-style: italic; font-size: 0.8em; }
-div.footnote { margin-top: 1.44em; }
-span.footnote-number { display: inline; padding-right: 0.83em; }
-span.footnote-number + p { display: inline; }
-a.footnote { text-decoration: none; font-size: 0.8em; }
-a.footnote-ref { text-decoration: none; }
-</xsl:text>
-</xsl:template>
-
-
-<!-- == Matched Templates == -->
-
-<!-- = footnote = -->
-<xsl:template match="footnote | db:footnote">
- <xsl:call-template name="db2html.footnote.ref"/>
+ </xsl:for-each>
+ </div>
+ </xsl:if>
</xsl:template>
</xsl:stylesheet>
diff --git a/xslt/gettext/gettext.xsl b/xslt/gettext/gettext.xsl
index f719356..cdd25a6 100644
--- a/xslt/gettext/gettext.xsl
+++ b/xslt/gettext/gettext.xsl
@@ -22,11 +22,6 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
exclude-result-prefixes="msg str"
version="1.0">
-<!-- FIXME -->
-<xsl:template name="db.number"/>
-<xsl:template name="db.label"/>
-
-
<!--!!==========================================================================
Localized Strings
-->
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]