/
nav.xsl
315 lines (290 loc) · 13 KB
/
nav.xsl
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
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="html" />
<xsl:template match="/project">
<div id="accordion">
<xsl:if test="count(/project/namespace[@name != 'default']) > 0">
<h1><a href="#">Namespaces</a></h1>
<div style="padding: 0px;">
<!--<input type="checkbox" onclick="$('.treeview-docblox small').toggle(!this.checked);" checked="">Compact view<br />-->
<ul id="namespaces-" class="filetree">
<xsl:apply-templates select="/project/namespace">
<xsl:sort select="@name" />
<xsl:with-param name="parent_name" select="''" />
</xsl:apply-templates>
</ul>
</div>
</xsl:if>
<xsl:if test="count(/project/package) > 0">
<h1><a href="#">Packages</a></h1>
<div style="padding: 0px;">
<xsl:if test="count(/project/package) < 2">
<ul id="packages-" class="deadtree">
<xsl:apply-templates select="/project/package">
<xsl:sort select="@name" />
</xsl:apply-templates>
</ul>
</xsl:if>
<xsl:if test="count(/project/package) > 1">
<ul id="packages-" class="filetree">
<xsl:apply-templates select="/project/package">
<xsl:sort select="@name" />
</xsl:apply-templates>
</ul>
</xsl:if>
</div>
</xsl:if>
<h1><a href="#">Files</a></h1>
<div>
<ul id="files-" class="filetree">
<xsl:apply-templates select="file">
<xsl:sort select="@path" />
</xsl:apply-templates>
</ul>
</div>
<xsl:if test="count(/project/file/*/docblock/tag[@name='api']|/project/file/class/*/docblock/tag[@name='api']|/project/file/interface/*/docblock/tag[@name='api']) > 0">
<h1><a href="#">API</a></h1>
<div style="padding: 0px;">
<ul id="api-" class="filetree">
<xsl:for-each select="/project/file/*">
<xsl:sort select="./name" />
<xsl:if test="count(./*/docblock/tag[@name='api']) > 0">
<li class="closed">
<span class="{name()}">
<xsl:value-of select="./name" />
</span>
<ul class="filetree">
<xsl:for-each select="./*/docblock/tag[@name='api']">
<xsl:sort select="../../name" />
<li>
<span class="function">
<a href="{$root}{../../../../@generated-path}#{../../../full_name}::{../../name}()" target="content">
<xsl:value-of select="../../name" />
</a>
</span>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
<xsl:if test="count(./docblock/tag[@name='api']) > 0">
<li class="closed">
<span class="file">
<xsl:value-of select="./name" />
</span>
<ul class="filetree">
<xsl:for-each select="./docblock/tag[@name='api']">
<xsl:sort select="../name" />
<li>
<span class="function">
<a href="{$root}{../../../@generated-path}#{../../name}::{../name}()" target="content">
<xsl:value-of select="../../name" />
</a>
</span>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="file">
<li class="closed">
<span class="file">
<a href="{$root}{@generated-path}" target="content">
<xsl:value-of select="@path" />
</a>
</span>
<xsl:variable name="file" select="@hash" />
<ul id="files_{$file}" class="filetree">
<xsl:for-each select="constant">
<li>
<span class="constant">
<a href="{$root}{../@generated-path}#::{name}" target="content">
<xsl:value-of select="name" /><br/>
<small>
<xsl:value-of select="docblock/description"/>
</small>
</a>
</span>
</li>
</xsl:for-each>
<xsl:for-each select="function">
<li>
<span class="function">
<a href="{$root}{../@generated-path}#::{name}()" target="content">
<xsl:value-of select="name" /><br/>
<small>
<xsl:value-of select="docblock/description"/>
</small>
</a>
</span>
</li>
</xsl:for-each>
<xsl:for-each select="class|interface">
<li>
<span class="{name()}">
<a href="{$root}{../@generated-path}#{full_name}" target="content">
<xsl:value-of select="name" /><br/>
<small>
<xsl:value-of select="docblock/description"/>
</small>
</a>
</span>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:template>
<xsl:template match="package">
<xsl:variable name="package" select="@name" />
<xsl:if test="(count(/project/file/class[docblock/tag[@name='package'][@description=$package]]) > 0)
or (count(/project/file/interface[docblock/tag[@name='package'][@description=$package]]) > 0)
or (count(/project/file[docblock/tag[@name='package'][@description=$package]]/function) > 0)
or ($package = '')">
<li class="closed">
<span class="folder">
<xsl:if test="@name=''">Default</xsl:if>
<xsl:if test="not(@name='')">
<xsl:value-of select="@name" />
</xsl:if>
</span>
<ul id="packages_{$package}" class="filetree">
<!-- List all subpackages and their classes -->
<xsl:for-each select="subpackage">
<xsl:sort select="." />
<li class="closed">
<xsl:variable name="subpackage" select="." />
<span class="folder">
<xsl:if test="$subpackage=''">Default</xsl:if>
<xsl:if test="not($subpackage='')">
<xsl:value-of select="$subpackage" />
</xsl:if>
</span>
<ul id="packages_{$package}_{$subpackage}" class="filetree">
<!-- List all functions whose file has a package which matches @name but no subpackage OR which have no package and $package is empty -->
<xsl:for-each select="/project/file[docblock/tag[@name='package'][@description=$package] and docblock/tag[@name='subpackage'][@description=$subpackage]]/function">
<xsl:sort select="name" />
<li class="closed">
<span class="{name()}">
<a href="{$root}{../@generated-path}#::{name}()" target="content">
<xsl:value-of select="name" />
<br />
<small>
<xsl:value-of select="docblock/description" />
</small>
</a>
</span>
</li>
</xsl:for-each>
<xsl:for-each select="/project/file/class[docblock/tag[@name='package'][@description=$package] and docblock/tag[@name='subpackage'][@description=$subpackage]]|/project/file/interface[docblock/tag[@name='package'][@description=$package] and docblock/tag[@name='subpackage'][@description=$subpackage]]">
<xsl:sort select="name" />
<li>
<span class="{name()}">
<a href="{$root}{../@generated-path}#{full_name}" target="content">
<xsl:value-of select="name" />
<br />
<small>
<xsl:value-of select="docblock/description" />
</small>
</a>
</span>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:for-each>
<!-- List all functions whose file has a package which matches @name but no subpackage OR which have no package and $package is empty -->
<xsl:for-each select="
/project/file[docblock/tag[@name='package'][@description=$package] and not(docblock/tag[@name='subpackage'])]/function
|/project/file[not(docblock/tag[@name='package']) and $package='']/function">
<xsl:sort select="name" />
<li class="closed">
<span class="{name()}">
<a href="{$root}{../@generated-path}#::{name}()" target="content">
<xsl:value-of select="name" />
<br />
<small>
<xsl:value-of select="docblock/description" />
</small>
</a>
</span>
</li>
</xsl:for-each>
<!-- List all classes that have a package which matches @name but no subpackage OR which have no package and $package is empty -->
<xsl:for-each select="
/project/file/class[docblock/tag[@name='package'][@description=$package] and not(docblock/tag[@name='subpackage'])]
|/project/file/interface[docblock/tag[@name='package'][@description=$package] and not(docblock/tag[@name='subpackage'])]
|/project/file/class[not(docblock/tag[@name='package']) and $package='']
|/project/file/interface[not(docblock/tag[@name='package']) and $package='']">
<xsl:sort select="name" />
<li class="closed">
<span class="{name()}">
<a href="{$root}{../@generated-path}#{full_name}" target="content">
<xsl:value-of select="name" />
<br />
<small>
<xsl:value-of select="docblock/description" />
</small>
</a>
</span>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
</xsl:template>
<xsl:template match="namespace">
<xsl:param name="parent_name" />
<xsl:variable name="full_name" select="concat($parent_name, @name)" />
<xsl:if test="(count(namespace) > 0) or (count(/project/file/function[@namespace=$full_name]) > 0) or (count(/project/file/class[@namespace=$full_name]) > 0) or (count(/project/file/interface[@namespace=$full_name]) > 0)">
<li class="closed">
<span class="folder">
<xsl:if test="@name=''">\</xsl:if>
<xsl:if test="not(@name='')">
<xsl:value-of select="@name" />
</xsl:if>
</span>
<ul>
<!-- process child namespaces -->
<xsl:apply-templates select="namespace">
<xsl:sort select="@name" />
<xsl:with-param name="parent_name" select="concat($full_name, '\')" />
</xsl:apply-templates>
<xsl:for-each select="/project/file/function[@namespace=$full_name]">
<xsl:sort select="name" />
<li>
<span class="{name()}">
<a href="{$root}{../@generated-path}#::{name}()" target="content">
<xsl:value-of select="name" />
<br />
<small>
<xsl:value-of select="docblock/description" />
</small>
</a>
</span>
</li>
</xsl:for-each>
<xsl:for-each select="/project/file/class[@namespace=$full_name]|/project/file/interface[@namespace=$full_name]">
<xsl:sort select="name" />
<li>
<span class="{name()}">
<a href="{$root}{../@generated-path}#{full_name}" target="content">
<xsl:value-of select="name" />
<br />
<small>
<xsl:value-of select="docblock/description" />
</small>
</a>
</span>
</li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
</xsl:template>
</xsl:stylesheet>