[yelp-xsl] mal2html-links: Move links handling to own module, cleanup
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp-xsl] mal2html-links: Move links handling to own module, cleanup
- Date: Wed, 15 Jun 2011 21:42:20 +0000 (UTC)
commit bc632a6762f2c1a6e0e995bdbeb5e3c4f9899958
Author: Shaun McCance <shaunm gnome org>
Date: Wed Jun 15 17:46:05 2011 -0400
mal2html-links: Move links handling to own module, cleanup
xslt/common/html.xsl | 2 +-
xslt/mallard/html/Makefile.am | 1 +
xslt/mallard/html/mal2html-links.xsl | 570 ++++++++++++++++++++++++++++++++++
xslt/mallard/html/mal2html-page.xsl | 352 +--------------------
xslt/mallard/html/mal2html-ui.xsl | 9 +-
xslt/mallard/html/mal2xhtml.xsl | 1 +
6 files changed, 589 insertions(+), 346 deletions(-)
---
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl
index 00578a6..13b4004 100644
--- a/xslt/common/html.xsl
+++ b/xslt/common/html.xsl
@@ -684,7 +684,7 @@ div.contents + div.desc { margin: 0.2em 0 0 0; }
pre.contents {
padding: 0.5em 1em 0.5em 1em;
}
-div.links > div.title > span.title {
+div.links > div.inner > div.title span.title {
border-bottom: solid 1px </xsl:text>
<xsl:value-of select="$color.gray_border"/><xsl:text>;
}
diff --git a/xslt/mallard/html/Makefile.am b/xslt/mallard/html/Makefile.am
index 891147f..054ca9c 100644
--- a/xslt/mallard/html/Makefile.am
+++ b/xslt/mallard/html/Makefile.am
@@ -4,6 +4,7 @@ xsl_DATA = \
mal2html-block.xsl \
mal2html-facets.xsl \
mal2html-inline.xsl \
+ mal2html-links.xsl \
mal2html-list.xsl \
mal2html-media.xsl \
mal2html-page.xsl \
diff --git a/xslt/mallard/html/mal2html-links.xsl b/xslt/mallard/html/mal2html-links.xsl
new file mode 100644
index 0000000..ffa3f1e
--- /dev/null
+++ b/xslt/mallard/html/mal2html-links.xsl
@@ -0,0 +1,570 @@
+<?xml version='1.0' encoding='UTF-8'?><!-- -*- indent-tabs-mode: nil -*- -->
+<!--
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free
+Software Foundation; either version 2 of the License, or (at your option) any
+later version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this program; see the file COPYING.LGPL. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+02111-1307, USA.
+-->
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:mal="http://projectmallard.org/1.0/"
+ xmlns:ui="http://projectmallard.org/experimental/ui/"
+ xmlns:e="http://projectmallard.org/experimental/"
+ xmlns:exsl="http://exslt.org/common"
+ xmlns="http://www.w3.org/1999/xhtml"
+ exclude-result-prefixes="mal e exsl"
+ version="1.0">
+
+<!--!!==========================================================================
+Mallard to HTML - Links
+
+This stylesheet contains templates to handle automatic linking, both using the
+Mallard links element and implicitly.
+-->
+
+
+<!--**==========================================================================
+mal2html.links.ul
+Output links in an HTML #{ul} element.
+:Revision:version="1.0" date="2011-06-15" status="final"
+$links: A list of #{links}, as from a template in !{mal-link}.
+$role: A link role, used to select the appropriate title.
+$bold: Whether to bold the link titles.
+$nodesc: Whether to omit descriptions.
+
+This is a common formatting template used by some #{links} element handlers.
+It outputs an HTML #{ul} element and calls *{mal2html.links.ul.li} on each
+link to output a list item with a link.
+
+This template will handle sorting of the links.
+-->
+<xsl:template name="mal2html.links.ul">
+ <xsl:param name="links" select="/false"/>
+ <xsl:param name="role" select="''"/>
+ <xsl:param name="bold" select="false()"/>
+ <xsl:param name="nodesc" select="false()"/>
+ <ul>
+ <xsl:for-each select="$links">
+ <xsl:sort data-type="number" select="@groupsort"/>
+ <xsl:sort select="mal:title[ type = 'sort']"/>
+ <xsl:call-template name="mal2html.links.ul.li">
+ <xsl:with-param name="role" select="$role"/>
+ <xsl:with-param name="bold" select="$bold"/>
+ <xsl:with-param name="nodesc" select="$nodesc"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </ul>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.links.ul.li
+Output a list item with a link.
+:Revision:version="1.0" date="2011-06-15" status="final"
+$xref: An #{xref} string pointing to the target node.
+$role: A link role, used to select the appropriate title.
+$bold: Whether to bold the link titles.
+$nodesc: Whether to omit descriptions.
+
+This template is called by *{mal2html.links.ul} to output a list item with
+a link for each target.
+-->
+<xsl:template name="mal2html.links.ul.li">
+ <xsl:param name="xref" select="@xref"/>
+ <xsl:param name="role" select="''"/>
+ <xsl:param name="bold" select="false()"/>
+ <xsl:param name="nodesc" select="false()"/>
+ <xsl:for-each select="$mal.cache">
+ <xsl:variable name="target" select="key('mal.cache.key', $xref)"/>
+ <li class="links">
+ <a>
+ <xsl:if test="$bold">
+ <xsl:attribute name="class">
+ <xsl:text>bold</xsl:text>
+ </xsl:attribute>
+ </xsl:if>
+ <xsl:attribute name="href">
+ <xsl:call-template name="mal.link.target">
+ <xsl:with-param name="xref" select="$xref"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:call-template name="mal.link.tooltip">
+ <xsl:with-param name="xref" select="$xref"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:call-template name="mal.link.content">
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="xref" select="$xref"/>
+ <xsl:with-param name="role" select="$role"/>
+ </xsl:call-template>
+ </a>
+ <xsl:call-template name="mal2html.editor.badge">
+ <xsl:with-param name="target" select="$target"/>
+ </xsl:call-template>
+ <xsl:if test="not($nodesc)">
+ <xsl:variable name="desc" select="$target/mal:info/mal:desc"/>
+ <xsl:if test="$desc">
+ <span class="desc">
+ <xsl:text> — </xsl:text>
+ <xsl:apply-templates mode="mal2html.inline.mode" select="$desc/node()"/>
+ </span>
+ </xsl:if>
+ </xsl:if>
+ </li>
+ </xsl:for-each>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.links.guide
+Output guide links from a page or section.
+:Revision:version="1.0" date="2011-06-15" status="final"
+$node: A #{links}, #{page}, or #{section} element to link from.
+$depth: The depth level for the HTML header element.
+$links: A list of links from *{mal.link.guidelinks}.
+
+This template outputs guide links for a page or section. It does not extract
+the links itself. They must be passed in with the ${links} parameter.
+-->
+<xsl:template name="mal2html.links.guide" match="mal:links[ type = 'guide']">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="depth" select="count($node/ancestor-or-self::mal:section) + 2"/>
+ <xsl:param name="links" select="/false"/>
+ <xsl:variable name="depth_">
+ <xsl:choose>
+ <xsl:when test="$depth < 6">
+ <xsl:value-of select="$depth"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="6"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="expander" select="$node/self::mal:links/@ui:expanded"/>
+ <xsl:if test="$links">
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>links guidelinks</xsl:text>
+ <xsl:if test="$expander">
+ <xsl:text> ui-expander</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:call-template name="mal2html.ui.expander.data">
+ <xsl:with-param name="node" select="$node"/>
+ <xsl:with-param name="expander" select="$expander"/>
+ </xsl:call-template>
+ <div class="inner">
+ <xsl:choose>
+ <xsl:when test="$node[self::mal:links]/mal:title">
+ <xsl:apply-templates mode="mal2html.block.mode" select="$node/mal:title">
+ <xsl:with-param name="depth" select="$depth"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <div class="title">
+ <xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}">
+ <span class="title">
+ <xsl:call-template name="l10n.gettext">
+ <xsl:with-param name="msgid" select="'More About'"/>
+ </xsl:call-template>
+ </span>
+ </xsl:element>
+ </div>
+ </xsl:otherwise>
+ </xsl:choose>
+ <div class="region">
+ <xsl:call-template name="mal2html.links.ul">
+ <xsl:with-param name="links" select="$links"/>
+ <xsl:with-param name="role" select="'guide'"/>
+ </xsl:call-template>
+ </div>
+ </div>
+ </div>
+ </xsl:if>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.links.next
+Output links to the previous and next pages.
+:Revision:version="1.0" date="2011-06-15" status="final"
+$node: A #{links} or #{page} element to link from.
+
+This template outputs links to the previous and next page in a Mallard series,
+if they exist. The block containing the links is end-floated by default. The
+links use the text "Previous" and "Next", although the actual page titles are
+used for tooltips.
+
+If the #{links} element has the style hint #{top}, it will be inserted before
+the page title, instead of in its position on the page. This is handled by the
+calling functions in !{mal2html-page}.
+-->
+<xsl:template name="mal2html.links.next" match="mal:links[ type = 'next']">
+ <xsl:param name="node" select="."/>
+ <xsl:variable name="page" select="$node/ancestor-or-self::mal:page[last()]"/>
+ <xsl:variable name="linkid">
+ <xsl:call-template name="mal.link.linkid">
+ <xsl:with-param name="node" select="$page"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="next" select="$page/mal:info/mal:link[ type='next']"/>
+ <xsl:for-each select="$mal.cache">
+ <xsl:variable name="prev" select="key('mal.cache.link.key', concat('next:', $linkid))"/>
+ <xsl:if test="$prev or $next">
+ <!-- FIXME: Get prev/next links in constant position -->
+ <div class="links nextlinks">
+ <xsl:if test="$prev">
+ <a class="nextlinks-prev">
+ <xsl:attribute name="href">
+ <xsl:call-template name="mal.link.target">
+ <xsl:with-param name="node" select="$prev"/>
+ <xsl:with-param name="xref" select="$prev/../../@id"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:call-template name="mal.link.tooltip">
+ <xsl:with-param name="node" select="$prev"/>
+ <xsl:with-param name="xref" select="$prev/../../@id"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:for-each select="$page">
+ <xsl:call-template name="l10n.gettext">
+ <xsl:with-param name="msgid" select="'Previous'"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </a>
+ </xsl:if>
+ <xsl:if test="$prev and $next">
+ <xsl:text>  |  </xsl:text>
+ </xsl:if>
+ <xsl:if test="$next">
+ <a class="nextlinks-next">
+ <xsl:attribute name="href">
+ <xsl:call-template name="mal.link.target">
+ <xsl:with-param name="node" select="$next"/>
+ <xsl:with-param name="xref" select="$next/@xref"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:call-template name="mal.link.tooltip">
+ <xsl:with-param name="node" select="$next"/>
+ <xsl:with-param name="xref" select="$next/@xref"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:for-each select="$page">
+ <xsl:call-template name="l10n.gettext">
+ <xsl:with-param name="msgid" select="'Next'"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </a>
+ </xsl:if>
+ </div>
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.links.section
+Output links to subsections.
+:Revision:version="1.0" date="2011-06-15" status="final"
+$node: The section #{links} element.
+$depth: The depth level for the HTML header element.
+
+This template outputs links to the child sections of the #{page} or #{section}
+element containing ${node}.
+-->
+<xsl:template name="mal2html.links.section" match="mal:links[ type = 'section']">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="depth" select="count($node/ancestor-or-self::mal:section) + 2"/>
+ <xsl:variable name="style" select="concat(' ', $node/@style, ' ')"/>
+ <xsl:if test="$node/../mal:section">
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>links sectionlinks</xsl:text>
+ <xsl:choose>
+ <xsl:when test="contains($style, ' floatstart ')">
+ <xsl:text> floatstart</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($style, ' floatend ')">
+ <xsl:text> floatend</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($style, ' floatleft ')">
+ <xsl:text> floatleft</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($style, ' floatright ')">
+ <xsl:text> floatright</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="mal:title and $node/@ui:expanded">
+ <xsl:text> ui-expander</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:call-template name="mal2html.ui.expander.data">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ <div class="inner">
+ <xsl:apply-templates mode="mal2html.block.mode" select="$node/mal:title">
+ <xsl:with-param name="depth" select="$depth"/>
+ </xsl:apply-templates>
+ <div class="region">
+ <ul>
+ <xsl:for-each select="$node/../mal:section">
+ <xsl:call-template name="mal2html.links.ul.li">
+ <xsl:with-param name="xref" select="concat(/mal:page/@id, '#', @id)"/>
+ <xsl:with-param name="role" select="'section'"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </ul>
+ </div>
+ </div>
+ </div>
+ </xsl:if>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.links.seealso
+Output seealso links from a page or section.
+:Revision:version="1.0" date="2011-06-15" status="final"
+$node: A #{links}, #{page}, or #{section} element to link from.
+$depth: The depth level for the HTML header element.
+$links: A list of links from *{mal.link.seealsolinks}.
+
+This template outputs seealso links for a page or section. It does not extract
+the links itself. They must be passed in with the ${links} parameter.
+-->
+<xsl:template name="mal2html.links.seealso" match="mal:links[ type = 'seealso']">
+ <xsl:param name="node" select="."/>
+ <xsl:param name="depth" select="count($node/ancestor-or-self::mal:section) + 2"/>
+ <xsl:param name="links" select="/false"/>
+ <xsl:variable name="depth_">
+ <xsl:choose>
+ <xsl:when test="$depth < 6">
+ <xsl:value-of select="$depth"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="6"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="expander" select="$node/self::mal:links/@ui:expanded"/>
+ <xsl:if test="$links">
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>links seealsolinks</xsl:text>
+ <xsl:if test="$expander">
+ <xsl:text> ui-expander</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:call-template name="mal2html.ui.expander.data">
+ <xsl:with-param name="node" select="$node"/>
+ <xsl:with-param name="expander" select="$expander"/>
+ </xsl:call-template>
+ <div class="inner">
+ <xsl:choose>
+ <xsl:when test="$node[self::mal:links]/mal:title">
+ <xsl:apply-templates mode="mal2html.block.mode" select="$node/mal:title">
+ <xsl:with-param name="depth" select="$depth"/>
+ </xsl:apply-templates>
+ </xsl:when>
+ <xsl:otherwise>
+ <div class="title">
+ <xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}">
+ <span class="title">
+ <xsl:call-template name="l10n.gettext">
+ <xsl:with-param name="msgid" select="'See Also'"/>
+ </xsl:call-template>
+ </span>
+ </xsl:element>
+ </div>
+ </xsl:otherwise>
+ </xsl:choose>
+ <div class="region">
+ <xsl:call-template name="mal2html.links.ul">
+ <xsl:with-param name="links" select="$links"/>
+ <xsl:with-param name="role" select="'seealso'"/>
+ </xsl:call-template>
+ </div>
+ </div>
+ </div>
+ </xsl:if>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.links.series
+Output links to pages in a series.
+:Revision:version="1.0" date="2011-06-15" status="final"
+$node: A #{links} or #{page} element to start from.
+
+A series in Mallard is a list of page such that each page in the list has a
+next link to the following page. This template outputs links to each page in
+a series. The current page is output in its place, althought it is not a link.
+
+This template calls *{mal2html.links.series.prev} and
+*{mal2html.links.series.next} to find and output the links.
+-->
+<xsl:template name="mal2html.links.series" match="mal:links[ type = 'series']">
+ <xsl:param name="node" select="."/>
+ <xsl:variable name="page" select="$node/ancestor-or-self::mal:page[last()]"/>
+ <xsl:variable name="title" select="$node/self::mal:links/mal:title"/>
+ <xsl:variable name="style" select="concat(' ', $node/@style, ' ')"/>
+ <xsl:variable name="expander" select="$title and $node/self::mal:links/@ui:expanded"/>
+ <div>
+ <xsl:attribute name="class">
+ <xsl:text>links serieslinks</xsl:text>
+ <xsl:choose>
+ <xsl:when test="contains($style, ' floatstart ')">
+ <xsl:text> floatstart</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($style, ' floatend ')">
+ <xsl:text> floatend</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($style, ' floatleft ')">
+ <xsl:text> floatleft</xsl:text>
+ </xsl:when>
+ <xsl:when test="contains($style, ' floatright ')">
+ <xsl:text> floatright</xsl:text>
+ </xsl:when>
+ </xsl:choose>
+ <xsl:if test="$expander">
+ <xsl:text> ui-expander</xsl:text>
+ </xsl:if>
+ </xsl:attribute>
+ <xsl:call-template name="mal2html.ui.expander.data">
+ <xsl:with-param name="node" select="$node"/>
+ <xsl:with-param name="expander" select="$expander"/>
+ </xsl:call-template>
+ <div class="inner">
+ <xsl:apply-templates mode="mal2html.block.mode" select="$title"/>
+ <div class="region">
+ <ul>
+ <xsl:call-template name="mal2html.links.series.prev">
+ <xsl:with-param name="node" select="$page"/>
+ </xsl:call-template>
+ <li class="links">
+ <xsl:call-template name="mal.link.content">
+ <xsl:with-param name="node" select="$page"/>
+ <xsl:with-param name="xref" select="$page/@id"/>
+ </xsl:call-template>
+ </li>
+ <xsl:call-template name="mal2html.links.series.next">
+ <xsl:with-param name="node" select="$page"/>
+ </xsl:call-template>
+ </ul>
+ </div>
+ </div>
+ </div>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.links.series.prev
+Output preceding links to pages in a series.
+:Revision:version="1.0" date="2011-06-15" status="final"
+$node: The current #{page} element.
+
+This template is called by *{mal2html.links.series} to output the pages before
+the starting page in the series. This template finds the previous page for the
+page ${node}. It then calls itself recursively on that page, and outputs a link
+to it.
+-->
+<xsl:template name="mal2html.links.series.prev">
+ <xsl:param name="node"/>
+ <xsl:variable name="linkid">
+ <xsl:call-template name="mal.link.linkid">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:for-each select="$mal.cache">
+ <xsl:variable name="prev" select="key('mal.cache.link.key', concat('next:', $linkid))"/>
+ <xsl:if test="$prev">
+ <xsl:call-template name="mal2html.links.series.prev">
+ <xsl:with-param name="node" select="key('mal.cache.key', $prev/../../@id)"/>
+ </xsl:call-template>
+ <li class="links">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="mal.link.target">
+ <xsl:with-param name="node" select="$prev"/>
+ <xsl:with-param name="xref" select="$prev/../../@id"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:call-template name="mal.link.tooltip">
+ <xsl:with-param name="node" select="$prev"/>
+ <xsl:with-param name="xref" select="$prev/../../@id"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:call-template name="mal.link.content">
+ <xsl:with-param name="node" select="$prev"/>
+ <xsl:with-param name="xref" select="$prev/../../@id"/>
+ </xsl:call-template>
+ </a>
+ </li>
+ </xsl:if>
+ </xsl:for-each>
+</xsl:template>
+
+
+<!--**==========================================================================
+mal2html.links.series.next
+Output following links to pages in a series.
+:Revision:version="1.0" date="2011-06-15" status="final"
+$node: The current #{page} element.
+
+This template is called by *{mal2html.links.series} to output the pages after
+the starting page in the series. This template finds the next page for the page
+${node}. It outputs a link to that page, then calls itself recursively on that
+page.
+-->
+<xsl:template name="mal2html.links.series.next">
+ <xsl:param name="node"/>
+ <xsl:variable name="linkid">
+ <xsl:call-template name="mal.link.linkid">
+ <xsl:with-param name="node" select="$node"/>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="next" select="$node/mal:info/mal:link[ type='next']"/>
+ <xsl:if test="$next">
+ <xsl:for-each select="$mal.cache">
+ <li class="links">
+ <a>
+ <xsl:attribute name="href">
+ <xsl:call-template name="mal.link.target">
+ <xsl:with-param name="node" select="$next"/>
+ <xsl:with-param name="xref" select="$next/@xref"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:attribute name="title">
+ <xsl:call-template name="mal.link.tooltip">
+ <xsl:with-param name="node" select="$next"/>
+ <xsl:with-param name="xref" select="$next/@xref"/>
+ </xsl:call-template>
+ </xsl:attribute>
+ <xsl:call-template name="mal.link.content">
+ <xsl:with-param name="node" select="$next"/>
+ <xsl:with-param name="xref" select="$next/@xref"/>
+ </xsl:call-template>
+ </a>
+ </li>
+ <xsl:call-template name="mal2html.links.series.next">
+ <xsl:with-param name="node" select="key('mal.cache.key', $next/@xref)"/>
+ </xsl:call-template>
+ </xsl:for-each>
+ </xsl:if>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index adcd74e..a387cf9 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -123,66 +123,6 @@ REMARK: Describe this template
<!--**==========================================================================
-mal2html.page.autolink
-Outputs an automatic link for a related page
-$page: The element from the cache file of the page being linked to
-
-REMARK: Describe this template
--->
-<xsl:template name="mal2html.page.autolink">
- <xsl:param name="page"/>
- <xsl:param name="xref" select="$page/@id"/>
- <xsl:param name="attrs"/>
- <xsl:param name="role" select="''"/>
- <xsl:param name="bold" select="false()"/>
- <xsl:param name="nodesc" select="false()"/>
- <xsl:for-each select="$mal.cache">
- <xsl:variable name="target" select="key('mal.cache.key', $xref)"/>
- <li class="links">
- <xsl:copy-of select="exsl:node-set($attrs)/*/@*"/>
- <a>
- <xsl:if test="$bold">
- <xsl:attribute name="class">
- <xsl:text>bold</xsl:text>
- </xsl:attribute>
- </xsl:if>
- <xsl:attribute name="href">
- <xsl:call-template name="mal.link.target">
- <xsl:with-param name="xref" select="$xref"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="title">
- <xsl:call-template name="mal.link.tooltip">
- <xsl:with-param name="xref" select="$xref"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:call-template name="mal.link.content">
- <xsl:with-param name="node" select="."/>
- <xsl:with-param name="xref" select="$xref"/>
- <xsl:with-param name="role" select="$role"/>
- </xsl:call-template>
- </a>
- <xsl:call-template name="mal2html.editor.badge">
- <xsl:with-param name="target" select="$target"/>
- </xsl:call-template>
- <xsl:if test="not($nodesc)">
- <xsl:variable name="desc" select="$target/mal:info/mal:desc"/>
- <xsl:if test="$desc">
- <span class="desc">
- <xsl:text> — </xsl:text>
- <xsl:apply-templates mode="mal2html.inline.mode" select="$desc/node()"/>
- </span>
- </xsl:if>
- </xsl:if>
- </li>
- </xsl:for-each>
-</xsl:template>
-
-
-
-
-
-<!--**==========================================================================
mal2html.page.linktrails
FIXME
@@ -280,164 +220,6 @@ REMARK: Describe this template
</xsl:for-each>
</xsl:template>
-<!-- links -->
-<xsl:template name="mal2html.links.next" match="mal:links[ type = 'next']">
- <xsl:param name="node" select="./self::mal:links/.. | ./self::mal:page"/>
- <xsl:variable name="linkid">
- <xsl:call-template name="mal.link.linkid">
- <xsl:with-param name="node" select="$node"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="next" select="$node/mal:info/mal:link[ type='next']"/>
- <xsl:for-each select="$mal.cache">
- <xsl:variable name="prev" select="key('mal.cache.link.key', concat('next:', $linkid))"/>
- <xsl:if test="$prev or $next">
- <!-- FIXME: Get prev/next links in constant position -->
- <div class="links nextlinks">
- <xsl:if test="$prev">
- <a class="nextlinks-prev">
- <xsl:attribute name="href">
- <xsl:call-template name="mal.link.target">
- <xsl:with-param name="node" select="$prev"/>
- <xsl:with-param name="xref" select="$prev/../../@id"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="title">
- <xsl:call-template name="mal.link.tooltip">
- <xsl:with-param name="node" select="$prev"/>
- <xsl:with-param name="xref" select="$prev/../../@id"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:for-each select="$node">
- <xsl:call-template name="l10n.gettext">
- <xsl:with-param name="msgid" select="'Previous'"/>
- </xsl:call-template>
- </xsl:for-each>
- </a>
- </xsl:if>
- <xsl:if test="$prev and $next">
- <xsl:text>  |  </xsl:text>
- </xsl:if>
- <xsl:if test="$next">
- <a class="nextlinks-next">
- <xsl:attribute name="href">
- <xsl:call-template name="mal.link.target">
- <xsl:with-param name="node" select="$next"/>
- <xsl:with-param name="xref" select="$next/@xref"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="title">
- <xsl:call-template name="mal.link.tooltip">
- <xsl:with-param name="node" select="$next"/>
- <xsl:with-param name="xref" select="$next/@xref"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:for-each select="$node">
- <xsl:call-template name="l10n.gettext">
- <xsl:with-param name="msgid" select="'Next'"/>
- </xsl:call-template>
- </xsl:for-each>
- </a>
- </xsl:if>
- </div>
- </xsl:if>
- </xsl:for-each>
-</xsl:template>
-
-<xsl:template name="mal2html.links.series.prev">
- <xsl:param name="node" select="."/>
- <xsl:variable name="linkid">
- <xsl:call-template name="mal.link.linkid">
- <xsl:with-param name="node" select="$node"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:for-each select="$mal.cache">
- <xsl:variable name="prev" select="key('mal.cache.link.key', concat('next:', $linkid))"/>
- <xsl:if test="$prev">
- <xsl:call-template name="mal2html.links.series.prev">
- <xsl:with-param name="node" select="key('mal.cache.key', $prev/../../@id)"/>
- </xsl:call-template>
- <li class="links">
- <a>
- <xsl:attribute name="href">
- <xsl:call-template name="mal.link.target">
- <xsl:with-param name="node" select="$prev"/>
- <xsl:with-param name="xref" select="$prev/../../@id"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="title">
- <xsl:call-template name="mal.link.tooltip">
- <xsl:with-param name="node" select="$prev"/>
- <xsl:with-param name="xref" select="$prev/../../@id"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:call-template name="mal.link.content">
- <xsl:with-param name="node" select="$prev"/>
- <xsl:with-param name="xref" select="$prev/../../@id"/>
- </xsl:call-template>
- </a>
- </li>
- </xsl:if>
- </xsl:for-each>
-</xsl:template>
-
-<xsl:template name="mal2html.links.series.next">
- <xsl:param name="node" select="."/>
- <xsl:variable name="linkid">
- <xsl:call-template name="mal.link.linkid">
- <xsl:with-param name="node" select="$node"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="next" select="$node/mal:info/mal:link[ type='next']"/>
- <xsl:if test="$next">
- <xsl:for-each select="$mal.cache">
- <li class="links">
- <a>
- <xsl:attribute name="href">
- <xsl:call-template name="mal.link.target">
- <xsl:with-param name="node" select="$next"/>
- <xsl:with-param name="xref" select="$next/@xref"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:attribute name="title">
- <xsl:call-template name="mal.link.tooltip">
- <xsl:with-param name="node" select="$next"/>
- <xsl:with-param name="xref" select="$next/@xref"/>
- </xsl:call-template>
- </xsl:attribute>
- <xsl:call-template name="mal.link.content">
- <xsl:with-param name="node" select="$next"/>
- <xsl:with-param name="xref" select="$next/@xref"/>
- </xsl:call-template>
- </a>
- </li>
- <xsl:call-template name="mal2html.links.series.next">
- <xsl:with-param name="node" select="key('mal.cache.key', $next/@xref)"/>
- </xsl:call-template>
- </xsl:for-each>
- </xsl:if>
-</xsl:template>
-
-<xsl:template match="mal:links[ type = 'series']">
- <div class="links serieslinks">
- <xsl:apply-templates mode="mal2html.block.mode" select="mal:title"/>
- <ul>
- <xsl:call-template name="mal2html.links.series.prev">
- <xsl:with-param name="node" select="/mal:page"/>
- </xsl:call-template>
- <li class="links">
- <xsl:call-template name="mal.link.content">
- <xsl:with-param name="node" select="/mal:page"/>
- <xsl:with-param name="xref" select="/mal:page/@id"/>
- </xsl:call-template>
- </li>
- <xsl:call-template name="mal2html.links.series.next">
- <xsl:with-param name="node" select="/mal:page"/>
- </xsl:call-template>
- </ul>
- </div>
-</xsl:template>
-
<xsl:template name="mal2html.editor.badge">
<xsl:param name="target" select="."/>
<xsl:if test="$mal2html.editor_mode">
@@ -569,8 +351,8 @@ REMARK: Describe this template
</xsl:if>
</xsl:template>
-<!-- == Matched Templates == -->
+<!-- == Matched Templates == -->
<xsl:template mode="html.title.mode" match="mal:page">
<xsl:variable name="title" select="mal:info/mal:title[ type = 'text'][1]"/>
@@ -605,6 +387,7 @@ REMARK: Describe this template
</xsl:otherwise>
</xsl:choose>
<xsl:apply-templates select="."/>
+ <div class="clear"/>
</xsl:template>
<!-- = section = -->
@@ -940,18 +723,12 @@ REMARK: Describe this template
</xsl:when>
<xsl:when test="contains($style, ' linklist ')">
<xsl:variable name="bold" select="contains($style, ' bold ')"/>
- <ul>
- <xsl:for-each select="$_links">
- <xsl:sort data-type="number" select="@groupsort"/>
- <xsl:sort select="mal:title[ type = 'sort']"/>
- <xsl:call-template name="mal2html.page.autolink">
- <xsl:with-param name="xref" select="@xref"/>
- <xsl:with-param name="role" select="'topic'"/>
- <xsl:with-param name="bold" select="$bold"/>
- <xsl:with-param name="nodesc" select="$nodesc"/>
- </xsl:call-template>
- </xsl:for-each>
- </ul>
+ <xsl:call-template name="mal2html.links.ul">
+ <xsl:with-param name="links" select="$_links"/>
+ <xsl:with-param name="role" select="'topic'"/>
+ <xsl:with-param name="bold" select="$bold"/>
+ <xsl:with-param name="nodesc" select="$nodesc"/>
+ </xsl:call-template>
</xsl:when>
<xsl:when test="contains($style, ' 2column ')">
<xsl:variable name="coltot" select="ceiling(count($_links) div 2)"/>
@@ -1013,119 +790,6 @@ REMARK: Describe this template
</xsl:if>
</xsl:template>
-<xsl:template match="mal:links[ type = 'section']">
- <xsl:param name="node" select="."/>
- <xsl:param name="depth" select="count($node/ancestor-or-self::mal:section) + 2"/>
- <xsl:if test="$node/../mal:section">
- <div class="links sectionlinks">
- <xsl:apply-templates mode="mal2html.block.mode" select="$node/mal:title">
- <xsl:with-param name="depth" select="$depth"/>
- </xsl:apply-templates>
- <ul>
- <xsl:for-each select="$node/../mal:section">
- <xsl:call-template name="mal2html.page.autolink">
- <xsl:with-param name="xref" select="concat(/mal:page/@id, '#', @id)"/>
- <xsl:with-param name="role" select="'section'"/>
- </xsl:call-template>
- </xsl:for-each>
- </ul>
- </div>
- </xsl:if>
-</xsl:template>
-
-<xsl:template name="mal2html.links.guide" match="mal:links[ type = 'guide']">
- <xsl:param name="node" select="."/>
- <xsl:param name="depth" select="count($node/ancestor-or-self::mal:section) + 2"/>
- <xsl:param name="links" select="/false"/>
- <xsl:variable name="depth_">
- <xsl:choose>
- <xsl:when test="$depth < 6">
- <xsl:value-of select="$depth"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="6"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:if test="$links">
- <div class="links guidelinks">
- <xsl:choose>
- <xsl:when test="$node[self::mal:links]/mal:title">
- <xsl:apply-templates mode="mal2html.block.mode" select="$node/mal:title">
- <xsl:with-param name="depth" select="$depth"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <div class="title">
- <xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}">
- <span class="title">
- <xsl:call-template name="l10n.gettext">
- <xsl:with-param name="msgid" select="'More About'"/>
- </xsl:call-template>
- </span>
- </xsl:element>
- </div>
- </xsl:otherwise>
- </xsl:choose>
- <ul>
- <xsl:for-each select="$links">
- <xsl:sort select="mal:title[ type = 'sort']"/>
- <xsl:call-template name="mal2html.page.autolink">
- <xsl:with-param name="xref" select="@xref"/>
- <xsl:with-param name="role" select="'guide'"/>
- </xsl:call-template>
- </xsl:for-each>
- </ul>
- </div>
- </xsl:if>
-</xsl:template>
-
-<xsl:template name="mal2html.links.seealso" match="mal:links[ type = 'seealso']">
- <xsl:param name="node" select="."/>
- <xsl:param name="depth" select="count($node/ancestor-or-self::mal:section) + 2"/>
- <xsl:param name="links" select="/false"/>
- <xsl:variable name="depth_">
- <xsl:choose>
- <xsl:when test="$depth < 6">
- <xsl:value-of select="$depth"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="6"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:if test="$links">
- <div class="links seealsolinks">
- <xsl:choose>
- <xsl:when test="$node[self::mal:links]/mal:title">
- <xsl:apply-templates mode="mal2html.block.mode" select="$node/mal:title">
- <xsl:with-param name="depth" select="$depth"/>
- </xsl:apply-templates>
- </xsl:when>
- <xsl:otherwise>
- <div class="title">
- <xsl:element name="{concat('h', $depth_)}" namespace="{$html.namespace}">
- <span class="title">
- <xsl:call-template name="l10n.gettext">
- <xsl:with-param name="msgid" select="'See Also'"/>
- </xsl:call-template>
- </span>
- </xsl:element>
- </div>
- </xsl:otherwise>
- </xsl:choose>
- <ul>
- <xsl:for-each select="$links">
- <xsl:sort select="mal:title[ type = 'sort']"/>
- <xsl:call-template name="mal2html.page.autolink">
- <xsl:with-param name="xref" select="@xref"/>
- <xsl:with-param name="role" select="'guide'"/>
- </xsl:call-template>
- </xsl:for-each>
- </ul>
- </div>
- </xsl:if>
-</xsl:template>
<!--%%==========================================================================
mal2html.title.mode
diff --git a/xslt/mallard/html/mal2html-ui.xsl b/xslt/mallard/html/mal2html-ui.xsl
index 4eac97f..268f47a 100644
--- a/xslt/mallard/html/mal2html-ui.xsl
+++ b/xslt/mallard/html/mal2html-ui.xsl
@@ -37,16 +37,23 @@ mal2html.ui.expander.data
Output data for an expander.
:Revision:version="1.0" date="2011-06-14" status="final"
$node: The source element to output data for.
+$expander: Whether ${node} is actually an expander.
This template outputs an HTML #{div} element with the #{class} attribute set to
#{"yelp-data yelp-data-ui-expander"}. All #{yelp-data} elements are hidden by
the CSS. The div contains information about text directionality, the default
expanded state, and optionally additional titles for the expanded and collapsed
states.
+
+The expander information is only output if the ${expander} parameter is #{true}.
+This parameter can be calculated automatically, but it will give false negatives
+for blocks that produce automatic titles.
-->
<xsl:template name="mal2html.ui.expander.data">
<xsl:param name="node" select="."/>
- <xsl:if test="$node/mal:title and ($node/@ui:expanded or $node/self::ui:expander)">
+ <xsl:param name="expander" select="$node/mal:title and
+ ($node/@ui:expanded or $node/self::ui:expander)"/>
+ <xsl:if test="$expander">
<xsl:variable name="title_e" select="$node/mal:info/mal:title[ type = 'ui:expanded'][1]"/>
<xsl:variable name="title_c" select="$node/mal:info/mal:title[ type = 'ui:collapsed'][1]"/>
<div class="yelp-data yelp-data-ui-expander">
diff --git a/xslt/mallard/html/mal2xhtml.xsl b/xslt/mallard/html/mal2xhtml.xsl
index dab186c..4655090 100644
--- a/xslt/mallard/html/mal2xhtml.xsl
+++ b/xslt/mallard/html/mal2xhtml.xsl
@@ -44,6 +44,7 @@ REMARK: Describe this module
<xsl:include href="mal2html-block.xsl"/>
<xsl:include href="mal2html-facets.xsl"/>
<xsl:include href="mal2html-inline.xsl"/>
+<xsl:include href="mal2html-links.xsl"/>
<xsl:include href="mal2html-list.xsl"/>
<xsl:include href="mal2html-media.xsl"/>
<xsl:include href="mal2html-page.xsl"/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]