[yelp-xsl] dita2html: Add About footer and ARIA landmarks
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp-xsl] dita2html: Add About footer and ARIA landmarks
- Date: Mon, 12 Nov 2012 14:53:22 +0000 (UTC)
commit 2e5cd5c05898a27a69528e481839466b33120ab2
Author: Shaun McCance <shaunm gnome org>
Date: Mon Nov 12 09:53:00 2012 -0500
dita2html: Add About footer and ARIA landmarks
xslt/dita/common/dita-selectors.mod | 20 ++++++
xslt/dita/html/dita2html-topic.xsl | 111 ++++++++++++++++++++++++++++++++---
2 files changed, 123 insertions(+), 8 deletions(-)
---
diff --git a/xslt/dita/common/dita-selectors.mod b/xslt/dita/common/dita-selectors.mod
index f4487e5..e4b1a6e 100644
--- a/xslt/dita/common/dita-selectors.mod
+++ b/xslt/dita/common/dita-selectors.mod
@@ -52,6 +52,11 @@ topic/alt
<!ENTITY topic_alt "*[name(.) = 'alt' or starts-with(@class, '- topic/alt ')]">
<!-- ===========================================================================
+topic/author
+-->
+<!ENTITY topic_author "*[name(.) = 'author' or starts-with(@class, '- topic/author ')]">
+
+<!-- ===========================================================================
topic/body
-->
<!ENTITY topic_body "*[
@@ -78,6 +83,21 @@ topic/bodydiv
]">
<!-- ===========================================================================
+topic/copyright
+-->
+<!ENTITY topic_copyright "*[name(.) = 'copyright' or starts-with(@class, '- topic/copyright ')]">
+
+<!-- ===========================================================================
+topic/copyrholder
+-->
+<!ENTITY topic_copyrholder "*[name(.) = 'copyrholder' or starts-with(@class, '- topic/copyrholder ')]">
+
+<!-- ===========================================================================
+topic/copyryear
+-->
+<!ENTITY topic_copyryear "*[name(.) = 'copyryear' or starts-with(@class, '- topic/copyryear ')]">
+
+<!-- ===========================================================================
topic/desc
-->
<!ENTITY topic_desc "*[name(.) = 'desc' or starts-with(@class, '- topic/desc ')]">
diff --git a/xslt/dita/html/dita2html-topic.xsl b/xslt/dita/html/dita2html-topic.xsl
index b16b1f0..01cbad3 100644
--- a/xslt/dita/html/dita2html-topic.xsl
+++ b/xslt/dita/html/dita2html-topic.xsl
@@ -24,8 +24,9 @@ Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
xmlns:exsl="http://exslt.org/common"
xmlns:str="http://exslt.org/strings"
xmlns:yelp="http://projects.gnome.org/yelp/"
+ xmlns:msg="http://projects.gnome.org/yelp/gettext/"
xmlns="http://www.w3.org/1999/xhtml"
- exclude-result-prefixes="exsl str yelp"
+ exclude-result-prefixes="exsl str yelp msg"
version="1.0">
<!--!!==========================================================================
@@ -127,7 +128,6 @@ REMARK: Describe this module
<!-- == dita2html.links.topic == -->
-
<xsl:template name="dita2html.links.topic">
<xsl:param name="source" select="."/>
<xsl:if test="$source/&map_topicref;">
@@ -183,6 +183,97 @@ REMARK: Describe this module
</xsl:template>
+<!-- == dita2html.topic.about == -->
+<xsl:template name="dita2html.topic.about">
+ <xsl:param name="node" select="."/>
+ <xsl:variable name="info" select="yelp:dita.ref.conref($node/&topic_prolog;) |
+ yelp:dita.ref.conref($node/&map_topicmeta;)"/>
+ <xsl:variable name="copyrights" select="$info/&topic_copyright;"/>
+ <xsl:variable name="authors" select="$info/&topic_author;[ type = 'creator']"/>
+ <xsl:variable name="others" select="$info/&topic_author;[ type != 'creator']"/>
+ <xsl:if test="$copyrights or $authors or $others">
+ <div class="sect about ui-expander" role="contentinfo">
+ <div class="yelp-data yelp-data-ui-expander" data-yelp-expanded="false"/>
+ <div class="inner">
+ <div class="hgroup">
+ <h2>
+ <span class="title">
+ <xsl:call-template name="l10n.gettext">
+ <xsl:with-param name="msgid" select="'About'"/>
+ </xsl:call-template>
+ </span>
+ </h2>
+ </div>
+ <div class="region">
+ <div class="contents">
+ <xsl:if test="$copyrights">
+ <div class="copyrights">
+ <xsl:for-each select="$copyrights">
+ <div class="copyright">
+ <xsl:call-template name="l10n.gettext">
+ <xsl:with-param name="msgid" select="'copyright.format'"/>
+ <xsl:with-param name="node" select="."/>
+ <xsl:with-param name="format" select="true()"/>
+ </xsl:call-template>
+ </div>
+ </xsl:for-each>
+ </div>
+ </xsl:if>
+ <xsl:if test="$authors">
+ <div class="aboutblurb authors">
+ <div class="title">
+ <span class="title">
+ <xsl:call-template name="l10n.gettext">
+ <xsl:with-param name="msgid" select="'Written By'"/>
+ </xsl:call-template>
+ </span>
+ </div>
+ <ul class="credits">
+ <xsl:for-each select="$authors">
+ <li>
+ <xsl:apply-templates mode="dita2html.topic.mode"/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </div>
+ </xsl:if>
+ <xsl:if test="$others">
+ <div class="aboutblurb othercredits">
+ <div class="title">
+ <span class="title">
+ <xsl:call-template name="l10n.gettext">
+ <xsl:with-param name="msgid" select="'Other Credits'"/>
+ </xsl:call-template>
+ </span>
+ </div>
+ <ul class="credits">
+ <xsl:for-each select="$others">
+ <li>
+ <xsl:apply-templates mode="dita2html.topic.mode"/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </div>
+ </xsl:if>
+ </div>
+ </div>
+ </div>
+ </div>
+ </xsl:if>
+</xsl:template>
+
+<xsl:template mode="l10n.format.mode" match="msg:copyright.years">
+ <xsl:param name="node"/>
+ <xsl:value-of select="$node/&topic_copyryear;/@year"/>
+</xsl:template>
+
+<xsl:template mode="l10n.format.mode" match="msg:copyright.name">
+ <xsl:param name="node"/>
+ <xsl:apply-templates mode="dita2html.topic.mode"
+ select="$node/&topic_copyrholder;/node()"/>
+</xsl:template>
+
+
<!-- == map == -->
<!-- = map % html.output.after.mode = -->
@@ -208,6 +299,11 @@ REMARK: Describe this module
</xsl:choose>
</xsl:template>
+<!-- = map % html.footer.mode = -->
+<xsl:template mode="html.footer.mode" match="&map_map;">
+ <xsl:call-template name="dita2html.topic.about"/>
+</xsl:template>
+
<!-- = map % html.body.mode = -->
<xsl:template mode="html.body.mode" match="&map_map;">
<xsl:call-template name="dita2html.links.prevnext"/>
@@ -253,7 +349,7 @@ REMARK: Describe this module
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
- <div class="trails">
+ <div class="trails" role="navigation">
<div class="trail">
<a class="trail">
<xsl:attribute name="href">
@@ -298,10 +394,9 @@ REMARK: Describe this module
<!-- = topicref % html.footer.mode = -->
<xsl:template mode="html.footer.mode" match="&map_topicref;">
- <!-- FIXME -->
- <!--
- <xsl:call-template name="mal2html.page.about"/>
- -->
+ <xsl:call-template name="dita2html.topic.about">
+ <xsl:with-param name="node" select="document(@href, $dita.map.base)/*"/>
+ </xsl:call-template>
</xsl:template>
<!-- = topicref % html.body.mode = -->
@@ -429,7 +524,7 @@ th, td { border: solid 1px; }
</xsl:template>
<xsl:template mode="dita2html.topic.mode" match="&topic_related-links;">
- <div class="sect sect-links">
+ <div class="sect sect-links" role="navigation">
<div class="hgroup"/>
<div class="contents">
<div class="links">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]