aboutsummaryrefslogtreecommitdiffstats
path: root/build
diff options
context:
space:
mode:
authorJörn Zaefferer <joern.zaefferer@gmail.com>2009-01-14 22:43:55 +0000
committerJörn Zaefferer <joern.zaefferer@gmail.com>2009-01-14 22:43:55 +0000
commitf649acd8abcd3ccd86de331737f42d0d85efbc0c (patch)
tree00bb11c44b19187d219123ce5b14910c0d2f5512 /build
parent82958c79ff7604b1854a58cf161e8d6691bed6ac (diff)
downloadjquery-f649acd8abcd3ccd86de331737f42d0d85efbc0c.tar.gz
jquery-f649acd8abcd3ccd86de331737f42d0d85efbc0c.zip
core: Ant target to generate openAjaxMetadata; uses http://www.exfer.net/jquery/createjQueryXMLDocs.py to get the data from the wiki, and transforms it using xslt (see build/style.xsl)
Diffstat (limited to 'build')
-rw-r--r--build/style.xsl99
1 files changed, 99 insertions, 0 deletions
diff --git a/build/style.xsl b/build/style.xsl
new file mode 100644
index 000000000..14e61321e
--- /dev/null
+++ b/build/style.xsl
@@ -0,0 +1,99 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+ <xsl:output method="xml" indent="yes" />
+
+ <!-- TODO convert @type array notation to bracket notation, eg. Array<DOMElement> to [DOMElement] -->
+ <xsl:template match="/*">
+ <api xmlns="http://openajax.org/metadata">
+ <class name="jQuery">
+ <constructors>
+ <xsl:for-each select="//function[@name='jQuery']">
+ <constructor>
+ <shortDescription><xsl:value-of select="desc" /></shortDescription>
+ <description><xsl:value-of select="longdesc" /></description>
+ <xsl:call-template name="parameters" />
+ <returnType datatype="{@return}" />
+ <xsl:call-template name="examples" />
+ </constructor>
+ </xsl:for-each>
+ </constructors>
+ <properties>
+ <xsl:for-each select="//property">
+ <xsl:sort select="translate(@name,'$.','')"/>
+ <xsl:sort select="count(params)"/>
+ <property name="{@name}" readonly="true" datatype="{@return}" default="">
+ <xsl:call-template name="scope" />
+ <shortDescription><xsl:value-of select="desc" /></shortDescription>
+ <description><xsl:value-of select="longdesc" /></description>
+ <xsl:call-template name="examples" />
+ </property>
+ </xsl:for-each>
+ </properties>
+ <methods>
+ <xsl:for-each select="//function[@name!='jQuery']">
+ <xsl:sort select="translate(@name,'$.','')"/>
+ <xsl:sort select="count(params)"/>
+ <method name="{@name}">
+ <xsl:call-template name="scope" />
+ <shortDescription><xsl:value-of select="desc" /></shortDescription>
+ <description><xsl:value-of select="longdesc" /></description>
+ <xsl:call-template name="parameters" />
+ <returnType datatype="{@return}" />
+ <xsl:call-template name="examples" />
+ </method>
+ </xsl:for-each>
+ </methods>
+ </class>
+ </api>
+ </xsl:template>
+
+ <xsl:template name="scope">
+ <xsl:attribute name="scope">
+ <xsl:choose>
+ <xsl:when test="starts-with(@name, 'jQuery.')">static</xsl:when>
+ <xsl:when test="not(starts-with(@name, 'jQuery.'))">instance</xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ </xsl:template>
+
+ <xsl:template name="parameters">
+ <parameters>
+ <xsl:for-each select="params">
+ <parameter name="{@name}" datatype="{@type}">
+ <xsl:attribute name="usage">
+ <xsl:choose>
+ <xsl:when test="not(@optional)">required</xsl:when>
+ <xsl:when test="@optional">optional</xsl:when>
+ </xsl:choose>
+ </xsl:attribute>
+ <description><xsl:value-of select="desc" /></description>
+ <!-- TODO part of the spec, but with a very different interpretation -->
+ <xsl:choose>
+ <xsl:when test="../option">
+ <properties>
+ <xsl:for-each select="../option">
+ <property name="{@name}" datatype="{@type}" default="{@default}">
+ <description><xsl:value-of select="desc" /></description>
+ </property>
+ </xsl:for-each>
+ </properties>
+ </xsl:when>
+ </xsl:choose>
+ </parameter>
+ </xsl:for-each>
+ </parameters>
+ </xsl:template>
+
+ <xsl:template name="examples">
+ <examples>
+ <xsl:for-each select="example">
+ <example>
+ <description><xsl:value-of select="desc" /></description>
+ <xsl:copy-of select="code|html|css" />
+ </example>
+ </xsl:for-each>
+ </examples>
+ </xsl:template>
+
+</xsl:stylesheet>