diff options
author | Patrick McCarty <patrick.mccarty@linux.intel.com> | 2012-06-12 14:05:47 -0700 |
---|---|---|
committer | Patrick McCarty <patrick.mccarty@linux.intel.com> | 2012-06-12 14:58:00 -0700 |
commit | 0ebc96393cd7cd5c861276ae733307bd7b8d87f7 (patch) | |
tree | 899f86030089e8daa5eaf48af5b8b5b7780998d6 /website/makefile-dep.xsl | |
parent | 7f26f4160c974d34117c14272d3e4f56a471e8f1 (diff) | |
download | docbook-xsl-master.tar.gz docbook-xsl-master.tar.bz2 docbook-xsl-master.zip |
Required package for building systemd man pages.
Change-Id: I0a200a2340a5aea24898b428b8e9b55da57e3e5b
Signed-off-by: Patrick McCarty <patrick.mccarty@linux.intel.com>
Diffstat (limited to 'website/makefile-dep.xsl')
-rw-r--r-- | website/makefile-dep.xsl | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/website/makefile-dep.xsl b/website/makefile-dep.xsl new file mode 100644 index 0000000..00f810b --- /dev/null +++ b/website/makefile-dep.xsl @@ -0,0 +1,143 @@ +<?xml version="1.0"?> +<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" + version="1.0"> + +<xsl:param name="filename-prefix" select="''"/> +<xsl:param name="depends-file" select="''"/> +<xsl:param name="output-root" select="''"/> +<!-- Additional dependencies for target website --> +<xsl:param name="add-website-depends" select="''"/> +<!-- Remove output root dir instead removing each html output file. + Useful for removing subdirs and none html files: images, css etc. --> +<xsl:param name="remove-output-root" select="0"/> + +<xsl:output method="text"/> + +<xsl:template match="autolayout"> + <xsl:text>website: </xsl:text> + <xsl:value-of select="$add-website-depends"/> + <xsl:text> </xsl:text> + <xsl:apply-templates select="toc" mode="all"/> + <xsl:apply-templates select="notoc" mode="all"/> + <xsl:text> </xsl:text> + <xsl:apply-templates select="toc"/> + <xsl:apply-templates select="notoc"/> + <xsl:text> </xsl:text> + <xsl:text>distclean: clean +	-rm -f </xsl:text> + <xsl:text>autolayout.xml website.database.xml </xsl:text> + <xsl:text> </xsl:text> + <xsl:value-of select="$depends-file"/> + <xsl:text> </xsl:text> + <xsl:text>clean: </xsl:text> + <xsl:choose> + <xsl:when test="$remove-output-root and not($output-root='')"> + <xsl:text>	-rm -rf </xsl:text> + <xsl:call-template name="output-root"/> + </xsl:when> + <xsl:otherwise> + <xsl:text>	-rm -f </xsl:text> + <xsl:apply-templates select="toc" mode="all"/> + <xsl:apply-templates select="notoc" mode="all"/> + </xsl:otherwise> + </xsl:choose> + <xsl:text> </xsl:text> +</xsl:template> + +<xsl:template match="toc"> +<!-- + <xsl:apply-templates select="." mode="calculate-dir"/> +--> + <xsl:call-template name="output-root"/> + <xsl:value-of select="@dir"/> + <xsl:value-of select="$filename-prefix"/> + <xsl:value-of select="@filename"/> + <xsl:text>: </xsl:text> + <xsl:value-of select="@page"/> + <xsl:text> </xsl:text> + <xsl:apply-templates select=".//tocentry"/> +</xsl:template> + +<xsl:template match="tocentry|notoc"> +<!-- + <xsl:apply-templates select="." mode="calculate-dir"/> +--> + <xsl:if test="@filename"> + <xsl:call-template name="output-root"/> + <xsl:value-of select="@dir"/> + <xsl:value-of select="$filename-prefix"/> + <xsl:value-of select="@filename"/> + <xsl:text>: </xsl:text> + <xsl:value-of select="@page"/> + <xsl:text> </xsl:text> + </xsl:if> +</xsl:template> + +<xsl:template match="toc" mode="all"> + <xsl:apply-templates select=".//tocentry" mode="all"/> +<!-- + <xsl:apply-templates select="." mode="calculate-dir"/> +--> + <xsl:call-template name="output-root"/> + <xsl:value-of select="@dir"/> + <xsl:value-of select="$filename-prefix"/> + <xsl:value-of select="@filename"/> + <xsl:text> </xsl:text> +</xsl:template> + +<xsl:template match="tocentry|notoc" mode="all"> +<!-- + <xsl:apply-templates select="." mode="calculate-dir"/> +--> + <xsl:if test="@filename"> + <xsl:call-template name="output-root"/> + <xsl:value-of select="@dir"/> + <xsl:value-of select="$filename-prefix"/> + <xsl:value-of select="@filename"/> + <xsl:text> </xsl:text> + </xsl:if> +</xsl:template> + +<xsl:template match="*" mode="calculate-dir"> + <xsl:choose> + <xsl:when test="starts-with(@dir, '/')"> + <!-- if the directory on this begins with a "/", we're done... --> + <xsl:value-of select="substring-after(@dir, '/')"/> +<!-- + <xsl:if test="@dir != '/'"> + <xsl:text>/</xsl:text> + </xsl:if> +--> + </xsl:when> + + <xsl:when test="parent::*"> + <!-- if there's a parent, try it --> + <xsl:apply-templates select="parent::*" mode="calculate-dir"/> + <xsl:if test="@dir"> + <xsl:value-of select="@dir"/> +<!-- + <xsl:text>/</xsl:text> +--> + </xsl:if> + </xsl:when> + + <xsl:otherwise> + <xsl:if test="@dir"> + <xsl:value-of select="@dir"/> +<!-- + <xsl:text>/</xsl:text> +--> + </xsl:if> + </xsl:otherwise> + </xsl:choose> +</xsl:template> + +<xsl:template name="output-root"> + <xsl:if test="$output-root != ''"> + <xsl:value-of select="$output-root"/> + <xsl:text>/</xsl:text> + </xsl:if> +</xsl:template> + + +</xsl:stylesheet> |