summaryrefslogtreecommitdiff
path: root/xslt
diff options
context:
space:
mode:
authorShaun McCance <shaunm@gnome.org>2009-08-27 13:18:21 -0500
committerShaun McCance <shaunm@gnome.org>2009-08-27 13:18:21 -0500
commit40cf497544fd7c1f59f58638fc6f0c3ee2a721ba (patch)
tree96930399bcf9bb29772fff6fa5069f462d104343 /xslt
parent9759ebe3e4fa62c3d0095c869aaad96f65bb7010 (diff)
downloadgnome-doc-utils-40cf497544fd7c1f59f58638fc6f0c3ee2a721ba.tar.gz
Handle link roles for automatic links
Diffstat (limited to 'xslt')
-rw-r--r--xslt/mallard/common/mal-link.xsl17
-rw-r--r--xslt/mallard/html/mal2html-page.xsl12
2 files changed, 24 insertions, 5 deletions
diff --git a/xslt/mallard/common/mal-link.xsl b/xslt/mallard/common/mal-link.xsl
index 294612e..50f7e8c 100644
--- a/xslt/mallard/common/mal-link.xsl
+++ b/xslt/mallard/common/mal-link.xsl
@@ -40,11 +40,13 @@ Generates the content for a #{link} element
$link: The #{link} or other element creating the link
$xref: The #{xref} attribute of ${link}
$href: The #{href} attribute of ${link}
+$role: A link role, used to select the appropriate title
-->
<xsl:template name="mal.link.content">
<xsl:param name="link" select="."/>
<xsl:param name="xref" select="$link/@xref"/>
<xsl:param name="href" select="$link/@href"/>
+ <xsl:param name="role" select="''"/>
<xsl:choose>
<xsl:when test="contains($xref, '/')">
<!--
@@ -78,9 +80,18 @@ $href: The #{href} attribute of ${link}
</xsl:choose>
</xsl:variable>
<xsl:for-each select="$mal.cache">
- <xsl:apply-templates mode="mal.link.content.mode"
- select="key('mal.cache.key', $fullid)
- /mal:info/mal:title[@type = 'link']/node()"/>
+ <xsl:variable name="titles" select="key('mal.cache.key', $fullid)
+ /mal:info/mal:title[@type = 'link']"/>
+ <xsl:choose>
+ <xsl:when test="$role != '' and $titles[@role = 'guide']">
+ <xsl:apply-templates mode="mal.link.content.mode"
+ select="$titles[@role = $role][1]/node()"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:apply-templates mode="mal.link.content.mode"
+ select="$titles[not(@role)][1]/node()"/>
+ </xsl:otherwise>
+ </xsl:choose>
</xsl:for-each>
</xsl:otherwise>
</xsl:choose>
diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl
index 46f34b5..adaeaf5 100644
--- a/xslt/mallard/html/mal2html-page.xsl
+++ b/xslt/mallard/html/mal2html-page.xsl
@@ -184,6 +184,7 @@ REMARK: Describe this template
<xsl:call-template name="mal.link.content">
<xsl:with-param name="link" select="$source"/>
<xsl:with-param name="xref" select="$target/@id"/>
+ <xsl:with-param name="role" select="'topic'"/>
</xsl:call-template>
<xsl:if test="$mal2html.editor_mode">
@@ -301,13 +302,15 @@ REMARK: Describe this template
<ul>
<xsl:for-each select="$pagelinks">
<xsl:call-template name="mal2html.page.autolink">
- <xsl:with-param name="page" select="."/>
- </xsl:call-template>
+ <xsl:with-param name="page" select="."/>
+ <xsl:with-param name="role" select="'guide'"/>
+ </xsl:call-template>
</xsl:for-each>
<!-- FIXME: exclude pagelinks -->
<xsl:for-each select="$guidelinks">
<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>
@@ -324,11 +327,13 @@ REMARK: Describe this template
<xsl:for-each select="$inlinks">
<xsl:call-template name="mal2html.page.autolink">
<xsl:with-param name="page" select="."/>
+ <xsl:with-param name="role" select="'seealso'"/>
</xsl:call-template>
</xsl:for-each>
<xsl:for-each select="$outlinks">
<xsl:call-template name="mal2html.page.autolink">
<xsl:with-param name="xref" select="@xref"/>
+ <xsl:with-param name="role" select="'seealso'"/>
</xsl:call-template>
</xsl:for-each>
</ul>
@@ -349,6 +354,7 @@ REMARK: Describe this template
<xsl:template name="mal2html.page.autolink">
<xsl:param name="page"/>
<xsl:param name="xref" select="$page/@id"/>
+ <xsl:param name="role" select="''"/>
<li class="autolink">
<a>
<xsl:attribute name="href">
@@ -359,6 +365,7 @@ REMARK: Describe this template
<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:for-each select="$mal.cache">
@@ -413,6 +420,7 @@ REMARK: Describe this template
</xsl:attribute>
<xsl:call-template name="mal.link.content">
<xsl:with-param name="xref" select="."/>
+ <xsl:with-param name="role" select="'guide'"/>
</xsl:call-template>
</a>
<xsl:text> ยป </xsl:text>