]>
Commit | Line | Data |
---|---|---|
f67539c2 TL |
1 | <!DOCTYPE xsl:stylesheet [ |
2 | <!-- TODO: complete this list --> | |
3 | <!ENTITY BLOCK_LEVEL_ELEMENT "programlisting | |
4 | | itemizedlist | |
5 | | orderedlist | |
6 | | parameterlist | |
7 | | simplesect | |
8 | | para | |
9 | | table | |
10 | | linebreak"> | |
11 | ]> | |
12 | <xsl:stylesheet version="3.0" | |
13 | xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | |
14 | xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
15 | xmlns:d="http://github.com/vinniefalco/docca" | |
16 | exclude-result-prefixes="xs d" | |
17 | expand-text="yes"> | |
18 | ||
19 | <xsl:include href="common.xsl"/> | |
20 | ||
21 | <xsl:output indent="yes"/> | |
22 | ||
23 | <xsl:template match="/doxygen" priority="1"> | |
24 | <page id="{@d:page-id}" type="{@d:page-type}"> | |
25 | <xsl:apply-templates mode="index-term-atts" select="."/> | |
26 | <title> | |
27 | <xsl:apply-templates mode="page-title" select="."/> | |
28 | </title> | |
29 | <xsl:apply-templates select="@d:base-compound-refid"/> | |
30 | <xsl:next-match/> | |
31 | </page> | |
32 | </xsl:template> | |
33 | ||
34 | <xsl:template match="@d:base-compound-refid"> | |
35 | <div>(Inherited from <ref d:refid="{.}">{../@d:base-compound-name}</ref>)</div> | |
36 | </xsl:template> | |
37 | ||
38 | <!-- Put an index term on every page except class (compound) and overloaded-member pages --> | |
39 | <xsl:template mode="index-term-atts" match="doxygen[@d:page-type eq 'compound' or @d:overload-position]"/> | |
40 | <xsl:template mode="index-term-atts" match="doxygen"> | |
41 | <xsl:attribute name="primary-index-term"> | |
42 | <xsl:apply-templates mode="primary-index-term" select="."/> | |
43 | </xsl:attribute> | |
44 | <xsl:apply-templates mode="secondary-index-term-att" select="."/> | |
45 | </xsl:template> | |
46 | ||
47 | <!-- By default, use the member name as the primary term... --> | |
48 | <xsl:template mode="primary-index-term" match="doxygen"> | |
49 | <xsl:apply-templates mode="member-name" select="."/> | |
50 | </xsl:template> | |
51 | <!-- ...and the compound name as the secondary term. --> | |
52 | <xsl:template mode="secondary-index-term-att" match="doxygen"> | |
53 | <xsl:attribute name="secondary-index-term"> | |
54 | <xsl:apply-templates mode="compound-name" select="."/> | |
55 | </xsl:attribute> | |
56 | </xsl:template> | |
57 | ||
58 | <!-- But with namespace members, use the fully-qualified name as the primary term... --> | |
59 | <xsl:template mode="primary-index-term" match="doxygen[compounddef/@kind eq 'namespace']"> | |
60 | <xsl:apply-templates mode="compound-and-member-name" select="."/> | |
61 | </xsl:template> | |
62 | <!-- ...and no secondary term. --> | |
63 | <xsl:template mode="secondary-index-term-att" match="doxygen[compounddef/@kind eq 'namespace']"/> | |
64 | ||
65 | <xsl:template mode="compound-name" match="doxygen" | |
66 | >{d:strip-doc-ns(compounddef/compoundname)}</xsl:template> | |
67 | ||
68 | <xsl:template mode="member-name" match="doxygen" | |
69 | >{(compounddef/sectiondef/memberdef/name)[1]}</xsl:template> | |
70 | ||
71 | <xsl:template mode="compound-and-member-name" match="doxygen"> | |
72 | <xsl:variable name="compound-name" as="xs:string"> | |
73 | <xsl:apply-templates mode="compound-name" select="."/> | |
74 | </xsl:variable> | |
75 | <xsl:if test="$compound-name">{$compound-name}::</xsl:if> | |
76 | <xsl:apply-templates mode="member-name" select="."/> | |
77 | </xsl:template> | |
78 | ||
79 | <xsl:template mode="page-title" match="doxygen[@d:page-type eq 'compound']"> | |
80 | <xsl:apply-templates mode="compound-name" select="."/> | |
81 | </xsl:template> | |
82 | <xsl:template mode="page-title" match="doxygen"> | |
83 | <xsl:apply-templates mode="compound-and-member-name" select="."/> | |
84 | <xsl:apply-templates mode="overload-qualifier" select="."/> | |
85 | </xsl:template> | |
86 | ||
87 | <xsl:template mode="overload-qualifier" match="doxygen"/> | |
88 | <xsl:template mode="overload-qualifier" match="doxygen[@d:overload-position]"> | |
89 | <xsl:text> (</xsl:text> | |
90 | <xsl:value-of select="@d:overload-position"/> | |
91 | <xsl:text> of </xsl:text> | |
92 | <xsl:value-of select="@d:overload-size"/> | |
93 | <xsl:text> overloads)</xsl:text> | |
94 | </xsl:template> | |
95 | ||
96 | ||
97 | <xsl:template match="/doxygen[@d:page-type eq 'compound']"> | |
98 | <xsl:apply-templates select="compounddef"/> | |
99 | </xsl:template> | |
100 | ||
101 | <xsl:template match="/doxygen[@d:page-type eq 'member']"> | |
102 | <xsl:apply-templates select="compounddef/sectiondef/memberdef"/> <!-- should just be one --> | |
103 | </xsl:template> | |
104 | ||
105 | <xsl:template match="/doxygen[@d:page-type eq 'overload-list']"> | |
106 | <xsl:apply-templates select="(compounddef/sectiondef/memberdef)[1]"/> | |
107 | </xsl:template> | |
108 | ||
109 | <xsl:template match="compounddef | memberdef" priority="2"> | |
110 | <xsl:next-match/> | |
111 | <xsl:apply-templates mode="includes" select="."> | |
112 | <xsl:with-param name="is-footer" select="true()"/> | |
113 | </xsl:apply-templates> | |
114 | </xsl:template> | |
115 | ||
116 | <!-- For convenience, pre-calculate some member sequences and tunnel them through --> | |
117 | <xsl:template match="compounddef" priority="1"> | |
118 | <xsl:next-match> | |
119 | <xsl:with-param name="public-types" | |
120 | select="sectiondef[@kind eq 'public-type']/memberdef | |
121 | | innerclass[@prot eq 'public'][not(d:should-ignore-inner-class(.))]" | |
122 | tunnel="yes"/> | |
123 | <xsl:with-param name="friends" | |
20effc67 | 124 | select="sectiondef[@kind eq 'friend']/memberdef[not(type = ('friend class','friend struct'))] |
f67539c2 TL |
125 | [not(d:should-ignore-friend(.))]" |
126 | tunnel="yes"/> | |
127 | </xsl:next-match> | |
128 | </xsl:template> | |
129 | ||
130 | <xsl:template match="compounddef"> | |
131 | <xsl:param name="public-types" tunnel="yes"/> | |
132 | <xsl:param name="friends" tunnel="yes"/> | |
133 | ||
134 | <xsl:apply-templates select="briefdescription"/> | |
135 | ||
136 | <xsl:apply-templates mode="section" | |
137 | select="., | |
138 | ||
139 | ( $public-types/self::memberdef/.. | |
140 | | $public-types/self::innerclass | |
141 | )[1], | |
142 | ||
143 | sectiondef[@kind = ( 'public-func', 'public-static-func')], | |
144 | sectiondef[@kind = ('protected-func','protected-static-func')], | |
145 | sectiondef[@kind = ( 'private-func', 'private-static-func')][$include-private-members], | |
146 | ||
147 | sectiondef[@kind = ( 'public-attrib', 'public-static-attrib')], | |
148 | sectiondef[@kind = ('protected-attrib','protected-static-attrib')], | |
149 | sectiondef[@kind = ( 'private-attrib', 'private-static-attrib')][$include-private-members], | |
150 | ||
151 | $friends/.., | |
152 | ||
153 | sectiondef[@kind eq 'related'], | |
154 | ||
155 | detaileddescription | |
156 | "/> | |
157 | </xsl:template> | |
158 | ||
159 | <xsl:template match="memberdef"> | |
160 | <xsl:apply-templates select="briefdescription"/> | |
161 | <xsl:apply-templates mode="section" select="., detaileddescription"/> | |
162 | </xsl:template> | |
163 | ||
164 | <xsl:template match="memberdef[@kind eq 'enum']"> | |
165 | <xsl:apply-templates select="briefdescription"/> | |
166 | <xsl:apply-templates mode="section" select="., parent::sectiondef, detaileddescription"/> | |
167 | </xsl:template> | |
168 | ||
169 | <xsl:template match="memberdef[/doxygen/@d:page-type eq 'overload-list']"> | |
20effc67 TL |
170 | <xsl:for-each-group select="../../sectiondef/memberdef" group-by="briefdescription"> |
171 | <xsl:apply-templates select="briefdescription"/> | |
172 | <xsl:apply-templates mode="overload-list" select="current-group()"/> | |
173 | </xsl:for-each-group> | |
f67539c2 TL |
174 | </xsl:template> |
175 | ||
176 | <xsl:template mode="overload-list" match="memberdef"> | |
f67539c2 TL |
177 | <overloaded-member> |
178 | <xsl:apply-templates mode="normalize-params" select="templateparamlist"/> | |
179 | <xsl:apply-templates mode="modifier" select="(@explicit, @friend, @static)[. eq 'yes'], | |
180 | @virt[. eq 'virtual']"/> | |
181 | <xsl:apply-templates select="type"/> | |
182 | <ref d:refid="{@d:page-refid}">{name}</ref> | |
183 | <params> | |
184 | <xsl:apply-templates select="param"/> | |
185 | </params> | |
186 | <xsl:apply-templates mode="modifier" select="@const[. eq 'yes']"/> | |
187 | </overloaded-member> | |
188 | </xsl:template> | |
189 | ||
190 | <xsl:template mode="modifier" match="@*"> | |
191 | <modifier>{local-name(.)}</modifier> | |
192 | </xsl:template> | |
193 | <xsl:template mode="modifier" match="@virt"> | |
194 | <modifier>virtual</modifier> | |
195 | </xsl:template> | |
196 | ||
197 | ||
198 | <xsl:template match="type"> | |
199 | <type> | |
200 | <xsl:value-of select="d:cleanup-type(normalize-space(.))"/> | |
201 | </type> | |
202 | </xsl:template> | |
203 | ||
204 | <!-- d:cleanup-param() may not be needed, and the above may suffice. (TODO: confirm this and remove d:cleanup-param() if so) | |
205 | <xsl:template match="param/type"> | |
206 | <type> | |
207 | <xsl:value-of select="d:cleanup-param(.)"/> | |
208 | </type> | |
209 | </xsl:template> | |
210 | --> | |
211 | ||
212 | <!-- TODO: Should this be a custom rule or built-in? --> | |
213 | <xsl:template mode="section" match="simplesect[matches(title,'Concepts:?')]"/> | |
214 | ||
215 | <xsl:template mode="section" match="*"> | |
216 | <section> | |
217 | <heading> | |
218 | <xsl:apply-templates mode="section-heading" select="."/> | |
219 | </heading> | |
220 | <xsl:apply-templates mode="section-body" select="."/> | |
221 | </section> | |
222 | </xsl:template> | |
223 | ||
224 | <xsl:template match="simplesect | parameterlist"> | |
225 | <xsl:apply-templates mode="section" select="."/> | |
226 | </xsl:template> | |
227 | ||
228 | <xsl:template mode="section-heading" match="memberdef | | |
229 | compounddef ">Synopsis</xsl:template> | |
230 | <xsl:template mode="section-heading" match="detaileddescription">Description</xsl:template> | |
231 | ||
232 | <xsl:template mode="section-heading" match="simplesect[@kind eq 'note' ]">Remarks</xsl:template> | |
233 | <xsl:template mode="section-heading" match="simplesect[@kind eq 'see' ]">See Also</xsl:template> | |
234 | <xsl:template mode="section-heading" match="simplesect[@kind eq 'return']">Return Value</xsl:template> | |
235 | <xsl:template mode="section-heading" match="simplesect" >{title}</xsl:template> | |
236 | ||
237 | <xsl:template mode="section-heading" match="parameterlist[@kind eq 'exception' ]">Exceptions</xsl:template> | |
238 | <xsl:template mode="section-heading" match="parameterlist[@kind eq 'templateparam']">Template Parameters</xsl:template> | |
239 | <xsl:template mode="section-heading" match="parameterlist ">Parameters</xsl:template> | |
240 | ||
241 | <xsl:template mode="section-heading" match="innerclass | |
242 | | sectiondef[@kind eq 'public-type']">Types</xsl:template> | |
243 | <xsl:template mode="section-heading" match="sectiondef[@kind eq 'friend' ]">Friends</xsl:template> | |
244 | <xsl:template mode="section-heading" match="sectiondef[@kind eq 'related' ]">Related Functions</xsl:template> | |
245 | ||
246 | <xsl:template mode="section-heading" match="sectiondef[@kind eq 'enum']">Values</xsl:template> | |
247 | ||
248 | <xsl:template mode="section-heading" match="sectiondef"> | |
249 | <xsl:apply-templates mode="access-level" select="@kind"/> | |
250 | <xsl:apply-templates mode="member-kind" select="@kind"/> | |
251 | </xsl:template> | |
252 | ||
253 | <xsl:template mode="access-level" match="@kind[starts-with(.,'public' )]"/> | |
254 | <xsl:template mode="access-level" match="@kind[starts-with(.,'protected')]">Protected </xsl:template> | |
255 | <xsl:template mode="access-level" match="@kind[starts-with(.,'private' )]">Private </xsl:template> | |
256 | ||
20effc67 TL |
257 | <xsl:template mode="member-kind" match="@kind[contains(.,'-static-')]" priority="1" |
258 | >Static Members</xsl:template> | |
f67539c2 TL |
259 | <xsl:template mode="member-kind" match="@kind[ends-with(.,'func' )]">Member Functions</xsl:template> |
260 | <xsl:template mode="member-kind" match="@kind[ends-with(.,'attrib')]">Data Members</xsl:template> | |
261 | ||
262 | <xsl:template mode="section-body" match="sectiondef | innerclass | parameterlist"> | |
263 | <table> | |
264 | <tr> | |
265 | <th> | |
266 | <xsl:apply-templates mode="column-1-name" select="."/> | |
267 | </th> | |
268 | <th> | |
269 | <xsl:apply-templates mode="column-2-name" select="."/> | |
270 | </th> | |
271 | </tr> | |
272 | <xsl:apply-templates mode="table-body" select="."/> | |
273 | </table> | |
274 | </xsl:template> | |
275 | ||
276 | <xsl:template mode="column-1-name" match="*">Name</xsl:template> | |
277 | <xsl:template mode="column-2-name" match="*">Description</xsl:template> | |
278 | ||
279 | <xsl:template mode="column-1-name" | |
280 | match="parameterlist[@kind = ('exception','templateparam')]">Type</xsl:template> | |
281 | ||
282 | <xsl:template mode="column-2-name" match="parameterlist[@kind eq 'exception']">Thrown On</xsl:template> | |
283 | ||
284 | ||
285 | <xsl:template mode="table-body" match="parameterlist"> | |
286 | <xsl:apply-templates mode="parameter-row" select="parameteritem"/> | |
287 | </xsl:template> | |
288 | ||
289 | <xsl:template mode="parameter-row" match="parameteritem"> | |
290 | <tr> | |
291 | <td> | |
292 | <code> | |
293 | <!-- ASSUMPTION: <parameternamelist> only ever has one <parametername> child --> | |
294 | <xsl:apply-templates select="parameternamelist/parametername/node()"/> | |
295 | </code> | |
296 | </td> | |
297 | <td> | |
298 | <xsl:apply-templates select="parameterdescription/node()"/> | |
299 | </td> | |
300 | </tr> | |
301 | </xsl:template> | |
302 | ||
303 | <xsl:template mode="table-body" match="sectiondef[@kind eq 'enum']"> | |
304 | <xsl:apply-templates mode="enum-row" select="memberdef/enumvalue"/> <!-- Use input order for enum values --> | |
305 | </xsl:template> | |
306 | ||
307 | <xsl:template mode="enum-row" match="enumvalue"> | |
308 | <tr> | |
309 | <td> | |
310 | <code>{name}</code> | |
311 | </td> | |
312 | <td> | |
313 | <xsl:apply-templates select="briefdescription, detaileddescription"/> | |
314 | </td> | |
315 | </tr> | |
316 | </xsl:template> | |
317 | ||
318 | <xsl:template mode="table-body" match="sectiondef | innerclass"> | |
319 | <xsl:variable name="member-nodes" as="element()*"> | |
320 | <xsl:apply-templates mode="member-nodes" select="."/> | |
321 | </xsl:variable> | |
20effc67 TL |
322 | <xsl:for-each-group select="$member-nodes" group-by="d:member-name(.)"> |
323 | <xsl:sort select="current-grouping-key()"/> | |
324 | <xsl:apply-templates mode="member-row" select="."/> | |
325 | </xsl:for-each-group> | |
f67539c2 TL |
326 | </xsl:template> |
327 | ||
328 | <xsl:template mode="member-nodes" match="innerclass | sectiondef[@kind eq 'public-type']"> | |
20effc67 | 329 | <xsl:param name="public-types" tunnel="yes" select="()"/> |
f67539c2 TL |
330 | <xsl:sequence select="$public-types"/> |
331 | </xsl:template> | |
332 | ||
333 | <xsl:template mode="member-nodes" match="sectiondef[@kind eq 'friend']"> | |
334 | <xsl:param name="friends" tunnel="yes"/> | |
335 | <xsl:sequence select="$friends"/> | |
336 | </xsl:template> | |
337 | ||
338 | <xsl:template mode="member-nodes" match="sectiondef"> | |
20effc67 TL |
339 | <!-- |
340 | ASSUMPTION (for now): At least one member per section (table) must not be in a user-defined group. | |
341 | Also, we may need a more robust mapping between a user-defined group's members and the sections | |
342 | in which they belong. For now, we are using this partial test. | |
343 | --> | |
344 | <xsl:sequence select="memberdef, | |
345 | ../sectiondef[@kind eq 'user-defined']/memberdef[(@kind||@prot||@static) = | |
346 | current()/memberdef/(@kind||@prot||@static)]"/> | |
f67539c2 TL |
347 | </xsl:template> |
348 | ||
349 | ||
350 | <xsl:function name="d:member-name"> | |
351 | <xsl:param name="element"/> | |
352 | <xsl:apply-templates mode="member-name" select="$element"/> | |
353 | </xsl:function> | |
354 | ||
355 | <xsl:template mode="member-name" match="memberdef"> | |
356 | <xsl:sequence select="name"/> | |
357 | </xsl:template> | |
358 | <xsl:template mode="member-name" match="innerclass"> | |
359 | <xsl:sequence select="d:referenced-inner-class/compounddef/compoundname ! d:strip-ns(.)"/> | |
360 | </xsl:template> | |
361 | ||
362 | ||
f67539c2 TL |
363 | <xsl:template mode="member-row" match="*"> |
364 | <tr> | |
365 | <td> | |
366 | <bold> | |
20effc67 | 367 | <ref d:refid="{@d:page-refid}">{current-grouping-key()}</ref> |
f67539c2 TL |
368 | </bold> |
369 | </td> | |
370 | <td> | |
371 | <xsl:apply-templates mode="member-description" select="."/> | |
372 | </td> | |
373 | </tr> | |
374 | </xsl:template> | |
375 | ||
376 | <xsl:template mode="member-description" match="innerclass"> | |
377 | <xsl:apply-templates select="d:referenced-inner-class/compounddef/briefdescription"/> | |
378 | </xsl:template> | |
379 | <xsl:template mode="member-description" match="memberdef"> | |
20effc67 | 380 | <xsl:variable name="descriptions" select="current-group()/briefdescription"/> |
f67539c2 TL |
381 | <!-- Pull in any overload descriptions but only if they vary --> |
382 | <xsl:for-each select="distinct-values($descriptions)"> | |
383 | <xsl:apply-templates select="$descriptions[. eq current()][1]"/> | |
384 | </xsl:for-each> | |
385 | </xsl:template> | |
386 | ||
387 | ||
388 | <xsl:template mode="section-body" match="detaileddescription | simplesect"> | |
389 | <xsl:apply-templates/> | |
390 | </xsl:template> | |
391 | ||
392 | <xsl:template mode="section-body" match="compounddef | memberdef" priority="1"> | |
393 | <xsl:apply-templates mode="includes" select="."/> | |
394 | <xsl:next-match/> | |
395 | </xsl:template> | |
396 | ||
397 | <xsl:template mode="section-body" match="compounddef"> | |
398 | <compound> | |
399 | <xsl:apply-templates mode="normalize-params" select="templateparamlist"/> | |
400 | <kind>{@kind}</kind> | |
401 | <name>{d:strip-ns(compoundname)}</name> | |
402 | <xsl:for-each select="basecompoundref[not(d:should-ignore-base(.))]"> | |
403 | <base> | |
404 | <prot>{@prot}</prot> | |
405 | <name>{d:strip-doc-ns(.)}</name> | |
406 | </base> | |
407 | </xsl:for-each> | |
408 | </compound> | |
409 | </xsl:template> | |
410 | ||
411 | <xsl:template mode="section-body" match="memberdef[@kind eq 'typedef']"> | |
412 | <typedef> | |
413 | <xsl:apply-templates mode="normalize-params" select="templateparamlist"/> | |
414 | <xsl:apply-templates select="name, type"/> | |
415 | </typedef> | |
416 | <!-- Nested compounddefs were derived from refs in the typedef's type --> | |
417 | <xsl:apply-templates select="d:referenced-typedef-class/compounddef"/> | |
418 | </xsl:template> | |
419 | ||
420 | <!-- Suppress the display of several aspects of referenced typedef classes --> | |
421 | ||
422 | <!-- Don't show the briefdescription --> | |
423 | <xsl:template match="d:referenced-typedef-class/compounddef/briefdescription"/> | |
424 | ||
425 | <!-- Don't show the Synopsis --> | |
426 | <xsl:template mode="section" match="d:referenced-typedef-class/compounddef"/> | |
427 | ||
428 | <!-- Exclude the "Description" heading (only show the body) --> | |
429 | <xsl:template mode="section" match="d:referenced-typedef-class/compounddef/detaileddescription"> | |
430 | <xsl:apply-templates mode="section-body" select="."/> | |
431 | </xsl:template> | |
432 | ||
433 | <!-- Don't show the includes header or footer --> | |
434 | <xsl:template mode="includes" match="d:referenced-typedef-class/compounddef"/> | |
435 | ||
436 | ||
437 | <xsl:template mode="section-body" match="memberdef[@kind eq 'enum']"> | |
438 | <enum> | |
439 | <xsl:apply-templates select="name"/> | |
440 | </enum> | |
441 | </xsl:template> | |
442 | ||
443 | <xsl:template mode="section-body" match="memberdef[@kind eq 'variable']"> | |
444 | <variable> | |
445 | <xsl:apply-templates mode="modifier" select="@static[. eq 'yes']"/> | |
446 | <xsl:apply-templates select="type, name"/> | |
447 | <xsl:apply-templates select="initializer[count(../initializer) eq 1]"/> | |
448 | </variable> | |
449 | </xsl:template> | |
450 | ||
451 | <xsl:template mode="section-body" match="memberdef[@kind = ('function','friend')]"> | |
452 | <function> | |
453 | <xsl:apply-templates mode="normalize-params" select="templateparamlist"/> | |
454 | <xsl:apply-templates mode="modifier" select="@static[. eq 'yes'], | |
455 | @virt [. eq 'virtual']"/> | |
456 | <xsl:apply-templates select="type, name"/> | |
457 | <params> | |
458 | <xsl:apply-templates select="param"/> | |
459 | </params> | |
460 | <xsl:apply-templates mode="modifier" select="@const[. eq 'yes']"/> | |
461 | </function> | |
462 | </xsl:template> | |
463 | ||
464 | <!-- TODO: make sure this is robust and handles all the possible cases well --> | |
465 | <xsl:template mode="normalize-params" match="templateparamlist/param/type[not(../declname)] | |
466 | [starts-with(.,'class ')]" | |
467 | priority="1"> | |
468 | <type>class</type> | |
469 | <declname>{substring-after(.,'class ')}</declname> | |
470 | </xsl:template> | |
471 | ||
472 | <xsl:template mode="normalize-params" match="templateparamlist/param/type[not(../declname)]"> | |
473 | <ERROR message="param neither has a declname nor a 'class ' prefix in the type"/> | |
474 | </xsl:template> | |
475 | ||
476 | <xsl:template mode="normalize-params" match="templateparamlist/param/defname"/> | |
477 | ||
478 | ||
479 | <!-- We only need to keep the @file attribute --> | |
480 | <xsl:template match="location/@*[. except ../@file]"/> | |
481 | ||
482 | <xsl:template match="briefdescription | detaileddescription"> | |
483 | <div> | |
484 | <xsl:apply-templates/> | |
485 | </div> | |
486 | </xsl:template> | |
487 | ||
488 | <xsl:template match="simplesect/title"/> | |
489 | ||
490 | <!-- TODO: verify we don't need this; it was causing duplicate headings in simplesect sections | |
491 | <xsl:template match="title"> | |
492 | <heading> | |
493 | <xsl:apply-templates/> | |
494 | </heading> | |
495 | </xsl:template> | |
496 | --> | |
497 | ||
498 | <!-- By default, don't output an includes header or footer --> | |
499 | <xsl:template mode="includes" match="*"/> | |
500 | ||
501 | <!-- TODO: Review; this is meant to effect what the previous code did, but I'm not sure it captures the original intentions --> | |
502 | <xsl:template mode="includes" match="compounddef | |
503 | | memberdef[@kind eq 'friend' or ../../@kind eq 'namespace'] | |
504 | [not(/doxygen/@d:page-type eq 'overload-list')]"> | |
505 | <xsl:param name="is-footer"/> | |
506 | <para> | |
507 | <xsl:choose> | |
508 | <xsl:when test="$is-footer"> | |
509 | <footer> | |
510 | <xsl:apply-templates select="location"/> | |
511 | </footer> | |
512 | </xsl:when> | |
513 | <xsl:otherwise> | |
514 | <xsl:apply-templates select="location"/> | |
515 | </xsl:otherwise> | |
516 | </xsl:choose> | |
517 | </para> | |
518 | </xsl:template> | |
519 | ||
520 | <!-- Strip the project namespace prefix from link display names | |
521 | (matching the text node so this will still work with the strip-leading-space mode/process below) --> | |
522 | <!-- TODO: figure out if we need anything like this (maybe not). | |
523 | <xsl:template match="ref/text()[starts-with(.,$doc-ns)]"> | |
524 | <xsl:value-of select="d:strip-doc-ns(.)"/> | |
525 | </xsl:template> | |
526 | --> | |
527 | ||
528 | ||
529 | <!-- When a <para> directly contains a mix of inline nodes and block-level elements, normalize its content --> | |
530 | <xsl:template match="para[&BLOCK_LEVEL_ELEMENT;]"> | |
531 | <para> | |
532 | <xsl:for-each-group select="* | text()" group-adjacent="d:is-inline(.)"> | |
533 | <xsl:apply-templates mode="capture-ranges" select="."/> | |
534 | </xsl:for-each-group> | |
535 | </para> | |
536 | </xsl:template> | |
537 | ||
538 | <xsl:function name="d:is-inline"> | |
539 | <xsl:param name="node"/> | |
540 | <xsl:sequence select="not($node/../(&BLOCK_LEVEL_ELEMENT;)[. is $node])"/> | |
541 | </xsl:function> | |
542 | ||
543 | <!-- Process the block-level elements as usual --> | |
544 | <xsl:template mode="capture-ranges" match="node()"> | |
545 | <xsl:apply-templates select="current-group()"/> | |
546 | </xsl:template> | |
547 | ||
548 | <!-- Wrap contiguous ranges of inline children in a nested <para> --> | |
549 | <xsl:template mode="capture-ranges" match="node()[d:is-inline(.)]"> | |
550 | <xsl:choose> | |
551 | <!-- But only if it has text or if the group has more than one node --> | |
552 | <xsl:when test="normalize-space(.) or current-group()[2]"> | |
553 | <para> | |
554 | <xsl:apply-templates mode="strip-leading-space" select="."/> | |
555 | </para> | |
556 | </xsl:when> | |
557 | <xsl:otherwise> | |
558 | <xsl:next-match/> | |
559 | </xsl:otherwise> | |
560 | </xsl:choose> | |
561 | </xsl:template> | |
562 | ||
563 | ||
564 | <!-- Strip leading whitespace from the nested paragraphs to prevent eventual interpretation as a code block --> | |
565 | <xsl:template mode="strip-leading-space" match="*"> | |
566 | <xsl:copy> | |
567 | <xsl:apply-templates mode="#current" select="@* | node()[1]"/> | |
568 | </xsl:copy> | |
569 | <xsl:apply-templates mode="#current" select="following-sibling::node()[1] | |
570 | [ancestor-or-self::node() intersect current-group()]"/> | |
571 | </xsl:template> | |
572 | ||
573 | <xsl:template mode="strip-leading-space" match="@*"> | |
574 | <xsl:copy/> | |
575 | </xsl:template> | |
576 | ||
577 | <xsl:template mode="strip-leading-space" match="text()"> | |
578 | <xsl:param name="done-stripping" tunnel="yes" select="false()"/> | |
579 | <xsl:choose> | |
580 | <xsl:when test="$done-stripping"> | |
581 | <xsl:apply-templates select="."/> | |
582 | </xsl:when> | |
583 | <xsl:otherwise> | |
584 | <xsl:sequence select="replace(.,'^\s+','')"/> | |
585 | </xsl:otherwise> | |
586 | </xsl:choose> | |
587 | <xsl:apply-templates mode="#current" select="following-sibling::node()[1] | |
588 | [ancestor-or-self::node() intersect current-group()]"> | |
589 | <xsl:with-param name="done-stripping" select="$done-stripping or normalize-space(.)" tunnel="yes"/> | |
590 | </xsl:apply-templates> | |
591 | </xsl:template> | |
592 | ||
593 | ||
594 | <xsl:template mode="#default normalize-params" match="@* | node()"> | |
595 | <xsl:copy copy-namespaces="no"> | |
596 | <xsl:apply-templates mode="#current" select="@* | node()"/> | |
597 | </xsl:copy> | |
598 | </xsl:template> | |
599 | ||
600 | </xsl:stylesheet> |