• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<?xml version="1.0" encoding="utf-8"?>
2<!--
3   Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
4
5   Distributed under the Boost Software License, Version 1.0.
6   (See accompanying file LICENSE_1_0.txt or copy at
7   http://www.boost.org/LICENSE_1_0.txt)
8  -->
9<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
10                version="1.0">
11  <xsl:template match="macro" mode="synopsis">
12    <xsl:param name="indentation" select="0"/>
13
14    <xsl:text>&#10;</xsl:text>
15    <xsl:if
16      test="not(local-name(preceding-sibling::*[position()=1])=local-name(.))">
17      <xsl:text>&#10;</xsl:text>
18    </xsl:if>
19    <xsl:call-template name="indent">
20      <xsl:with-param name="indentation" select="$indentation"/>
21    </xsl:call-template>
22    <xsl:call-template name="macro-synopsis">
23      <xsl:with-param name="link-type" select="'link'"/>
24    </xsl:call-template>
25  </xsl:template>
26
27  <xsl:template match="macro" mode="reference">
28    <xsl:call-template name="reference-documentation">
29      <xsl:with-param name="refname" select="@name"/>
30      <xsl:with-param name="purpose" select="purpose/*|purpose/text()"/>
31      <xsl:with-param name="anchor">
32        <xsl:call-template name="generate.id"/>
33      </xsl:with-param>
34      <xsl:with-param name="name">
35        <xsl:text>Macro </xsl:text>
36        <xsl:call-template name="monospaced">
37          <xsl:with-param name="text" select="@name"/>
38        </xsl:call-template>
39      </xsl:with-param>
40      <xsl:with-param name="synopsis">
41        <xsl:call-template name="header-link"/>
42        <xsl:call-template name="macro-synopsis">
43          <xsl:with-param name="link-type" select="'none'"/>
44        </xsl:call-template>
45      </xsl:with-param>
46      <xsl:with-param name="text">
47        <xsl:apply-templates select="description"/>
48
49        <xsl:if test="macro-parameter/description">
50          <variablelist spacing="compact">
51            <xsl:processing-instruction name="dbhtml">
52              list-presentation="table"
53            </xsl:processing-instruction>
54
55            <!-- Document parameters -->
56            <xsl:if test="macro-parameter/description">
57              <varlistentry>
58                <term>Parameters:</term>
59                <listitem>
60                  <variablelist spacing="compact">
61                    <xsl:processing-instruction name="dbhtml">
62                      list-presentation="table"
63                    </xsl:processing-instruction>
64                    <xsl:for-each select="macro-parameter">
65                      <xsl:sort select="attribute::name"/>
66                      <xsl:if test="description">
67                        <varlistentry>
68                          <term>
69                            <xsl:call-template name="monospaced">
70                              <xsl:with-param name="text" select="@name"/>
71                            </xsl:call-template>
72                          </term>
73                          <listitem>
74                            <xsl:apply-templates select="description/*"/>
75                          </listitem>
76                        </varlistentry>
77                      </xsl:if>
78                    </xsl:for-each>
79                  </variablelist>
80                </listitem>
81              </varlistentry>
82            </xsl:if>
83          </variablelist>
84        </xsl:if>
85
86      </xsl:with-param>
87    </xsl:call-template>
88  </xsl:template>
89
90  <xsl:template name="macro-synopsis">
91    <xsl:param name="link-type"/>
92
93    <xsl:call-template name="link-or-anchor">
94      <xsl:with-param name="to">
95        <xsl:call-template name="generate.id" select="."/>
96      </xsl:with-param>
97      <xsl:with-param name="text" select="@name"/>
98      <xsl:with-param name="link-type" select="$link-type"/>
99    </xsl:call-template>
100
101    <xsl:if test="@kind='functionlike'">
102      <xsl:text>(</xsl:text>
103      <xsl:for-each select="macro-parameter">
104        <xsl:if test="position() &gt; 1">
105          <xsl:text>, </xsl:text>
106        </xsl:if>
107        <xsl:value-of select="@name"/>
108      </xsl:for-each>
109      <xsl:text>)</xsl:text>
110    </xsl:if>
111  </xsl:template>
112
113  <xsl:template match="macro" mode="generate.id">
114    <xsl:choose>
115      <xsl:when test="string-length(@name) &gt; $boost.max.id.part.length or
116          count(key('named-entities',
117            translate(@name, $uppercase-letters, $lowercase-letters)))!=1">
118        <xsl:variable name="raw.id"><xsl:call-template name="postfix.id"/></xsl:variable>
119        <xsl:value-of select="substring(@name, 1, $boost.max.id.part.length - string-length($raw.id) - 1)"/>
120        <xsl:text>_</xsl:text>
121        <xsl:value-of select="$raw.id"/>
122      </xsl:when>
123      <xsl:otherwise>
124        <xsl:value-of select="@name"/>
125      </xsl:otherwise>
126    </xsl:choose>
127  </xsl:template>
128</xsl:stylesheet>
129