boostbook/xsl/macro.xsl
Daniel James 68bc7fa4dc Merge in improved ids in boostbook.
Merged revisions 44958,45130-45131,45152-45153,45366 via svnmerge from 
https://svn.boost.org/svn/boost/branches/doc

........
  r44958 | danieljames | 2008-05-01 00:08:20 +0100 (Thu, 01 May 2008) | 2 lines
  
  Don't generated file names with spaces, and replace multiple consecutive underscores with a single underscore. Refs #1705
........
  r45130 | danieljames | 2008-05-05 12:37:04 +0100 (Mon, 05 May 2008) | 2 lines
  
  Combine the two alternative versions of the function generate.id
........
  r45131 | danieljames | 2008-05-05 12:37:18 +0100 (Mon, 05 May 2008) | 2 lines
  
  Deal with generated ids that contain dots which aren't separators.
........
  r45152 | danieljames | 2008-05-05 21:28:44 +0100 (Mon, 05 May 2008) | 2 lines
  
  Only add the id to fully qualified ids inside specializations - so that we're not adding generated ids on to the end of generated ids.
........
  r45153 | danieljames | 2008-05-05 21:28:56 +0100 (Mon, 05 May 2008) | 2 lines
  
  If the same macro appears twice, generated unique ids.
........
  r45366 | danieljames | 2008-05-14 21:39:14 +0100 (Wed, 14 May 2008) | 2 lines
  
  Avoid removing underscores that are part of a class or function name.
........


[SVN r45577]
2008-05-20 15:49:55 +00:00

82 lines
2.7 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)
-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="macro" mode="synopsis">
<xsl:param name="indentation" select="0"/>
<xsl:text>&#10;</xsl:text>
<xsl:if
test="not(local-name(preceding-sibling::*[position()=1])=local-name(.))">
<xsl:text>&#10;</xsl:text>
</xsl:if>
<xsl:call-template name="indent">
<xsl:with-param name="indentation" select="$indentation"/>
</xsl:call-template>
<xsl:call-template name="macro-synopsis">
<xsl:with-param name="link-type" select="'link'"/>
</xsl:call-template>
</xsl:template>
<xsl:template match="macro" mode="reference">
<xsl:call-template name="reference-documentation">
<xsl:with-param name="refname" select="@name"/>
<xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
<xsl:with-param name="anchor">
<xsl:call-template name="generate.id"/>
</xsl:with-param>
<xsl:with-param name="name">
<xsl:text>Macro </xsl:text>
<xsl:call-template name="monospaced">
<xsl:with-param name="text" select="@name"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="synopsis">
<xsl:call-template name="macro-synopsis">
<xsl:with-param name="link-type" select="'none'"/>
</xsl:call-template>
</xsl:with-param>
<xsl:with-param name="text">
<xsl:apply-templates select="description"/>
</xsl:with-param>
</xsl:call-template>
</xsl:template>
<xsl:template name="macro-synopsis">
<xsl:param name="link-type"/>
<xsl:call-template name="link-or-anchor">
<xsl:with-param name="to">
<xsl:call-template name="generate.id" select="."/>
</xsl:with-param>
<xsl:with-param name="text" select="@name"/>
<xsl:with-param name="link-type" select="$link-type"/>
</xsl:call-template>
<xsl:if test="@kind='functionlike'">
<xsl:text>(</xsl:text>
<xsl:for-each select="macro-parameter">
<xsl:if test="position() &gt; 1">
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:value-of select="@name"/>
</xsl:for-each>
<xsl:text>)</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="macro" mode="generate.id">
<xsl:value-of select="@name"/>
<xsl:if test="count(key('named-entities', @name))!=1">
<xsl:text>_</xsl:text>
<xsl:value-of select="generate-id(.)"/>
</xsl:if>
</xsl:template>
</xsl:stylesheet>