Skip to content
Browse files

Fixed entries2html based on the one in api.jquery.com to put the scri…

…pt tag at the top for grunt-wordpress. Added categories to entry XMLs
  • Loading branch information...
1 parent a6cbe75 commit 80ecaf469a6b343e515a891f3c9d391e0f099cf6 @rdworth rdworth committed
View
1 entries/accordion.xml
@@ -210,4 +210,5 @@
]]></html>
</example>
+ <category slug="widgets"/>
</entry>
View
1 entries/autocomplete.xml
@@ -146,4 +146,5 @@
]]></html>
</example>
+ <category slug="widgets"/>
</entry>
View
1 entries/blind-effect.xml
@@ -43,4 +43,5 @@
<desc>A callback function, executed when the effect completes</desc>
</option>
</options>
+ <category slug="effects"/>
</entry>
View
1 entries/bounce-effect.xml
@@ -49,4 +49,5 @@
<desc>A callback function, executed when the effect completes</desc>
</option>
</options>
+ <category slug="effects"/>
</entry>
View
1 entries/button.xml
@@ -56,4 +56,5 @@
]]></html>
</example>
+ <category slug="widgets"/>
</entry>
View
1 entries/clip-effect.xml
@@ -41,4 +41,5 @@
<desc>A callback function, executed when the effect completes</desc>
</option>
</options>
+ <category slug="effects"/>
</entry>
View
1 entries/datepicker.xml
@@ -293,4 +293,5 @@ The localization files are also available in the UI svn: http://jquery-ui.google
]]></html>
</example>
+ <category slug="widgets"/>
</entry>
View
1 entries/dialog.xml
@@ -215,4 +215,5 @@
]]></html>
</example>
+ <category slug="widgets"/>
</entry>
View
1 entries/draggable.xml
@@ -150,4 +150,5 @@ Note: Specifying this option as an array of selectors has been removed.</desc>
]]></html>
</example>
+ <category slug="interactions"/>
</entry>
View
1 entries/drop-effect.xml
@@ -41,4 +41,5 @@
<desc>A callback function, executed when the effect completes</desc>
</option>
</options>
+ <category slug="effects"/>
</entry>
View
1 entries/droppable.xml
@@ -115,4 +115,5 @@ ui.draggable represents the draggable.</desc>
]]></html>
</example>
+ <category slug="interactions"/>
</entry>
View
1 entries/explode-effect.xml
@@ -32,4 +32,5 @@
<desc>The number of pieces to explode, should be a perfect square, any other values are rounded to the nearest square.</desc>
</option>
</options>
+ <category slug="effects"/>
</entry>
View
1 entries/fade-effect.xml
@@ -29,4 +29,5 @@
<desc>A callback function, executed when the effect completes</desc>
</option>
</options>
+ <category slug="effects"/>
</entry>
View
1 entries/fold-effect.xml
@@ -35,4 +35,5 @@
<desc>If the horizontal direction happens first when hiding. Remember, showing inverts hiding.</desc>
</option>
</options>
+ <category slug="effects"/>
</entry>
View
1 entries/highlight-effect.xml
@@ -32,4 +32,5 @@
<desc>The background color used during the animation</desc>
</option>
</options>
+ <category slug="effects"/>
</entry>
View
1 entries/progressbar.xml
@@ -61,4 +61,5 @@ This is a determinate progress bar, meaning that it should only be used in situa
]]></html>
</example>
+ <category slug="widgets"/>
</entry>
View
1 entries/pulsate-effect.xml
@@ -34,4 +34,5 @@
<desc>The number of times the element should pulse. An extra half pulse is added for hide/show</desc>
</option>
</options>
+ <category slug="effects"/>
</entry>
View
1 entries/resizable.xml
@@ -121,4 +121,5 @@ If specified as an object, the following keys are supported: { n, e, s, w, ne, s
]]></html>
</example>
+ <category slug="interactions"/>
</entry>
View
1 entries/selectable.xml
@@ -122,4 +122,5 @@
]]></html>
</example>
+ <category slug="interactions"/>
</entry>
View
1 entries/slider.xml
@@ -116,4 +116,5 @@ Return false in order to prevent a slide, based on ui.value.</desc>
]]></html>
</example>
+ <category slug="widgets"/>
</entry>
View
1 entries/sortable.xml
@@ -277,4 +277,5 @@ will cancel the change. Useful in the 'receive' callback.</desc>
]]></html>
</example>
+ <category slug="interactions"/>
</entry>
View
1 entries/tabs.xml
@@ -365,4 +365,5 @@ resizeMap() will call Google Maps' checkResize() on the particular map.
]]></html>
</example>
+ <category slug="widgets"/>
</entry>
View
395 entries2html.xsl
@@ -1,222 +1,233 @@
-<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
- <xsl:template match="/">
- <html>
- <xsl:for-each select="//entry">
- <xsl:variable name="number-examples" select="count(example)"/>
- <article>
- <xsl:copy-of select="desc/node()"/>
- <nav>
- <ul>
- <li>
- <a href="#overview">Overview</a>
- </li>
- <li>
- <a href="#options">Options</a>
- <ul>
- <xsl:for-each select="options/option">
- <li>
- <a href="#option-{@name}">
- <xsl:value-of select="@name"/>
- </a>
- </li>
- </xsl:for-each>
- </ul>
- </li>
- <li>
- <a href="#methods">Methods</a>
- <ul>
- <xsl:for-each select="methods/method">
- <li>
- <a href="#method-{@name}">
- <xsl:value-of select="@name"/>
- </a>
- </li>
- </xsl:for-each>
- </ul>
- </li>
- <li>
- <a href="#events">Events</a>
- <ul>
- <xsl:for-each select="events/event">
- <li>
- <a href="#event-{@name}">
- <xsl:value-of select="@name"/>
- </a>
- </li>
- </xsl:for-each>
- </ul>
- </li>
- <li>
- <a href="#theming">Theming</a>
- </li>
- <li>
- <a href="#examples">Examples</a>
- </li>
- </ul>
- </nav>
- <section id="overview">
- <header>
- <h2 class="underline">Overview</h2>
- </header>
- <p>
- <xsl:copy-of select="longdesc/node()"/>
- </p>
- </section>
- <section id="options">
- <header>
- <h2 class="underline">Options</h2>
- </header>
+
+<xsl:output method="html" omit-xml-declaration="yes"/>
+
+<xsl:template match="/">
+<script>
+ {
+ "title": "<xsl:value-of select="//entry/@name" />",
+ "termSlugs": {
+ "category": [
+ <xsl:for-each select="//entry/category"><xsl:if test="position() &gt; 1"><xsl:text>,</xsl:text></xsl:if>"<xsl:value-of select="@slug"/>"</xsl:for-each>
+ ]
+ }
+ }
+</script>
+ <xsl:for-each select="//entry">
+ <xsl:variable name="number-examples" select="count(example)"/>
+ <article>
+ <xsl:copy-of select="desc/node()"/>
+ <nav>
+ <ul>
+ <li>
+ <a href="#overview">Overview</a>
+ </li>
+ <li>
+ <a href="#options">Options</a>
<ul>
<xsl:for-each select="options/option">
- <li id="option-{@name}">
- <h3>
+ <li>
+ <a href="#option-{@name}">
<xsl:value-of select="@name"/>
- </h3>
- <p>
- <strong>Type:</strong>
- <xsl:for-each select="type">
- <xsl:if test="position() &gt; 1">, </xsl:if>
- <xsl:value-of select="@name"/>
- </xsl:for-each>
- </p>
- <p>
- <strong>Default:</strong>
- <xsl:value-of select="@default"/>
- </p>
- <p>
- <xsl:copy-of select="desc/node()"/>
- </p>
+ </a>
</li>
</xsl:for-each>
</ul>
- </section>
- <section id="methods">
- <header>
- <h2 class="underline">Methods</h2>
- </header>
+ </li>
+ <li>
+ <a href="#methods">Methods</a>
<ul>
<xsl:for-each select="methods/method">
- <li id="method-{@name}">
- <h3><xsl:value-of select="@name"/>(
- <xsl:for-each select="argument"><xsl:if test="position() &gt; 1">, </xsl:if><xsl:if test="@optional">[</xsl:if><xsl:value-of select="@name"/><xsl:if test="@optional">]</xsl:if></xsl:for-each>
- )</h3>
- <p>
- <xsl:copy-of select="desc/node()"/>
- </p>
- <xsl:call-template name="arguments"/>
+ <li>
+ <a href="#method-{@name}">
+ <xsl:value-of select="@name"/>
+ </a>
</li>
</xsl:for-each>
</ul>
- </section>
- <section id="events">
- <header>
- <h2 class="underline">Events</h2>
- </header>
+ </li>
+ <li>
+ <a href="#events">Events</a>
<ul>
<xsl:for-each select="events/event">
- <li id="event-{@name}">
- <h3><xsl:value-of select="@name"/>(
- <xsl:for-each select="argument"><xsl:if test="position() &gt; 1">, </xsl:if><xsl:value-of select="@name"/></xsl:for-each>
- )</h3>
- <p>
- <xsl:copy-of select="desc/node()"/>
- </p>
- <xsl:call-template name="arguments"/>
+ <li>
+ <a href="#event-{@name}">
+ <xsl:value-of select="@name"/>
+ </a>
</li>
</xsl:for-each>
</ul>
- </section>
- <section id="theming">
- <header>
- <h2 class="underline">Theming</h2>
- </header>
- <xsl-copy-of select="theming/node()"/>
- </section>
- <section id="examples">
- <header>
- <h2 class="underline">Example<xsl:if test="$number-examples &gt; 1">s</xsl:if></h2>
- </header>
- <xsl:for-each select="example">
- <h4>
- <xsl:if test="$number-examples &gt; 1">Example: </xsl:if>
- <span class="desc">
- <xsl:value-of select="desc"/>
- </span>
- </h4>
- <pre>
- <code><xsl:choose><xsl:when test="html"><xsl:attribute name="class">example demo-code</xsl:attribute></xsl:when><xsl:otherwise><xsl:attribute name="class">example</xsl:attribute></xsl:otherwise></xsl:choose>&lt;!doctype html&gt;
+ </li>
+ <li>
+ <a href="#theming">Theming</a>
+ </li>
+ <li>
+ <a href="#examples">Examples</a>
+ </li>
+ </ul>
+ </nav>
+ <section id="overview">
+ <header>
+ <h2 class="underline">Overview</h2>
+ </header>
+ <p>
+ <xsl:copy-of select="longdesc/node()"/>
+ </p>
+ </section>
+ <section id="options">
+ <header>
+ <h2 class="underline">Options</h2>
+ </header>
+ <ul>
+ <xsl:for-each select="options/option">
+ <li id="option-{@name}">
+ <h3>
+ <xsl:value-of select="@name"/>
+ </h3>
+ <p>
+ <strong>Type:</strong>
+ <xsl:for-each select="type">
+ <xsl:if test="position() &gt; 1">, </xsl:if>
+ <xsl:value-of select="@name"/>
+ </xsl:for-each>
+ </p>
+ <p>
+ <strong>Default:</strong>
+ <xsl:value-of select="@default"/>
+ </p>
+ <p>
+ <xsl:copy-of select="desc/node()"/>
+ </p>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </section>
+ <section id="methods">
+ <header>
+ <h2 class="underline">Methods</h2>
+ </header>
+ <ul>
+ <xsl:for-each select="methods/method">
+ <li id="method-{@name}">
+ <h3><xsl:value-of select="@name"/>(
+ <xsl:for-each select="argument"><xsl:if test="position() &gt; 1">, </xsl:if><xsl:if test="@optional">[</xsl:if><xsl:value-of select="@name"/><xsl:if test="@optional">]</xsl:if></xsl:for-each>
+ )</h3>
+ <p>
+ <xsl:copy-of select="desc/node()"/>
+ </p>
+ <xsl:call-template name="arguments"/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </section>
+ <section id="events">
+ <header>
+ <h2 class="underline">Events</h2>
+ </header>
+ <ul>
+ <xsl:for-each select="events/event">
+ <li id="event-{@name}">
+ <h3><xsl:value-of select="@name"/>(
+ <xsl:for-each select="argument"><xsl:if test="position() &gt; 1">, </xsl:if><xsl:value-of select="@name"/></xsl:for-each>
+ )</h3>
+ <p>
+ <xsl:copy-of select="desc/node()"/>
+ </p>
+ <xsl:call-template name="arguments"/>
+ </li>
+ </xsl:for-each>
+ </ul>
+ </section>
+ <section id="theming">
+ <header>
+ <h2 class="underline">Theming</h2>
+ </header>
+ <xsl-copy-of select="theming/node()"/>
+ </section>
+ <section id="examples">
+ <header>
+ <h2 class="underline">Example<xsl:if test="$number-examples &gt; 1">s</xsl:if></h2>
+ </header>
+ <xsl:for-each select="example">
+ <h4>
+ <xsl:if test="$number-examples &gt; 1">Example: </xsl:if>
+ <span class="desc">
+ <xsl:value-of select="desc"/>
+ </span>
+ </h4>
+ <pre>
+ <code><xsl:choose><xsl:when test="html"><xsl:attribute name="class">example demo-code</xsl:attribute></xsl:when><xsl:otherwise><xsl:attribute name="class">example</xsl:attribute></xsl:otherwise></xsl:choose>&lt;!doctype html&gt;
&lt;html&gt;
&lt;head&gt;
- &lt;meta charset="utf-8"&gt;
- &lt;title&gt;<xsl:value-of select="desc"/>&lt;/title&gt;
- &lt;link rel="stylesheet" href="jquery-ui.css"&gt;<xsl:if test="css">
- &lt;style&gt;<xsl:copy-of select="css/text()"/> &lt;/style&gt;</xsl:if>
- &lt;script src="jquery.js"&gt;&lt;/script&gt;
- &lt;script src="jquery-ui.js"&gt;&lt;/script&gt;
+&lt;meta charset="utf-8"&gt;
+&lt;title&gt;<xsl:value-of select="desc"/>&lt;/title&gt;
+&lt;link rel="stylesheet" href="jquery-ui.css"&gt;<xsl:if test="css">
+&lt;style&gt;<xsl:copy-of select="css/text()"/> &lt;/style&gt;</xsl:if>
+&lt;script src="jquery.js"&gt;&lt;/script&gt;
+&lt;script src="jquery-ui.js"&gt;&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
- <xsl:copy-of select="html/text()"/>
+<xsl:copy-of select="html/text()"/>
&lt;script&gt;<xsl:copy-of select="code/text()"/>&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code>
- </pre>
- <xsl:if test="html">
- <h4>Demo:</h4>
- <div>
- <xsl:choose>
- <xsl:when test="html">
- <xsl:attribute name="class">demo code-demo</xsl:attribute>
- </xsl:when>
- <xsl:otherwise>
- <xsl:attribute name="class">demo</xsl:attribute>
- </xsl:otherwise>
- </xsl:choose>
- </div>
- </xsl:if>
- </xsl:for-each>
- </section>
- </article>
- </xsl:for-each>
- </html>
- </xsl:template>
- <!-- arguments -->
- <xsl:template name="arguments">
- <xsl:if test="argument">
- <xsl:text> </xsl:text>
- <ul>
- <xsl:apply-templates select="argument"/>
- </ul>
- </xsl:if>
- </xsl:template>
- <!-- TODO consider optional arguments -->
- <xsl:template match="argument">
- <li>
- <xsl:value-of select="@name"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="@type"/>
- <xsl:if test="not(@null)">
- <xsl:if test="desc">
- <xsl:text>, </xsl:text>
- <xsl:value-of select="desc"/>
- </xsl:if>
- <ul>
- <xsl:apply-templates select="property"/>
- </ul>
- </xsl:if>
- </li>
- </xsl:template>
- <!-- argument properties -->
- <xsl:template match="argument/property">
- <li>
- <xsl:value-of select="@name"/>
- <xsl:text>: </xsl:text>
- <xsl:value-of select="@type"/>
+ </pre>
+ <xsl:if test="html">
+ <h4>Demo:</h4>
+ <div>
+ <xsl:choose>
+ <xsl:when test="html">
+ <xsl:attribute name="class">demo code-demo</xsl:attribute>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:attribute name="class">demo</xsl:attribute>
+ </xsl:otherwise>
+ </xsl:choose>
+ </div>
+ </xsl:if>
+ </xsl:for-each>
+ </section>
+ </article>
+ </xsl:for-each>
+</xsl:template>
+<!-- arguments -->
+<xsl:template name="arguments">
+ <xsl:if test="argument">
+ <xsl:text> </xsl:text>
+ <ul>
+ <xsl:apply-templates select="argument"/>
+ </ul>
+ </xsl:if>
+</xsl:template>
+<!-- TODO consider optional arguments -->
+<xsl:template match="argument">
+ <li>
+ <xsl:value-of select="@name"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="@type"/>
+ <xsl:if test="not(@null)">
<xsl:if test="desc">
<xsl:text>, </xsl:text>
<xsl:value-of select="desc"/>
</xsl:if>
- </li>
- </xsl:template>
+ <ul>
+ <xsl:apply-templates select="property"/>
+ </ul>
+ </xsl:if>
+ </li>
+</xsl:template>
+<!-- argument properties -->
+<xsl:template match="argument/property">
+ <li>
+ <xsl:value-of select="@name"/>
+ <xsl:text>: </xsl:text>
+ <xsl:value-of select="@type"/>
+ <xsl:if test="desc">
+ <xsl:text>, </xsl:text>
+ <xsl:value-of select="desc"/>
+ </xsl:if>
+ </li>
+</xsl:template>
+
</xsl:stylesheet>

0 comments on commit 80ecaf4

Please sign in to comment.
Something went wrong with that request. Please try again.