Permalink
Browse files

Initial version of api.jquerymobile.com repo, based on api.jqueryui.com

  • Loading branch information...
1 parent fe534ca commit 782b848978a9929becc713212722a5edce021a33 @rdworth rdworth committed Jun 4, 2012
Showing with 723 additions and 1 deletion.
  1. +9 −0 .gitignore
  2. +24 −0 LICENSE-MIT.txt
  3. +17 −1 README.md
  4. +25 −0 cat2tax.xsl
  5. +6 −0 categories.xml
  6. +5 −0 config-sample.json
  7. +28 −0 entries/dialog.xml
  8. +234 −0 entries2html.xsl
  9. +162 −0 grunt.js
  10. +30 −0 package.json
  11. +183 −0 xml2json.xsl
View
@@ -0,0 +1,9 @@
+dist
+node_modules
+config.json
+.project
+*~
+*.diff
+*.patch
+.DS_Store
+.settings
View
@@ -0,0 +1,24 @@
+Copyright (c) 2012 jQuery Foundation, http://jquery.org/
+
+This software consists of voluntary contributions made by many
+individuals. For exact contribution history, see the revision history
+and logs, available at http://github.com/jquery/api.jquerymobile.com
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
View
@@ -1,2 +1,18 @@
api.jquerymobile.com
-====================
+====================
+
+## Building
+
+### Requirements
+* <a href="http://www.xmlsoft.org/">libxml2</a>
+* <a href="http://xmlsoft.org/XSLT/">libxslt</a>
+* <a href="http://pygments.org/">Pygments</a>
+
+The `xmllint` and `xsltproc` and `pygmentize` utilities need to be in your path. If you are on Windows, you can get libxml2 and libxslt from <a href="http://sourceforge.net/projects/gnuwin32/files/">GnuWin32</a>.
+
+### Build
+
+1. `npm install`
+2. `cp config-sample.json config.json`
+3. Edit config.json per https://github.com/scottgonzalez/grunt-wordpress#config
+4. `grunt`
View
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:template match="category">
+ <item>
+ <name><xsl:value-of select="@name"/></name>
+ <slug><xsl:value-of select="@slug"/></slug>
+ <xsl:if test="desc/child::node()">
+ <description><xsl:value-of select="desc"/></description>
+ </xsl:if>
+ <xsl:if test="category">
+ <children>
+ <xsl:apply-templates select="category"/>
+ </children>
+ </xsl:if>
+ </item>
+ </xsl:template>
+
+ <xsl:template match="categories">
+ <category>
+ <xsl:apply-templates select="node()"/>
+ </category>
+ </xsl:template>
+
+</xsl:stylesheet>
View
@@ -0,0 +1,6 @@
+<categories>
+ <category name="Uncategorized" slug="Uncategorized"/>
+ <category name="Widgets" slug="widgets">
+ <desc></desc>
+ </category>
+</categories>
View
@@ -0,0 +1,5 @@
+{
+ "url": "dev.api.jquerymobile.com",
+ "username": "admin",
+ "password": "secret"
+}
View
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<?xml-stylesheet type="text/xsl" href="../entries2html.xsl" ?>
+<entry name="dialog" namespace="fn" type="Widget" widgetnamespace="mobile">
+ <desc></desc>
+ <longdesc>
+ <p>
+
+ </p>
+ </longdesc>
+ <created></created>
+ <options>
+
+ </options>
+ <events>
+
+ </events>
+ <methods>
+
+ </methods>
+ <example>
+ <desc></desc>
+ <code><![CDATA[]]></code>
+ <html><![CDATA[
+
+]]></html>
+ </example
+ <category slug="widgets"/>
+</entry>
View
@@ -0,0 +1,234 @@
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+<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>
+ <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>
+ <ul>
+ <xsl:for-each select="options/option">
+ <li id="option-{@name}">
+ <h3>
+ <xsl:value-of select="@name"/>
+ </h3>
+ <p>
+ <strong>Type: </strong>
+ <xsl:value-of select="@type"/>
+ <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-mobile.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-mobile.js"&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+<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>
+</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"/>
+ <xsl:if test="desc">
+ <xsl:text>, </xsl:text>
+ <xsl:value-of select="desc"/>
+ </xsl:if>
+ </li>
+</xsl:template>
+
+</xsl:stylesheet>
Oops, something went wrong.

0 comments on commit 782b848

Please sign in to comment.