diff options
author | Shaun McCance <shaunm@gnome.org> | 2016-06-22 10:44:42 -0400 |
---|---|---|
committer | Shaun McCance <shaunm@gnome.org> | 2016-06-22 10:44:42 -0400 |
commit | 1679e84f735a08f7b0caaf070b20c8b27e8d38f9 (patch) | |
tree | 290a1a63001702aca7d5d2cc98ac8835cca3cd30 /xslt | |
parent | 8ec2fdc3d5b461c82aafbb046806cfb6fe7af0a1 (diff) | |
download | yelp-xsl-1679e84f735a08f7b0caaf070b20c8b27e8d38f9.tar.gz |
Adding html.content.pre and html.content.post templates
Diffstat (limited to 'xslt')
-rw-r--r-- | xslt/common/html.xsl | 130 | ||||
-rw-r--r-- | xslt/dita/html/dita2html-topic.xsl | 6 | ||||
-rw-r--r-- | xslt/docbook/html/db2html-division.xsl | 6 | ||||
-rw-r--r-- | xslt/mallard/html/mal2html-page.xsl | 6 |
4 files changed, 148 insertions, 0 deletions
diff --git a/xslt/common/html.xsl b/xslt/common/html.xsl index 074bfb26..a6623d2d 100644 --- a/xslt/common/html.xsl +++ b/xslt/common/html.xsl @@ -575,6 +575,135 @@ values that do not conflict with those used in these stylesheets. <!--**========================================================================== +html.content.pre +Output content before the content of a page or section. +:Revision: version="3.22" date="2016-06-21" status="final" +$node: The node a page or section is being created for. +$page: Whether the content is for a page. + +This template is called by importing stylesheets before any content of a page +or section, but after the title. It calls *{html.content.pre.custom}, then +applies %{html.content.pre.mode} to ${node}. If the ${page} parameter is true, +then this template is being called on an output page. Otherwise, it is being +called on a section within a page. +--> +<xsl:template name="html.content.pre"> + <xsl:param name="node" select="."/> + <xsl:param name="page" select="true()"/> + <xsl:call-template name="html.content.pre.custom"> + <xsl:with-param name="node" select="$node"/> + <xsl:with-param name="page" select="$page"/> + </xsl:call-template> + <xsl:apply-templates mode="html.content.pre.mode" select="$node"> + <xsl:with-param name="page" select="$page"/> + </xsl:apply-templates> +</xsl:template> + + +<!--**========================================================================== +html.content.pre.custom +Stub to output content before the content of a page or section. +:Stub: true +:Revision: version="3.22" date="2016-06-21" status="final" +$node: The node a page or section is being created for. +$page: Whether the content is for a page. + +This template is a stub, called by *{html.content.pre.custom}. It is called +before %{html.content.pre.mode} is applied. Override this template to provide +site-specific HTML before the content of a page or section. If the ${page} +parameter is true, then this template is being called on an output page. +Otherwise, it is being called on a section within a page. +--> +<xsl:template name="html.content.pre.custom"> + <xsl:param name="node" select="."/> + <xsl:param name="page" select="true()"/> +</xsl:template> + + +<!--%%========================================================================== +html.content.pre.mode +Output content before the content of a page or section. +:Revision: version="3.22" date="2016-06-21" status="final" +$page: Whether the content is for a page. + +This mode is applied by *{html.content.pre} after calling +*{html.content.pre.custom}. Importing stylesheets can use this to add +additional content for specific types of input elements before the content +of a page or section. If the ${page} parameter is true, then this template +is being called on an output page. Otherwise, it is being called on a section +within a page. +--> +<xsl:template mode="html.content.pre.mode" match="*"> + <xsl:param name="page" select="true()"/> +</xsl:template> + + +<!--**========================================================================== +html.content.post +Output content after the content of a page or section, before subsections. +:Revision: version="3.22" date="2016-06-21" status="final" +$node: The node a page or section is being created for. +$page: Whether the content is for a page. + +This template is called by importing stylesheets after any content of a page +or section, but before any subsections. It applies %{html.content.post.mode} +to ${node}, then calls *{html.content.post.custom}. If the ${page} parameter +is true, then this template is being called on an output page. Otherwise, it +is being called on a section within a page. +--> +<xsl:template name="html.content.post"> + <xsl:param name="node" select="."/> + <xsl:param name="page" select="true()"/> + <xsl:apply-templates mode="html.content.post.mode" select="$node"> + <xsl:with-param name="page" select="$page"/> + </xsl:apply-templates> + <xsl:call-template name="html.content.post.custom"> + <xsl:with-param name="node" select="$node"/> + <xsl:with-param name="page" select="$page"/> + </xsl:call-template> +</xsl:template> + + +<!--**========================================================================== +html.content.post.custom +Stub to output content after the content of a page or section, before subsections. +:Stub: true +:Revision: version="3.22" date="2016-06-21" status="final" +$node: The node a page or section is being created for. +$page: Whether the content is for a page. + +This template is a stub, called by *{html.content.post.custom}. It is called +after %{html.content.pre.mode} is applied. Override this template to provide +site-specific HTML after the content of a page or section, but before any +subsections. If the ${page} parameter is true, then this template is being +called on an output page. Otherwise, it is being called on a section within +a page. +--> +<xsl:template name="html.content.post.custom"> + <xsl:param name="node" select="."/> + <xsl:param name="page" select="true()"/> +</xsl:template> + + +<!--%%========================================================================== +html.content.post.mode +Output content after the content of a page or section, before subsections. +:Revision: version="3.22" date="2016-06-21" status="final" +$page: Whether the content is for a page. + +This mode is applied by *{html.content.post} before calling +*{html.content.post.custom}. Importing stylesheets can use this to add +additional content for specific types of input elements after the content +of a page or section, but before any subsections. If the ${page} parameter +is true, then this template is being called on an output page. Otherwise, +it is being called on a section within a page. +--> +<xsl:template mode="html.content.post.mode" match="*"> + <xsl:param name="page" select="true()"/> +</xsl:template> + + +<!--**========================================================================== html.css Output all CSS for an HTML output page. :Revision:version="1.0" date="2010-12-23" status="final" @@ -2479,6 +2608,7 @@ the #{class} attribute for output elements. </xsl:if> </xsl:template> + <!--%%========================================================================== html.syntax.class.mode Get the syntax highlighting language for a source-specific element. diff --git a/xslt/dita/html/dita2html-topic.xsl b/xslt/dita/html/dita2html-topic.xsl index e9e5b93f..7db10df3 100644 --- a/xslt/dita/html/dita2html-topic.xsl +++ b/xslt/dita/html/dita2html-topic.xsl @@ -599,11 +599,17 @@ div.dita-object > div.desc { <xsl:call-template name="html.class.attr"> <xsl:with-param name="class" select="'contents'"/> </xsl:call-template> + <xsl:call-template name="html.content.pre"> + <xsl:with-param name="page" select="not(../parent::&topic_topic_all;)"/> + </xsl:call-template> <xsl:apply-templates mode="dita2html.topic.mode" select="../&topic_shortdesc;"/> <xsl:apply-templates mode="dita2html.topic.mode" select="$conref/node()"/> <xsl:call-template name="dita2html.links.topic"> <xsl:with-param name="source" select="$topicref"/> </xsl:call-template> + <xsl:call-template name="html.content.post"> + <xsl:with-param name="page" select="not(../parent::&topic_topic_all;)"/> + </xsl:call-template> </div> </xsl:template> diff --git a/xslt/docbook/html/db2html-division.xsl b/xslt/docbook/html/db2html-division.xsl index 8fe3645d..0a39523c 100644 --- a/xslt/docbook/html/db2html-division.xsl +++ b/xslt/docbook/html/db2html-division.xsl @@ -188,6 +188,9 @@ REMARK: Talk about some of the parameters </xsl:call-template> <div class="region"> <div class="contents"> + <xsl:call-template name="html.content.pre"> + <xsl:with-param name="page" select="$depth_in_chunk = 0"/> + </xsl:call-template> <xsl:apply-templates mode="db2html.division.div.content.mode" select="$node"> <xsl:with-param name="info" select="$info"/> <xsl:with-param name="entries" select="$entries"/> @@ -202,6 +205,9 @@ REMARK: Talk about some of the parameters <xsl:with-param name="divisions" select="$divisions"/> </xsl:call-template> </xsl:if> + <xsl:call-template name="html.content.post"> + <xsl:with-param name="page" select="$depth_in_chunk = 0"/> + </xsl:call-template> </div> <xsl:for-each select="$divisions"> <xsl:if test="not($chunk_divisions) or not(self::&db_chunks;)"> diff --git a/xslt/mallard/html/mal2html-page.xsl b/xslt/mallard/html/mal2html-page.xsl index 2e618104..f75fb25b 100644 --- a/xslt/mallard/html/mal2html-page.xsl +++ b/xslt/mallard/html/mal2html-page.xsl @@ -666,6 +666,9 @@ templates that handle #{page} and #{section} elements. <xsl:if test="$type = 'facets'"> <xsl:call-template name="mal2html.facets.controls"/> </xsl:if> + <xsl:call-template name="html.content.pre"> + <xsl:with-param name="page" select="boolean(self::mal:page)"/> + </xsl:call-template> <xsl:for-each select="*[not(self::mal:section or self::mal:title or self::mal:subtitle)]"> <xsl:choose> @@ -714,6 +717,9 @@ templates that handle #{page} and #{section} elements. <xsl:if test="$type = 'facets'"> <xsl:call-template name="mal2html.facets.links"/> </xsl:if> + <xsl:call-template name="html.content.post"> + <xsl:with-param name="page" select="boolean(self::mal:page)"/> + </xsl:call-template> </div> <xsl:for-each select="mal:section"> <xsl:call-template name="mal2html.section"/> |