|
40 | 40 | <xsl:variable name="entry-pos" select="concat($entry-name-trans,$entry-index)"/>
|
41 | 41 | <xsl:variable name="number-examples" select="count(example)"/>
|
42 | 42 |
|
43 |
| - <xsl:if test="./added"> |
44 |
| - <span class="versionAdded">version added: <xsl:value-of select="added"/></span> |
| 43 | + <xsl:if test="$entry-type='widget'"> |
| 44 | + <xsl:call-template name="widget-quick-nav"/> |
45 | 45 | </xsl:if>
|
46 | 46 |
|
47 | 47 | <article>
|
|
186 | 186 | <span><xsl:value-of select="title"/></span>
|
187 | 187 | </xsl:otherwise>
|
188 | 188 | </xsl:choose>
|
| 189 | + <xsl:if test="./added"> |
| 190 | + <span class="versionAdded">version added: <xsl:value-of select="added"/></span> |
| 191 | + </xsl:if> |
189 | 192 | </h2>
|
190 | 193 | </xsl:template>
|
191 | 194 |
|
|
204 | 207 | <xsl:when test="@type='widget'">
|
205 | 208 | <xsl:call-template name="entry-body-widget"/>
|
206 | 209 | </xsl:when>
|
| 210 | + <xsl:when test="@type='effect'"> |
| 211 | + <xsl:call-template name="entry-body-effect"/> |
| 212 | + </xsl:when> |
207 | 213 | </xsl:choose>
|
208 | 214 | </xsl:template>
|
209 | 215 |
|
|
246 | 252 | </xsl:if>
|
247 | 253 | <xsl:value-of select="@name"/>
|
248 | 254 | </h4>
|
| 255 | + |
| 256 | + <xsl:if test="properties"> |
| 257 | + <ul><xsl:for-each select="properties/property"> |
| 258 | + <xsl:apply-templates select="."/> |
| 259 | + </xsl:for-each></ul> |
| 260 | + </xsl:if> |
249 | 261 | </li>
|
250 | 262 | </ul>
|
251 | 263 | </xsl:template>
|
|
297 | 309 | <xsl:for-each select="options/option">
|
298 | 310 | <xsl:sort select="@name"/>
|
299 | 311 | <div id="option-{@name}">
|
| 312 | + <xsl:attribute name="class"> |
| 313 | + <xsl:text>api-item</xsl:text> |
| 314 | + <xsl:if test="position() = 1"> |
| 315 | + <xsl:text> first-item</xsl:text> |
| 316 | + </xsl:if> |
| 317 | + </xsl:attribute> |
| 318 | + |
300 | 319 | <h3>
|
301 | 320 | <xsl:value-of select="@name"/>
|
| 321 | + <span class="option-type"> |
| 322 | + <strong>Type: </strong> |
| 323 | + <xsl:call-template name="render-types"/> |
| 324 | + </span> |
302 | 325 | </h3>
|
303 |
| - <div> |
304 |
| - <strong>Type: </strong> |
305 |
| - <xsl:call-template name="render-types"/> |
306 |
| - </div> |
307 |
| - <div> |
| 326 | + <div class="default"> |
308 | 327 | <strong>Default: </strong>
|
309 | 328 | <code><xsl:value-of select="@default"/></code>
|
310 | 329 | </div>
|
|
341 | 360 | <xsl:for-each select="methods/method">
|
342 | 361 | <xsl:sort select="@name"/>
|
343 | 362 | <xsl:variable name="method-name" select="@name"/>
|
| 363 | + <xsl:variable name="method-position" select="position()"/> |
344 | 364 | <div id="method-{$method-name}">
|
| 365 | + |
345 | 366 | <xsl:for-each select="signature | self::node()[count(signature) = 0]">
|
346 |
| - <xsl:call-template name="widget-method-event"> |
347 |
| - <xsl:with-param name="entry-name" select="$entry-name"/> |
348 |
| - <xsl:with-param name="method-name" select="$method-name"/> |
349 |
| - </xsl:call-template> |
| 367 | + <div> |
| 368 | + <xsl:attribute name="class"> |
| 369 | + <xsl:text>api-item</xsl:text> |
| 370 | + <xsl:if test="$method-position = 1 and position() = 1"> |
| 371 | + <xsl:text> first-item</xsl:text> |
| 372 | + </xsl:if> |
| 373 | + </xsl:attribute> |
| 374 | + |
| 375 | + <xsl:call-template name="widget-method-event"> |
| 376 | + <xsl:with-param name="entry-name" select="$entry-name"/> |
| 377 | + <xsl:with-param name="method-name" select="$method-name"/> |
| 378 | + </xsl:call-template> |
| 379 | + </div> |
350 | 380 | </xsl:for-each>
|
351 | 381 | </div>
|
352 | 382 | </xsl:for-each>
|
|
360 | 390 | <xsl:for-each select="events/event">
|
361 | 391 | <xsl:sort select="@name"/>
|
362 | 392 | <div id="event-{@name}">
|
| 393 | + <xsl:attribute name="class"> |
| 394 | + <xsl:text>api-item</xsl:text> |
| 395 | + <xsl:if test="position() = 1"> |
| 396 | + <xsl:text> first-item</xsl:text> |
| 397 | + </xsl:if> |
| 398 | + </xsl:attribute> |
| 399 | + |
363 | 400 | <xsl:call-template name="widget-method-event">
|
364 | 401 | <xsl:with-param name="entry-name" select="$entry-name"/>
|
365 | 402 | <xsl:with-param name="method-name" select="@name"/>
|
|
370 | 407 | </xsl:if>
|
371 | 408 | </xsl:template>
|
372 | 409 |
|
| 410 | +<xsl:template name="entry-body-effect"> |
| 411 | + <ul class="signatures"> |
| 412 | + <li class="signature"> |
| 413 | + <h4 class="name"> |
| 414 | + <xsl:if test="signature/added"> |
| 415 | + <span class="versionAdded"> |
| 416 | + version added: |
| 417 | + <a href="/category/version/{signature/added}/"> |
| 418 | + <xsl:value-of select="added"/> |
| 419 | + </a> |
| 420 | + </span> |
| 421 | + </xsl:if> |
| 422 | + <xsl:value-of select="@name"/> |
| 423 | + </h4> |
| 424 | + |
| 425 | + <xsl:if test="arguments"> |
| 426 | + <ul><xsl:for-each select="arguments/argument"> |
| 427 | + <xsl:apply-templates select="."/> |
| 428 | + </xsl:for-each></ul> |
| 429 | + </xsl:if> |
| 430 | + </li> |
| 431 | + </ul> |
| 432 | +</xsl:template> |
| 433 | + |
| 434 | +<xsl:template name="widget-quick-nav"> |
| 435 | + <section class="quick-nav"> |
| 436 | + <header> |
| 437 | + <h2>QuickNav</h2> |
| 438 | + </header> |
| 439 | + |
| 440 | + <div class="quick-nav-section"> |
| 441 | + <h3>Options</h3> |
| 442 | + <xsl:for-each select="options/option"> |
| 443 | + <xsl:variable name="name" select="@name"/> |
| 444 | + <div><a href="#option-{$name}"><xsl:value-of select="$name"/></a></div> |
| 445 | + </xsl:for-each> |
| 446 | + </div> |
| 447 | + |
| 448 | + <div class="quick-nav-section"> |
| 449 | + <h3>Methods</h3> |
| 450 | + <xsl:for-each select="methods/method"> |
| 451 | + <xsl:variable name="name" select="@name"/> |
| 452 | + <div><a href="#method-{$name}"><xsl:value-of select="$name"/></a></div> |
| 453 | + </xsl:for-each> |
| 454 | + </div> |
| 455 | + |
| 456 | + <div class="quick-nav-section"> |
| 457 | + <h3>Events</h3> |
| 458 | + <xsl:for-each select="events/event"> |
| 459 | + <xsl:variable name="name" select="@name"/> |
| 460 | + <div><a href="#event-{$name}"><xsl:value-of select="$name"/></a></div> |
| 461 | + </xsl:for-each> |
| 462 | + </div> |
| 463 | + </section> |
| 464 | +</xsl:template> |
| 465 | + |
373 | 466 | <!-- examples -->
|
374 | 467 | <xsl:template match="example">
|
375 | 468 | <xsl:param name="entry-index"/>
|
|
387 | 480 |
|
388 | 481 | <h4>
|
389 | 482 | <xsl:if test="$number-examples > 1">Example: </xsl:if>
|
390 |
| - <span class="desc"><xsl:value-of select="desc"/></span> |
| 483 | + <span class="desc"><xsl:apply-templates select="desc"/></span> |
391 | 484 | </h4>
|
392 | 485 | <pre><code data-linenum="true">
|
393 | 486 | <xsl:choose>
|
|
440 | 533 | <!-- elements. Render each type, comma seperated -->
|
441 | 534 | <xsl:if test="type">
|
442 | 535 | <xsl:for-each select="type">
|
443 |
| - <xsl:if test="position() > 1">, </xsl:if> |
| 536 | + <xsl:if test="position() > 1"> |
| 537 | + <xsl:text> or </xsl:text> |
| 538 | + </xsl:if> |
444 | 539 | <xsl:call-template name="render-type">
|
445 | 540 | <xsl:with-param name="typename" select="@name" />
|
446 | 541 | </xsl:call-template>
|
|
460 | 555 | -->
|
461 | 556 | <xsl:when test="$typename = 'Function'">
|
462 | 557 | <a href="http://api.jquery.com/Types/#Function">Function</a>
|
463 |
| - <xsl:text>(</xsl:text> |
464 |
| - <xsl:if test="argument"> |
465 |
| - <xsl:text> </xsl:text> |
466 |
| - <xsl:for-each select="argument"> |
467 |
| - <xsl:if test="position() > 1">, </xsl:if> |
468 |
| - <xsl:value-of select="@name"/> |
469 |
| - <xsl:text>: </xsl:text> |
470 |
| - <xsl:call-template name="render-types"/> |
471 |
| - </xsl:for-each> |
472 |
| - <xsl:text> </xsl:text> |
473 |
| - </xsl:if> |
474 |
| - <xsl:text>)</xsl:text> |
| 558 | + <xsl:call-template name="render-type-function"/> |
475 | 559 |
|
476 | 560 | <!-- display return type if present -->
|
477 | 561 | <xsl:if test="return or @return">
|
|
486 | 570 | </xsl:choose>
|
487 | 571 | </xsl:template>
|
488 | 572 |
|
| 573 | +<xsl:template name="render-type-function"> |
| 574 | + <xsl:text>(</xsl:text> |
| 575 | + <xsl:if test="argument"> |
| 576 | + <xsl:text> </xsl:text> |
| 577 | + <xsl:for-each select="argument"> |
| 578 | + <xsl:if test="position() > 1">, </xsl:if> |
| 579 | + <a href="http://api.jquery.com/Types#{@type}"> |
| 580 | + <xsl:value-of select="@type"/> |
| 581 | + </a> |
| 582 | + <xsl:text> </xsl:text> |
| 583 | + <xsl:value-of select="@name"/> |
| 584 | + <xsl:if test="@type = 'Function'"> |
| 585 | + <xsl:call-template name="render-type-function"/> |
| 586 | + </xsl:if> |
| 587 | + </xsl:for-each> |
| 588 | + <xsl:text> </xsl:text> |
| 589 | + </xsl:if> |
| 590 | + <xsl:text>)</xsl:text> |
| 591 | +</xsl:template> |
| 592 | + |
489 | 593 | <xsl:template name="render-return-types">
|
490 | 594 | <xsl:if test="@return and return">
|
491 | 595 | <strong>ERROR: Use <i>either</i> @return or return element</strong>
|
|
494 | 598 | <!-- return attribute -->
|
495 | 599 | <xsl:if test="@return">
|
496 | 600 | <xsl:call-template name="render-type">
|
497 |
| - <xsl:with-param name="typename" select="@return" /> |
| 601 | + <xsl:with-param name="typename" select="@return"/> |
498 | 602 | </xsl:call-template>
|
499 | 603 | </xsl:if>
|
500 | 604 |
|
|
504 | 608 | <xsl:if test="position() > 1">
|
505 | 609 | <strong>ERROR: A single return element is expected</strong>
|
506 | 610 | </xsl:if>
|
507 |
| - <xsl:call-template name="render-types" /> |
| 611 | + <xsl:call-template name="render-types"/> |
508 | 612 | </xsl:for-each>
|
509 | 613 | </xsl:if>
|
510 | 614 | </xsl:template>
|
|
0 commit comments