1
<?xml version="1.0" encoding="utf-8"?>
3
Copyright (c) 2002 Douglas Gregor <doug.gregor -at- gmail.com>
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)
9
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
11
<xsl:include href="annotation.xsl"/>
12
<xsl:include href="template.xsl"/>
13
<xsl:include href="function.xsl"/>
14
<xsl:include href="type.xsl"/>
15
<xsl:include href="source-highlight.xsl"/>
16
<xsl:include href="utility.xsl"/>
17
<xsl:include href="lookup.xsl"/>
18
<xsl:include href="library.xsl"/>
19
<xsl:include href="index.xsl"/>
20
<xsl:include href="error.xsl"/>
21
<xsl:include href="macro.xsl"/>
22
<xsl:include href="testing/testsuite.xsl"/>
23
<xsl:include href="caramel/concept2docbook.xsl"/>
25
<xsl:template name="namespace-synopsis">
26
<xsl:param name="indentation" select="0"/>
27
<!-- Open namespace-->
28
<xsl:call-template name="indent">
29
<xsl:with-param name="indentation" select="$indentation"/>
31
<xsl:call-template name="source-highlight">
32
<xsl:with-param name="text" select="concat('namespace ',@name, ' {')"/>
35
<!-- Emit namespace types -->
36
<xsl:apply-templates select="class|class-specialization|
37
struct|struct-specialization|
38
union|union-specialization|
39
typedef|enum|data-member" mode="synopsis">
40
<xsl:with-param name="indentation" select="$indentation + 2"/>
41
</xsl:apply-templates>
43
<!-- Emit namespace functions -->
45
select="free-function-group|function|overloaded-function"
47
<xsl:with-param name="indentation" select="$indentation + 2"/>
48
</xsl:apply-templates>
50
<!-- Emit namespaces -->
51
<xsl:apply-templates select="namespace" mode="synopsis">
52
<xsl:with-param name="indentation" select="$indentation + 2"/>
53
</xsl:apply-templates>
55
<!-- Close namespace -->
56
<xsl:text> </xsl:text>
57
<xsl:call-template name="indent">
58
<xsl:with-param name="indentation" select="$indentation"/>
60
<xsl:call-template name="highlight-text">
61
<xsl:with-param name="text" select="'}'"/>
65
<!-- Emit namespace synopsis -->
66
<xsl:template match="namespace" mode="synopsis">
67
<xsl:param name="indentation" select="0"/>
70
<xsl:when test="count(ancestor::namespace)=0">
71
<xsl:call-template name="namespace-synopsis">
72
<xsl:with-param name="indentation" select="$indentation"/>
76
<xsl:text> </xsl:text>
77
<xsl:call-template name="namespace-synopsis">
78
<xsl:with-param name="indentation" select="$indentation"/>
84
<!-- Emit namespace reference -->
85
<xsl:template match="namespace" mode="reference">
86
<xsl:apply-templates select="namespace|free-function-group"
88
<xsl:with-param name="indentation" select="0"/>
89
</xsl:apply-templates>
90
<xsl:apply-templates select="class|class-specialization|
91
struct|struct-specialization|
92
union|union-specialization|enum|function|
93
overloaded-function|data-member|typedef"
94
mode="namespace-reference"/>
97
<!-- Eat extra documentation when in the synopsis or reference sections -->
98
<xsl:template match="para|section" mode="synopsis"/>
99
<xsl:template match="para|section" mode="reference"/>
101
<xsl:template name="find-wrap-point">
102
<xsl:param name="text"/>
103
<xsl:param name="prefix"/>
104
<xsl:param name="result" select="0"/>
105
<xsl:param name="default" select="$max-columns - string-length($prefix)"/>
106
<xsl:variable name="s" select="substring($text, 2)"/>
107
<xsl:variable name="candidate">
109
<xsl:when test="contains($s, ' ')">
110
<xsl:value-of select="string-length(substring-before($s, ' ')) + 1"/>
113
<xsl:value-of select="string-length($text)"/>
118
<xsl:when test="string-length($prefix) + $result + $candidate <= $max-columns">
119
<xsl:call-template name="find-wrap-point">
120
<xsl:with-param name="text" select="substring($text, $candidate + 1)"/>
121
<xsl:with-param name="prefix" select="$prefix"/>
122
<xsl:with-param name="result" select="$result + $candidate"/>
123
<xsl:with-param name="default" select="$result + $candidate"/>
127
<xsl:value-of select="$default"/>
132
<xsl:template name="wrap-comment">
133
<xsl:param name="prefix"/>
134
<xsl:param name="text"/>
136
<xsl:when test="string-length($prefix) + string-length($text) <= $max-columns">
137
<xsl:value-of select="$text"/>
140
<xsl:variable name="size">
141
<xsl:call-template name="find-wrap-point">
142
<xsl:with-param name="prefix" select="$prefix"/>
143
<xsl:with-param name="text" select="$text"/>
146
<xsl:value-of select="substring($text, 1, $size)"/>
147
<xsl:text> </xsl:text>
148
<xsl:value-of select="$prefix"/>
149
<xsl:call-template name="wrap-comment">
150
<xsl:with-param name="prefix" select="$prefix"/>
151
<xsl:with-param name="text" select="normalize-space(substring($text, $size + 1))"/>
157
<!-- Comment mode tries to wipe out any extra spacing in the output -->
158
<xsl:template match="purpose" mode="comment">
159
<xsl:param name="wrap" select="false()"/>
160
<xsl:param name="prefix"/>
161
<xsl:apply-templates mode="comment">
162
<xsl:with-param name="wrap"
163
select="$wrap and count(text()|*) = 1"/>
164
<xsl:with-param name="prefix" select="$prefix"/>
165
</xsl:apply-templates>
168
<xsl:template match="simpara|para" mode="comment">
169
<xsl:param name="wrap" select="false()"/>
170
<xsl:param name="prefix"/>
171
<xsl:apply-templates select="text()|*" mode="comment">
172
<xsl:with-param name="wrap"
173
select="$wrap and count(text()|*) = 1"/>
174
<xsl:with-param name="prefix" select="$prefix"/>
175
</xsl:apply-templates>
178
<xsl:template match="text()" mode="comment">
179
<xsl:param name="wrap" select="false()"/>
180
<xsl:param name="prefix"/>
181
<xsl:variable name="stripped" select="normalize-space(.)"/>
183
<xsl:when test="$wrap">
184
<xsl:call-template name="wrap-comment">
185
<xsl:with-param name="prefix" select="$prefix"/>
186
<xsl:with-param name="text" select="$stripped"/>
190
<xsl:value-of select="."/>
195
<xsl:template match="*" mode="comment">
196
<xsl:apply-templates select="." mode="annotation"/>