1 <?xml version="1.0" encoding="utf-8"?>
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
5 Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 Distributed under the Boost Software License, Version 1.0. (See accompanying
8 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 <xsl:output method="text"/>
12 <xsl:strip-space elements="*"/>
15 <xsl:variable name="newline">
21 <xsl:template match="/doxygen">
23 / Copyright (c) 2003-2017 Christopher M. Kohlhoff (chris at kohlhoff dot com)
25 / Distributed under the Boost Software License, Version 1.0. (See accompanying
26 / file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
29 [section:tutorial Tutorial]
33 <xsl:for-each select="compounddef[@kind = 'page' and @id = 'indexpage']">
34 <xsl:apply-templates select="detaileddescription"/>
37 <xsl:for-each select="
40 @id != 'indexpage' and
41 not(contains(@id, 'src'))]">
42 <xsl:text>[section:</xsl:text>
43 <xsl:value-of select="concat(@id, ' ', title)"/>
44 <xsl:text>]</xsl:text>
45 <xsl:value-of select="$newline"/>
46 <xsl:value-of select="$newline"/>
47 <xsl:apply-templates select="detaileddescription"/>
48 <xsl:variable name="srcid" select="concat(@id, 'src')"/>
49 <xsl:if test="count(/doxygen/compounddef[@id = $srcid]) > 0">
50 <xsl:value-of select="$newline"/>
51 <xsl:value-of select="$newline"/>
52 <xsl:text>[section:src </xsl:text>
53 <xsl:value-of select="/doxygen/compounddef[@id = $srcid]/title"/>
54 <xsl:text>]</xsl:text>
55 <xsl:value-of select="$newline"/>
56 <xsl:value-of select="$newline"/>
57 <xsl:apply-templates select="/doxygen/compounddef[@id = $srcid]/detaileddescription"/>
58 <xsl:text>[endsect]</xsl:text>
59 <xsl:value-of select="$newline"/>
60 <xsl:value-of select="$newline"/>
62 <xsl:text>[endsect]</xsl:text>
63 <xsl:value-of select="$newline"/>
64 <xsl:value-of select="$newline"/>
67 <xsl:value-of select="$newline"/>
68 <xsl:text>[endsect]</xsl:text>
73 <!--========== Utilities ==========-->
75 <xsl:template name="strip-asio-ns">
76 <xsl:param name="name"/>
78 <xsl:when test="contains($name, 'boost::system::is_error_code_enum')">
79 <xsl:value-of select="$name"/>
81 <xsl:when test="contains($name, 'asio::')">
82 <xsl:value-of select="substring-after($name, 'asio::')"/>
85 <xsl:value-of select="$name"/>
91 <xsl:template name="make-id">
92 <xsl:param name="name"/>
94 <xsl:when test="contains($name, '::')">
95 <xsl:call-template name="make-id">
96 <xsl:with-param name="name"
97 select="concat(substring-before($name, '::'), '__', substring-after($name, '::'))"/>
100 <xsl:when test="contains($name, '=')">
101 <xsl:call-template name="make-id">
102 <xsl:with-param name="name"
103 select="concat(substring-before($name, '='), '_eq_', substring-after($name, '='))"/>
106 <xsl:when test="contains($name, '!')">
107 <xsl:call-template name="make-id">
108 <xsl:with-param name="name"
109 select="concat(substring-before($name, '!'), '_not_', substring-after($name, '!'))"/>
112 <xsl:when test="contains($name, '<')">
113 <xsl:call-template name="make-id">
114 <xsl:with-param name="name"
115 select="concat(substring-before($name, '<'), '_lt_', substring-after($name, '<'))"/>
118 <xsl:when test="contains($name, '>')">
119 <xsl:call-template name="make-id">
120 <xsl:with-param name="name"
121 select="concat(substring-before($name, '>'), '_gt_', substring-after($name, '>'))"/>
124 <xsl:when test="contains($name, '+')">
125 <xsl:call-template name="make-id">
126 <xsl:with-param name="name"
127 select="concat(substring-before($name, '+'), '_plus_', substring-after($name, '+'))"/>
130 <xsl:when test="contains($name, '~')">
131 <xsl:call-template name="make-id">
132 <xsl:with-param name="name"
133 select="concat(substring-before($name, '~'), '_', substring-after($name, '~'))"/>
136 <xsl:when test="contains($name, ' ')">
137 <xsl:call-template name="make-id">
138 <xsl:with-param name="name"
139 select="concat(substring-before($name, ' '), '_', substring-after($name, ' '))"/>
142 <xsl:when test="contains($name, 'boost__posix_time__ptime')">
143 <xsl:call-template name="make-id">
144 <xsl:with-param name="name"
145 select="concat(substring-before($name, 'boost__posix_time__ptime'), 'ptime', substring-after($name, 'boost__posix_time__ptime'))"/>
149 <xsl:value-of select="$name"/>
155 <xsl:template name="replace-scope-marker">
156 <xsl:param name="text"/>
158 <xsl:when test="contains($text, '_1_1')">
159 <xsl:call-template name="replace-scope-marker">
160 <xsl:with-param name="text"
161 select="concat(substring-before($text, '_1_1'), '::', substring-after($text, '_1_1'))"/>
165 <xsl:value-of select="$text"/>
171 <xsl:template name="refid-to-anchor">
172 <xsl:param name="text"/>
173 <xsl:variable name="scoped-text">
174 <xsl:call-template name="replace-scope-marker">
175 <xsl:with-param name="text" select="$text"/>
178 <xsl:value-of select="substring-after($scoped-text, '_1')"/>
182 <!--========== Markup ==========-->
184 <xsl:template match="para">
185 <xsl:apply-templates/>
186 <xsl:value-of select="$newline"/>
187 <xsl:value-of select="$newline"/>
191 <xsl:template match="title">
192 <xsl:variable name="title">
193 <xsl:value-of select="."/>
195 <xsl:if test="string-length($title) > 0">
196 <xsl:text>[heading </xsl:text>
197 <xsl:value-of select="."/>
198 <xsl:text>]</xsl:text>
199 <xsl:value-of select="$newline"/>
200 <xsl:value-of select="$newline"/>
205 <xsl:template match="programlisting">
206 <xsl:value-of select="$newline"/>
207 <xsl:apply-templates/>
208 <xsl:value-of select="$newline"/>
212 <xsl:template match="codeline">
213 <xsl:if test="string-length(.) > 0">
214 <xsl:text> ``''''''``</xsl:text>
216 <xsl:apply-templates mode="codeline"/>
217 <xsl:value-of select="$newline"/>
221 <xsl:template match="sp">
222 <xsl:text> </xsl:text>
226 <xsl:template match="sp" mode="codeline">
227 <xsl:text> </xsl:text>
231 <xsl:template match="linebreak">
232 <xsl:value-of select="$newline"/>
233 <xsl:value-of select="$newline"/>
237 <xsl:template match="listitem">
238 <xsl:text>* </xsl:text>
239 <xsl:apply-templates/>
240 <xsl:value-of select="$newline"/>
244 <xsl:template match="emphasis">
245 <xsl:text>[*</xsl:text>
246 <xsl:value-of select="."/>
247 <xsl:text>]</xsl:text>
251 <xsl:template match="computeroutput">
252 <xsl:text>`</xsl:text>
253 <xsl:value-of select="."/>
254 <xsl:text>`</xsl:text>
258 <xsl:template match="text()">
259 <xsl:variable name="text" select="."/>
260 <xsl:variable name="starts-with-whitespace" select="
261 starts-with($text, ' ') or starts-with($text, $newline)"/>
262 <xsl:variable name="preceding-node-name">
263 <xsl:for-each select="preceding-sibling::*">
264 <xsl:if test="position() = last()">
265 <xsl:value-of select="local-name()"/>
269 <xsl:variable name="after-newline" select="
270 $preceding-node-name = 'programlisting' or
271 $preceding-node-name = 'linebreak'"/>
273 <xsl:when test="$starts-with-whitespace and $after-newline">
274 <xsl:call-template name="escape-text">
275 <xsl:with-param name="text">
276 <xsl:call-template name="strip-leading-whitespace">
277 <xsl:with-param name="text" select="$text"/>
283 <xsl:call-template name="escape-text">
284 <xsl:with-param name="text" select="$text"/>
291 <xsl:template name="strip-leading-whitespace">
292 <xsl:param name="text"/>
294 <xsl:when test="starts-with($text, ' ')">
295 <xsl:call-template name="strip-leading-whitespace">
296 <xsl:with-param name="text" select="substring($text, 2)"/>
299 <xsl:when test="starts-with($text, $newline)">
300 <xsl:call-template name="strip-leading-whitespace">
301 <xsl:with-param name="text" select="substring($text, 2)"/>
305 <xsl:value-of select="$text"/>
311 <xsl:template name="escape-text">
312 <xsl:param name="text"/>
314 <xsl:when test="contains($text, '_')">
315 <xsl:value-of select="substring-before($text, '_')"/>
316 <xsl:text>\_</xsl:text>
317 <xsl:call-template name="escape-text">
318 <xsl:with-param name="text" select="substring-after($text, '_')"/>
322 <xsl:value-of select="$text"/>
328 <xsl:template match="ref[@kindref='compound']">
329 <xsl:variable name="name">
330 <xsl:value-of select="."/>
332 <xsl:variable name="refid">
333 <xsl:value-of select="@refid"/>
336 <xsl:when test="count(/doxygen/compounddef[@id=$refid]) > 0">
337 <xsl:text>[link boost_asio.tutorial.</xsl:text>
339 <xsl:when test="contains($refid, 'src')">
340 <xsl:value-of select="substring-before($refid, 'src')"/>
341 <xsl:text>.src</xsl:text>
344 <xsl:value-of select="$refid"/>
347 <xsl:value-of select="concat(' ', .)"/>
348 <xsl:text>]</xsl:text>
350 <xsl:when test="contains($name, 'asio::')">
351 <xsl:variable name="ref-name">
352 <xsl:call-template name="strip-asio-ns">
353 <xsl:with-param name="name" select="$name"/>
356 <xsl:variable name="ref-id">
357 <xsl:call-template name="make-id">
358 <xsl:with-param name="name" select="$ref-name"/>
361 [link boost_asio.reference.<xsl:value-of select="$ref-id"/><xsl:text> </xsl:text><xsl:value-of
362 select="$ref-name"/>]</xsl:when>
364 <xsl:apply-templates/>
370 <xsl:template match="ref[@kindref='member']">
371 <xsl:variable name="refid">
372 <xsl:value-of select="@refid"/>
374 <xsl:variable name="text">
375 <xsl:call-template name="strip-asio-ns">
376 <xsl:with-param name="name" select="."/>
380 <xsl:when test="$refid='index_1index'">
381 <xsl:text>[link boost_asio.tutorial </xsl:text>
382 <xsl:value-of select="$text"/>
383 <xsl:text>]</xsl:text>
385 <xsl:when test="@external='reference.tags'">
386 <xsl:variable name="anchor">
387 <xsl:call-template name="refid-to-anchor">
388 <xsl:with-param name="text" select="$refid"/>
392 <xsl:when test="count(document('reference.tags')/tagfile/compound[@kind='class']/member[anchor=$anchor]) > 0">
393 <xsl:for-each select="document('reference.tags')/tagfile/compound[@kind='class']/member[anchor=$anchor]">
394 <xsl:variable name="scope">
395 <xsl:call-template name="make-id">
396 <xsl:with-param name="name">
397 <xsl:call-template name="strip-asio-ns">
398 <xsl:with-param name="name" select="../name"/>
403 <xsl:variable name="name">
404 <xsl:call-template name="make-id">
405 <xsl:with-param name="name" select="name"/>
408 <xsl:text>[link boost_asio.reference.</xsl:text>
409 <xsl:if test="string-length($scope) > 0">
410 <xsl:value-of select="$scope"/><xsl:text>.</xsl:text>
412 <xsl:value-of select="$name"/>
413 <xsl:text> </xsl:text><xsl:value-of select="$text"/><xsl:text>]</xsl:text>
417 <xsl:apply-templates/>
422 <xsl:apply-templates/>
428 <xsl:template match="ulink">
429 <xsl:text>[@</xsl:text>
430 <xsl:value-of select="@url"/>
431 <xsl:text> </xsl:text>
432 <xsl:value-of select="."/>
433 <xsl:text>]</xsl:text>