|
1 | 1 | <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
|
2 | 2 | <xsl:output method="html" omit-xml-declaration="yes"/>
|
3 | 3 |
|
| 4 | +<!-- Set this to true to display links to /category/version/{version} --> |
| 5 | +<xsl:variable name="version-category-links" select="false()"/> |
| 6 | + |
4 | 7 | <xsl:template match="/">
|
5 | 8 | <script>{
|
6 | 9 | "title":
|
|
77 | 80 | </xsl:attribute>
|
78 | 81 |
|
79 | 82 | <header>
|
80 |
| - <h3 class="underline">Example<xsl:if test="$number-examples > 1">s</xsl:if>:</h3> |
| 83 | + <h2 class="underline">Example<xsl:if test="$number-examples > 1">s</xsl:if>:</h2> |
81 | 84 | </header>
|
82 | 85 |
|
83 | 86 | <xsl:apply-templates select="example">
|
|
128 | 131 | <xsl:for-each select="signature[1]">
|
129 | 132 | <xsl:call-template name="method-signature">
|
130 | 133 | <xsl:with-param name="method-name" select="$entry-name"/>
|
| 134 | + <xsl:with-param name="dot" select="true()"/> |
131 | 135 | </xsl:call-template>
|
132 | 136 | </xsl:for-each>
|
133 | 137 | </a>
|
|
137 | 141 | <li>
|
138 | 142 | <xsl:call-template name="method-signature">
|
139 | 143 | <xsl:with-param name="method-name" select="$entry-name"/>
|
| 144 | + <xsl:with-param name="dot" select="true()"/> |
140 | 145 | </xsl:call-template>
|
141 | 146 | </li>
|
142 | 147 | </xsl:for-each>
|
|
148 | 153 | <xsl:param name="entry-type" select="@type"/>
|
149 | 154 | <xsl:param name="entry-name" select="@name"/>
|
150 | 155 |
|
151 |
| - <h2 class="jq-clearfix roundTop section-title"> |
| 156 | + <h2 class="section-title"> |
152 | 157 | <xsl:choose>
|
153 | 158 | <xsl:when test="$entry-type='method'">
|
154 | 159 | <span class="name">
|
155 | 160 | <xsl:for-each select="signature[1]">
|
156 | 161 | <xsl:call-template name="method-signature">
|
157 | 162 | <xsl:with-param name="method-name" select="$entry-name"/>
|
| 163 | + <xsl:with-param name="dot" select="true()"/> |
158 | 164 | </xsl:call-template>
|
159 | 165 | </xsl:for-each>
|
160 | 166 | </span>
|
|
188 | 194 | </xsl:if>
|
189 | 195 | </span>
|
190 | 196 | </xsl:when>
|
| 197 | + <xsl:when test="$entry-type='widget'"> |
| 198 | + <span> |
| 199 | + <xsl:value-of select="@name"/> |
| 200 | + <xsl:text> widget</xsl:text> |
| 201 | + </span> |
| 202 | + </xsl:when> |
191 | 203 | </xsl:choose>
|
192 | 204 | </h2>
|
193 | 205 | </xsl:template>
|
|
204 | 216 | <xsl:when test="@type='method'">
|
205 | 217 | <xsl:call-template name="entry-body-method"/>
|
206 | 218 | </xsl:when>
|
| 219 | + <xsl:when test="@type='widget'"> |
| 220 | + <xsl:call-template name="entry-body-widget"/> |
| 221 | + </xsl:when> |
207 | 222 | </xsl:choose>
|
208 | 223 | </xsl:template>
|
209 | 224 |
|
|
276 | 291 | </xsl:if>
|
277 | 292 | <xsl:call-template name="method-signature">
|
278 | 293 | <xsl:with-param name="method-name" select="$entry-name"/>
|
| 294 | + <xsl:with-param name="dot" select="true()"/> |
279 | 295 | </xsl:call-template>
|
280 | 296 | </h4>
|
281 | 297 |
|
|
285 | 301 | </ul>
|
286 | 302 | </xsl:template>
|
287 | 303 |
|
| 304 | +<xsl:template name="entry-body-widget"> |
| 305 | + <xsl:variable name="entry-name" select="@name"/> |
| 306 | + |
| 307 | + <xsl:if test="options"> |
| 308 | + <section id="options"> |
| 309 | + <header> |
| 310 | + <h2 class="underline">Options</h2> |
| 311 | + </header> |
| 312 | + <xsl:for-each select="options/option"> |
| 313 | + <div id="option-{@name}"> |
| 314 | + <h3> |
| 315 | + <xsl:value-of select="@name"/> |
| 316 | + </h3> |
| 317 | + <div> |
| 318 | + <strong>Type: </strong><xsl:call-template name="render-types"/> |
| 319 | + </div> |
| 320 | + <div> |
| 321 | + <strong>Default: </strong><xsl:value-of select="@default"/> |
| 322 | + </div> |
| 323 | + <div> |
| 324 | + <xsl:apply-templates select="desc"> |
| 325 | + <xsl:with-param name="entry-name" select="$entry-name"/> |
| 326 | + </xsl:apply-templates> |
| 327 | + <xsl:call-template name="version-details"/> |
| 328 | + </div> |
| 329 | + <xsl:if test="type/desc"> |
| 330 | + <strong>Multiple types supported:</strong> |
| 331 | + <ul> |
| 332 | + <xsl:for-each select="type/desc"> |
| 333 | + <li> |
| 334 | + <strong><xsl:value-of select="../@name"/></strong> |
| 335 | + <xsl:text>: </xsl:text> |
| 336 | + <xsl:copy-of select="node()"/> |
| 337 | + </li> |
| 338 | + </xsl:for-each> |
| 339 | + </ul> |
| 340 | + </xsl:if> |
| 341 | + <xsl:apply-templates select="example"> |
| 342 | + <xsl:with-param name="number-examples" select="count(example)"/> |
| 343 | + </xsl:apply-templates> |
| 344 | + </div> |
| 345 | + </xsl:for-each> |
| 346 | + </section> |
| 347 | + </xsl:if> |
| 348 | + <xsl:if test="methods"> |
| 349 | + <section id="methods"> |
| 350 | + <header> |
| 351 | + <h2 class="underline">Methods</h2> |
| 352 | + </header> |
| 353 | + <xsl:for-each select="methods/method"> |
| 354 | + <xsl:variable name="method-name" select="@name"/> |
| 355 | + <div id="method-{$method-name}"> |
| 356 | + <xsl:for-each select="signature | self::node()[count(signature) = 0]"> |
| 357 | + <xsl:call-template name="widget-method-event"> |
| 358 | + <xsl:with-param name="entry-name" select="$entry-name"/> |
| 359 | + <xsl:with-param name="method-name" select="$method-name"/> |
| 360 | + </xsl:call-template> |
| 361 | + </xsl:for-each> |
| 362 | + </div> |
| 363 | + </xsl:for-each> |
| 364 | + </section> |
| 365 | + </xsl:if> |
| 366 | + <xsl:if test="events"> |
| 367 | + <section id="events"> |
| 368 | + <header> |
| 369 | + <h2 class="underline">Events</h2> |
| 370 | + </header> |
| 371 | + <xsl:for-each select="events/event"> |
| 372 | + <div id="event-{@name}"> |
| 373 | + <xsl:call-template name="widget-method-event"> |
| 374 | + <xsl:with-param name="entry-name" select="$entry-name"/> |
| 375 | + <xsl:with-param name="method-name" select="@name"/> |
| 376 | + </xsl:call-template> |
| 377 | + </div> |
| 378 | + </xsl:for-each> |
| 379 | + </section> |
| 380 | + </xsl:if> |
| 381 | +</xsl:template> |
| 382 | + |
288 | 383 | <!-- examples -->
|
289 | 384 | <xsl:template match="example">
|
290 | 385 | <xsl:param name="entry-index"/>
|
|
338 | 433 |
|
339 | 434 | <!--
|
340 | 435 | Render type(s) for an argument element.
|
341 |
| - Type can either by a @type attribute or one or more <type> child elements. |
| 436 | + Type can either be a @type attribute or one or more <type> child elements. |
342 | 437 | -->
|
343 | 438 | <xsl:template name="render-types">
|
344 | 439 | <xsl:if test="@type and type">
|
|
424 | 519 |
|
425 | 520 | <xsl:template name="method-signature">
|
426 | 521 | <xsl:param name="method-name"/>
|
| 522 | + <xsl:param name="dot" select="false()"/> |
427 | 523 |
|
428 |
| - <xsl:if test="not(contains($method-name, '.')) and $method-name != 'jQuery'">.</xsl:if> |
| 524 | + <xsl:if test="$dot and not(contains($method-name, '.')) and $method-name != 'jQuery'">.</xsl:if> |
429 | 525 | <xsl:value-of select="$method-name"/>(
|
430 | 526 | <xsl:if test="argument">
|
431 | 527 | <xsl:text> </xsl:text>
|
|
451 | 547 | <li>
|
452 | 548 | <div>
|
453 | 549 | <strong><xsl:value-of select="@name"/></strong>
|
454 |
| - <xsl:if test="@default">(default: <xsl:value-of select="@default"/>)</xsl:if> |
| 550 | + <xsl:if test="@default"> (default: <xsl:value-of select="@default"/>)</xsl:if> |
455 | 551 | </div>
|
456 | 552 | <div>Type: <xsl:call-template name="render-types"/></div>
|
457 | 553 | <div>
|
458 | 554 | <xsl:apply-templates select="desc"/>
|
459 |
| - <xsl:if test="@added"> |
460 |
| - <xsl:text> </xsl:text> |
| 555 | + <xsl:call-template name="version-details"/> |
| 556 | + </div> |
| 557 | + <xsl:if test="property"> |
| 558 | + <ul> |
| 559 | + <xsl:apply-templates select="property"/> |
| 560 | + </ul> |
| 561 | + </xsl:if> |
| 562 | + </li> |
| 563 | +</xsl:template> |
| 564 | + |
| 565 | +<xsl:template name="version-details"> |
| 566 | + <xsl:if test="@added"> |
| 567 | + <xsl:text> </xsl:text> |
| 568 | + <xsl:choose> |
| 569 | + <xsl:when test="$version-category-links"> |
461 | 570 | <strong>(added <a href="/category/version/{@added}/">
|
462 | 571 | <xsl:value-of select="@added"/>
|
463 | 572 | </a>)</strong>
|
464 |
| - </xsl:if> |
465 |
| - <xsl:if test="@deprecated"> |
466 |
| - <xsl:text> </xsl:text> |
| 573 | + </xsl:when> |
| 574 | + <xsl:otherwise> |
| 575 | + <strong>(added <xsl:value-of select="@added"/>)</strong> |
| 576 | + </xsl:otherwise> |
| 577 | + </xsl:choose> |
| 578 | + </xsl:if> |
| 579 | + <xsl:if test="@deprecated"> |
| 580 | + <xsl:text> </xsl:text> |
| 581 | + <xsl:choose> |
| 582 | + <xsl:when test="$version-category-links"> |
467 | 583 | <strong>(deprecated <a href="/category/version/{@deprecated}/">
|
468 | 584 | <xsl:value-of select="@deprecated"/>
|
469 | 585 | </a>)</strong>
|
470 |
| - </xsl:if> |
471 |
| - <xsl:if test="@removed"> |
472 |
| - <xsl:text> </xsl:text> |
| 586 | + </xsl:when> |
| 587 | + <xsl:otherwise> |
| 588 | + <strong>(deprecated <xsl:value-of select="@deprecated"/>)</strong> |
| 589 | + </xsl:otherwise> |
| 590 | + </xsl:choose> |
| 591 | + </xsl:if> |
| 592 | + <xsl:if test="@removed"> |
| 593 | + <xsl:text> </xsl:text> |
| 594 | + <xsl:choose> |
| 595 | + <xsl:when test="$version-category-links"> |
473 | 596 | <strong>(removed <a href="/category/version/{@removed}/">
|
474 | 597 | <xsl:value-of select="@removed"/>
|
475 | 598 | </a>)</strong>
|
476 |
| - </xsl:if> |
477 |
| - </div> |
478 |
| - <xsl:if test="property"> |
479 |
| - <ul> |
480 |
| - <xsl:apply-templates select="property"/> |
481 |
| - </ul> |
482 |
| - </xsl:if> |
483 |
| - </li> |
| 599 | + </xsl:when> |
| 600 | + <xsl:otherwise> |
| 601 | + <strong>(removed <xsl:value-of select="@removed"/>)</strong> |
| 602 | + </xsl:otherwise> |
| 603 | + </xsl:choose> |
| 604 | + </xsl:if> |
| 605 | +</xsl:template> |
| 606 | + |
| 607 | +<xsl:template name="widget-method-event"> |
| 608 | + <xsl:param name="entry-name"/> |
| 609 | + <xsl:param name="method-name"/> |
| 610 | + |
| 611 | + <h3> |
| 612 | + <xsl:call-template name="method-signature"> |
| 613 | + <xsl:with-param name="method-name" select="$method-name"/> |
| 614 | + </xsl:call-template> |
| 615 | + </h3> |
| 616 | + <div> |
| 617 | + <xsl:apply-templates select="desc"> |
| 618 | + <xsl:with-param name="entry-name" select="$entry-name"/> |
| 619 | + </xsl:apply-templates> |
| 620 | + <xsl:call-template name="version-details"/> |
| 621 | + </div> |
| 622 | + <xsl:call-template name="arguments"/> |
484 | 623 | </xsl:template>
|
485 | 624 |
|
486 | 625 | <xsl:template match="desc">
|
|
0 commit comments