1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271
|
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<!--
Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="newline">
<xsl:text>
</xsl:text>
</xsl:variable>
<xsl:template match="/doxygen">
<xsl:text>[/
/ Copyright (c) 2003-2008 Christopher M. Kohlhoff (chris at kohlhoff dot 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)
/]
[section:tutorial Tutorial]
</xsl:text>
<xsl:for-each select="compounddef[@kind = 'page' and @id = 'indexpage']">
<xsl:apply-templates select="detaileddescription"/>
</xsl:for-each>
<xsl:for-each select="
compounddef[
@kind = 'page' and
@id != 'indexpage' and
not(contains(@id, 'src'))]">
<xsl:text>[section:</xsl:text>
<xsl:value-of select="concat(@id, ' ', title)"/>
<xsl:text>]</xsl:text>
<xsl:value-of select="$newline"/>
<xsl:value-of select="$newline"/>
<xsl:apply-templates select="detaileddescription"/>
<xsl:variable name="srcid" select="concat(@id, 'src')"/>
<xsl:if test="count(/doxygen/compounddef[@id = $srcid]) > 0">
<xsl:value-of select="$newline"/>
<xsl:value-of select="$newline"/>
<xsl:text>[section:src </xsl:text>
<xsl:value-of select="/doxygen/compounddef[@id = $srcid]/title"/>
<xsl:text>]</xsl:text>
<xsl:value-of select="$newline"/>
<xsl:value-of select="$newline"/>
<xsl:apply-templates select="/doxygen/compounddef[@id = $srcid]/detaileddescription"/>
<xsl:text>[endsect]</xsl:text>
<xsl:value-of select="$newline"/>
<xsl:value-of select="$newline"/>
</xsl:if>
<xsl:text>[endsect]</xsl:text>
<xsl:value-of select="$newline"/>
<xsl:value-of select="$newline"/>
</xsl:for-each>
<xsl:value-of select="$newline"/>
<xsl:text>[endsect]</xsl:text>
</xsl:template>
<!--========== Markup ==========-->
<xsl:template match="para">
<xsl:apply-templates/>
<xsl:value-of select="$newline"/>
<xsl:value-of select="$newline"/>
</xsl:template>
<xsl:template match="title">
<xsl:variable name="title">
<xsl:value-of select="."/>
</xsl:variable>
<xsl:if test="string-length($title) > 0">
<xsl:text>[heading </xsl:text>
<xsl:value-of select="."/>
<xsl:text>]</xsl:text>
<xsl:value-of select="$newline"/>
<xsl:value-of select="$newline"/>
</xsl:if>
</xsl:template>
<xsl:template match="programlisting">
<xsl:value-of select="$newline"/>
<xsl:apply-templates/>
<xsl:value-of select="$newline"/>
</xsl:template>
<xsl:template match="codeline">
<xsl:if test="string-length(.) > 0">
<xsl:text> ``''''''``</xsl:text>
</xsl:if>
<xsl:apply-templates mode="codeline"/>
<xsl:value-of select="$newline"/>
</xsl:template>
<xsl:template match="sp">
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="sp" mode="codeline">
<xsl:text> </xsl:text>
</xsl:template>
<xsl:template match="linebreak">
<xsl:value-of select="$newline"/>
<xsl:value-of select="$newline"/>
</xsl:template>
<xsl:template match="listitem">
<xsl:text>* </xsl:text>
<xsl:apply-templates/>
<xsl:value-of select="$newline"/>
</xsl:template>
<xsl:template match="emphasis">
<xsl:text>[*</xsl:text>
<xsl:value-of select="."/>
<xsl:text>]</xsl:text>
</xsl:template>
<xsl:template match="computeroutput">
<xsl:text>`</xsl:text>
<xsl:value-of select="."/>
<xsl:text>`</xsl:text>
</xsl:template>
<xsl:template match="text()">
<xsl:variable name="text" select="."/>
<xsl:variable name="starts-with-whitespace" select="
starts-with($text, ' ') or starts-with($text, $newline)"/>
<xsl:variable name="preceding-node-name">
<xsl:for-each select="preceding-sibling::*">
<xsl:if test="position() = last()">
<xsl:value-of select="local-name()"/>
</xsl:if>
</xsl:for-each>
</xsl:variable>
<xsl:variable name="after-newline" select="
$preceding-node-name = 'programlisting' or
$preceding-node-name = 'linebreak'"/>
<xsl:choose>
<xsl:when test="$starts-with-whitespace and $after-newline">
<xsl:call-template name="escape-text">
<xsl:with-param name="text">
<xsl:call-template name="strip-leading-whitespace">
<xsl:with-param name="text" select="$text"/>
</xsl:call-template>
</xsl:with-param>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="escape-text">
<xsl:with-param name="text" select="$text"/>
</xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="strip-leading-whitespace">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="starts-with($text, ' ')">
<xsl:call-template name="strip-leading-whitespace">
<xsl:with-param name="text" select="substring($text, 2)"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="starts-with($text, $newline)">
<xsl:call-template name="strip-leading-whitespace">
<xsl:with-param name="text" select="substring($text, 2)"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="escape-text">
<xsl:param name="text"/>
<xsl:choose>
<xsl:when test="contains($text, '_')">
<xsl:value-of select="substring-before($text, '_')"/>
<xsl:text>\_</xsl:text>
<xsl:call-template name="escape-text">
<xsl:with-param name="text" select="substring-after($text, '_')"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$text"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="ref[@kindref='compound']">
<xsl:variable name="refid">
<xsl:value-of select="@refid"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="count(/doxygen/compounddef[@id=$refid]) > 0">
<xsl:text>[link boost_asio.tutorial.</xsl:text>
<xsl:choose>
<xsl:when test="contains($refid, 'src')">
<xsl:value-of select="substring-before($refid, 'src')"/>
<xsl:text>.src</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$refid"/>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="concat(' ', .)"/>
<xsl:text>]</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="ref[@kindref='member']">
<xsl:variable name="refid">
<xsl:value-of select="@refid"/>
</xsl:variable>
<xsl:choose>
<xsl:when test="$refid='index_1index'">
<xsl:text>[link boost_asio.tutorial </xsl:text>
<xsl:value-of select="."/>
<xsl:text>]</xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="ulink">
<xsl:text>[@</xsl:text>
<xsl:value-of select="@url"/>
<xsl:text> </xsl:text>
<xsl:value-of select="."/>
<xsl:text>]</xsl:text>
</xsl:template>
</xsl:stylesheet>
|