|
5 | 5 | <xsl:variable name="version-category-links" select="false()"/>
|
6 | 6 | <!-- Set this to false to prevent prefixing method names with a dot -->
|
7 | 7 | <xsl:variable name="method-prefix-dot" select="true()"/>
|
| 8 | +<!-- Set this to false to prevent widget method examples from being generated --> |
| 9 | +<xsl:variable name="widget-method-examples" select="true()"/> |
8 | 10 |
|
9 | 11 | <xsl:template match="/">
|
10 | 12 | <script>{
|
|
372 | 374 | <xsl:variable name="method-name" select="@name"/>
|
373 | 375 | <xsl:variable name="method-position" select="position()"/>
|
374 | 376 | <div id="method-{$method-name}">
|
375 |
| - |
376 | 377 | <xsl:for-each select="signature | self::node()[count(signature) = 0]">
|
377 | 378 | <div>
|
378 | 379 | <xsl:attribute name="class">
|
|
387 | 388 | <xsl:with-param name="method-name" select="$method-name"/>
|
388 | 389 | </xsl:call-template>
|
389 | 390 | </div>
|
| 391 | + |
| 392 | + <xsl:if test="$widget-method-examples"> |
| 393 | + <div> |
| 394 | + <strong>Code examples:</strong> |
| 395 | + |
| 396 | + <p>Invoke the <xsl:value-of select="@name"/> method:</p> |
| 397 | + <pre><code> |
| 398 | + <xsl:if test="@example-return-var"> |
| 399 | + <xsl:text>var </xsl:text> |
| 400 | + <xsl:value-of select="@example-return-var"/> |
| 401 | + <xsl:text> = </xsl:text> |
| 402 | + </xsl:if> |
| 403 | + <xsl:text>$( ".selector" ).</xsl:text> |
| 404 | + <xsl:value-of select="$entry-name"/> |
| 405 | + <xsl:text>( "</xsl:text> |
| 406 | + <xsl:value-of select="$method-name"/> |
| 407 | + <xsl:text>"</xsl:text> |
| 408 | + <xsl:if test="@example-params"> |
| 409 | + <xsl:text>, </xsl:text> |
| 410 | + <xsl:value-of select="@example-params"/> |
| 411 | + </xsl:if> |
| 412 | + <xsl:text> );</xsl:text> |
| 413 | + </code></pre> |
| 414 | + </div> |
| 415 | + </xsl:if> |
390 | 416 | </xsl:for-each>
|
391 | 417 | </div>
|
392 | 418 | </xsl:for-each>
|
|
0 commit comments