r1563 - in trunk: demos demos/images documentation release release/build

r1563 - in trunk: demos demos/images documentation release release/build


Author: joern.zaefferer
Date: Thu Jan 8 13:51:13 2009
New Revision: 1563
Added:
trunk/demos/images/icon-docs-info.gif (contents, props changed)
trunk/documentation/
trunk/release/build/style.xsl (contents, props changed)
Modified:
trunk/demos/demos.css
trunk/demos/index.html
trunk/release/build.xml
Log:
integrating documentation into demo files, first draft; run Ant targets
docs-download and docs-process to generate the files
Modified: trunk/demos/demos.css
==============================================================================
--- trunk/demos/demos.css    (original)
+++ trunk/demos/demos.css    Thu Jan 8 13:51:13 2009
@@ -205,3 +205,61 @@
#demo-link { font-size:11px; padding-top: 6px; clear: both; overflow:
hidden; }
#demo-link a span.ui-icon { float:left; margin-right:3px; }
+
+#widget-docs { margin:20px 0 0; }
+
+#widget-docs h2, #widget-docs h3, #widget-docs h4, #widget-docs p,
#widget-docs ul, #widget-docs code { margin:0; padding:0; }
+#widget-docs code { display:block; color:#444; font-size:.9em; margin:0 0
1em; }
+#widget-docs code strong { color:#000; }
+#widget-docs p { margin:0 3em 1.2em 0; }
+#widget-docs p.intro { font-size:13px; color:#666; line-height:1.3; }
+#widget-docs ul { list-style-type: none; }
+
+#widget-docs h2 { font-size:16px; margin:1.2em 0 .5em; }
+#widget-docs h3 { font-size:14px; color:#e6820E; margin:1.5em 0 .5em; }
+.normal #widget-docs h4 { font-size:12px; color:#000; border:0; margin:0
0 .5em; }
+
+#docs-overview-main { width:400px; }
+#docs-overview-sidebar { float:right; width:200px; }
+#docs-overview-sidebar a span { color:#666; }
+#widget-docs #docs-overview-main p { margin-right:0; }
+#widget-docs #docs-overview-sidebar h4 { padding-left:0; }
+
+.docs-list-header { float:left; width:100%; margin:10px 0 0;
border-bottom:1px solid #eee; }
+#widget-docs .docs-list-header h2 { float:left; margin:0; }
+#widget-docs .docs-list-header p { float:right; margin:5px 0;
font-size:11px; }
+
+.docs-list { float:left; width:100%; padding:0 0 10px; }
+.docs-list .param-header { float:left; clear:left; width:100%; padding:8px
0; border-top:1px solid #eee; }
+#widget-docs .param-header h3, #widget-docs .param-header p { margin:0;
float:left; }
+#widget-docs .param-header h3 { width:50%; }
+#widget-docs .param-header h3 span { background:
url(images/demo-spindown-closed.gif) no-repeat left; padding-left:13px; }
+#widget-docs .param-open .param-header h3 span { background:
url(images/demo-spindown-open.gif) no-repeat left; }
+#widget-docs .param-header p { width:24%; }
+#widget-docs .param-header p.param-type span { background:
url(images/icon-docs-info.gif) no-repeat left; cursor:pointer;
border-bottom:1px dashed #ccc; padding-left:15px; }
+
+.param-details { padding-left:13px; }
+.param-args { margin:0 0 1.5em; border-top:1px dotted #ccc;}
+.param-args td { padding:3px 30px 3px 5px; border-bottom:1px dotted #ccc;
}
+
+
+/* overrides for ui-tab styles */
+#widget-docs ul.ui-tabs-nav { padding:0 0 0 8px; }
+#widget-docs .ui-tabs-nav li { margin:5px 5px 0 0; }
+
+#widget-docs .ui-tabs-nav li a:link,
+#widget-docs .ui-tabs-nav li a:visited,
+#widget-docs .ui-tabs-nav li a:hover,
+#widget-docs .ui-tabs-nav li a:active { font-size:14px; padding:4px 1.2em
3px; color:#fff; }
+
+#widget-docs .ui-tabs-nav li.ui-tabs-selected a:link,
+#widget-docs .ui-tabs-nav li.ui-tabs-selected a:visited,
+#widget-docs .ui-tabs-nav li.ui-tabs-selected a:hover,
+#widget-docs .ui-tabs-nav li.ui-tabs-selected a:active { color:#e6820E; }
+
+#widget-docs .ui-tabs-panel { padding:20px 9px; font-size:12px;
line-height:1.4; color:#000; }
+
+#widget-docs .ui-widget-content a:link,
+#widget-docs .ui-widget-content a:visited { color:#1b75bb;
text-decoration:none; }
+#widget-docs .ui-widget-content a:hover,
+#widget-docs .ui-widget-content a:active { color:#0b559b; }
\ No newline at end of file
Added: trunk/demos/images/icon-docs-info.gif
==============================================================================
Binary file. No diff available.
Modified: trunk/demos/index.html
==============================================================================
--- trunk/demos/index.html    (original)
+++ trunk/demos/index.html    Thu Jan 8 13:51:13 2009
@@ -162,8 +162,28 @@
                $('#demo-frame').empty().html(data);
                $('#demo-link a').attr('href', path);
                updateDemoNotes();
-
            });
+            if (/default.html$/.test(path)) {
+                $.get("../documentation/" + path.match(/demos\/(.+)\//)[1] + ".html",
function(html) {
+                    $("#demo-notes").after(html);
+                    $("#widget-docs").tabs();
+                    $(".param-header").click(function() {
+                        $(this).parent().toggleClass("param-open").end().next().toggle();
+                    });
+                    $(".docs-list-header").each(function() {
+                        var header = $(this);
+                        var details = header.next().find(".param-details").hide();
+                        $("a:first", header).click(function() {
+                            details.show().parent().addClass("param-open");
+                            return false;
+                        });
+                        $("a:last", header).click(function() {
+                            details.hide().parent().removeClass("param-open");
+                            return false;
+                        });
+                    });
+                });
+            }
        }
        function updateDemoNotes() {
Modified: trunk/release/build.xml
==============================================================================
--- trunk/release/build.xml    (original)
+++ trunk/release/build.xml    Thu Jan 8 13:51:13 2009
@@ -218,4 +218,31 @@
         <delete dir="dist" />
</target>
    
-</project>
\ No newline at end of file
+    <target name="docs-download">
+        <property name="url"
value="http://www.exfer.net/jquery/createjQueryXMLDocs.py?start=UI/" />
+        <get src="${url}Accordion" dest="accordion.xml" />
+        <get src="${url}Datepicker" dest="datepicker.xml" />
+        <get src="${url}Dialog" dest="dialog.xml" />
+        <get src="${url}Draggable" dest="draggable.xml" />
+        <get src="${url}Droppable" dest="droppable.xml" />
+        <get src="${url}Progressbar" dest="progressbar.xml" />
+        <get src="${url}Resizable" dest="resizable.xml" />
+        <get src="${url}Selectable" dest="selectable.xml" />
+        <get src="${url}Slider" dest="slider.xml" />
+        <get src="${url}Sortable" dest="sortable.xml" />
+        <get src="${url}Tabs" dest="tabs.xml" />
+    </target>
+            
+    <!--depends="download-docs"-->
+    <target name="docs-process" >
+        <property name="docs.dir" value="${ui.dir}/documentation" />
+        <delete dir="${docs.dir}" />
+        <mkdir dir="${docs.dir}" />
+        <xslt includes="*.xml,accordion.xml" excludes="build.xml"
destdir="${docs.dir}" style="build/style.xsl" />
+    </target>
+    
+    <target name="docs-clean">
+        <delete file="*.xml" exclude="build.xml" />
+    </target>
+    
+</project>
Added: trunk/release/build/style.xsl
==============================================================================
--- (empty file)
+++ trunk/release/build/style.xsl    Thu Jan 8 13:51:13 2009
@@ -0,0 +1,274 @@
+<?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="html" />
+    
+    <xsl:template name="ref">
+        <xsl:text>link-</xsl:text>
+        <xsl:value-of select="translate(@name, '$.|', '')"/>
+        <xsl:text>-</xsl:text>
+        <xsl:for-each select="params">
+            <xsl:value-of select="translate(@name, '&lt;&gt;|$.', '')" />
+        </xsl:for-each>
+    </xsl:template>
+
+    <xsl:template name="href">
+        <xsl:attribute name="href">
+            <xsl:text>#</xsl:text>
+            <xsl:call-template name="ref" />
+        </xsl:attribute>
+    </xsl:template>
+    
+    <xsl:template name="id">
+        <xsl:attribute name="id">
+            <xsl:call-template name="ref" />
+        </xsl:attribute>
+    </xsl:template>
+    
+    <xsl:template name="return">
+        <xsl:attribute name="title">
+            <xsl:choose>
+                <xsl:when test="@return='jQuery'">A jQuery object.</xsl:when>
+                <xsl:when test="@return='Boolean'">true or false.</xsl:when>
+                <xsl:when test="@return='Object'">A simple Javascript
object..</xsl:when>
+                <xsl:when test="@return='String'">A string of characters.</xsl:when>
+                <xsl:when test="@return='Number'">A valid numeric.</xsl:when>
+                <xsl:when test="@return='String|Number'">A string of characters or a
number.</xsl:when>
+                <xsl:when test="@return='Element'">The Javascript object
representation of a DOM Element.</xsl:when>
+                <xsl:when test="@return='Element|Array&lt;Element&gt;'">One or more
DOM Elements (a single one or an array).</xsl:when>
+                <xsl:when test="@return='Map'">A Javascript object that contains
key/value pairs in the form of properties and values.</xsl:when>
+                <xsl:when test="@return='Array&lt;Element&gt;'">An Array of DOM
Elements.</xsl:when>
+                <xsl:when test="@return='Array&lt;String&gt;'">An Array of
strings.</xsl:when>
+                <xsl:when test="@return='Function'">A reference to a Javascript
function.</xsl:when>
+                <xsl:when test="@return='XMLHttpRequest'">An XMLHttpRequest object
(referencing a HTTP request).</xsl:when>
+            </xsl:choose>
+        </xsl:attribute>
+        <xsl:value-of select="@return"/>
+    </xsl:template>
+
+    <xsl:template name="type">
+        <xsl:attribute name="title">
+            <xsl:choose>
+                <xsl:when test="@type='jQuery'">A jQuery object.</xsl:when>
+                <xsl:when test="@type='Boolean'">true or false.</xsl:when>
+                <xsl:when test="@type='Object'">A simple Javascript object..</xsl:when>
+                <xsl:when test="@type='String'">A string of characters.</xsl:when>
+                <xsl:when test="@type='Number'">A valid numeric.</xsl:when>
+                <xsl:when test="@type='String|Number'">A string of characters or a
number.</xsl:when>
+                <xsl:when test="@type='Element'">The Javascript object representation
of a DOM Element.</xsl:when>
+                <xsl:when test="@type='Element|Array&lt;Element&gt;'">One or more DOM
Elements (a single one or an array).</xsl:when>
+                <xsl:when test="@type='Map'">A Javascript object that contains
key/value pairs in the form of properties and values.</xsl:when>
+                <xsl:when test="@type='Array&lt;Element&gt;'">An Array of DOM
Elements.</xsl:when>
+                <xsl:when test="@type='Array&lt;String&gt;'">An Array of
strings.</xsl:when>
+                <xsl:when test="@type='Function'">A reference to a Javascript
function.</xsl:when>
+                <xsl:when test="@type='XMLHttpRequest'">An XMLHttpRequest object
(referencing a HTTP request).</xsl:when>
+            </xsl:choose>
+        </xsl:attribute>
+        <xsl:value-of select="@type"/>
+    </xsl:template>
+    
+    <xsl:template name="break">
+        <xsl:param name="text" select="." />
+        <xsl:choose>
+            <xsl:when test="contains($text, '&#xa;&#xa;')">
+                <xsl:value-of select="substring-before($text, '&#xa;&#xa;')" />
+                <br /><br />
+                <xsl:call-template name="break">
+                    <xsl:with-param name="text"    
select="substring-after($text, '&#xa;&#xa;')" />
+                </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:value-of select="$text" />
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    
+    <xsl:template name="option">
+        <div class="param">
+            <div class="param-header">
+                <h3><span><xsl:value-of select="@name"/></span></h3>
+                <p class="param-type"><span><xsl:call-template name="type"
/></span>
+                <p class="param-default">Default: <xsl:value-of select="@default"/>
+            </div>
+            <div class="param-details">
+                

<xsl:value-of select="desc"/>


+                <!--
+                <h4>Code sample:</h4>
+                <code>
+                Here be code samples once added to the exporter script.<br />
+                $("#dialog").dialog({<br />
+                &#160;&#160;buttons: {<br />
+                &#160;&#160;&#160;&#160;'Delete all items in recycle bin': function()
{<br />
+                &#160;&#160;&#160;&#160;&#160;&#160;$(this).dialog('close');<br />
+                &#160;&#160;&#160;&#160;},<br />
+                &#160;&#160;&#160;&#160;Cancel: function() {<br />
+                &#160;&#160;&#160;&#160;&#160;&#160;$(this).dialog('close');<br />
+                &#160;&#160;&#160;&#160;}<br />
+                &#160;&#160;}<br />
+                });
+                </code>
+                -->
+            </div>
+        </div>
+    </xsl:template>
+    
+    <xsl:template match="/*">
+        <div id="widget-docs">
+            <ul>
+                <li><a href="#docs-overview"><span>Overview</span></a></li>
+                <li><a href="#docs-options"><span>Options</span></a></li>
+                <li><a href="#docs-methods"><span>Methods</span></a></li>
+                <li><a href="#docs-theming"><span>Theming</span></a></li>
+            </ul>
+            
+        <!-- TAB 1 -->
+            <div id="docs-overview">
+                <div id="docs-overview-sidebar">
+                    <h4>Dependencies:</h4>
+                    <ul>                            
+                        <li><a href="#">ui.core.js</a></li>
+                        <li><a href="#">ui.draggable.js <span>(Optional)</span></a></li>
+                        <li><a href="#">ui.resizable.js <span>(Optional)</span></a></li>
+                    </ul>
+                </div>
+                <div id="docs-overview-main">
+                    


+                        <xsl:for-each select="//function[1]/desc">
+                            <xsl:call-template name="break" />
+                        </xsl:for-each>
+                    




+                    


+                        <xsl:for-each select="//function[1]/longdesc">
+                            <xsl:call-template name="break" />
+                        </xsl:for-each>
+                    




+                </div>
+            </div>
+            
+        <!-- TAB 2 -->
+            <div id="docs-options">
+                <p class="intro"><xsl:value-of select="//function[1]/params/desc"/>
+                
+                <div class="docs-list-header clearfix">
+                    <h2>Property options</h2>
+                    

<a href="#">Show details</a> | <a href="#">Hide details</a>


+                </div>
+                
+                <div class="docs-list clearfix">
+                    <xsl:for-each
select="//function[1]/option[not(starts-with(@type, 'function'))]">
+                        <xsl:call-template name="option"/>
+                    </xsl:for-each>
+                </div><!-- /property options -->
+                
+                <div class="docs-list-header clearfix">
+                    <h2>Event options</h2>
+                    

<a href="#">Show details</a> | <a href="#">Hide details</a>


+                </div>
+                
+                <div class="docs-list clearfix">
+                    <xsl:for-each
select="//function[1]/option[starts-with(@type, 'function')]">
+                        <xsl:call-template name="option"/>
+                    </xsl:for-each>
+                </div><!-- /event options -->
+            </div>
+        
+        <!-- TAB 3 -->    
+            <div id="docs-methods">
+                <p class="intro">A brief description of methods and their uses goes
here so their use is clearly explained and any caveats can be mentioned up
front.
+                
+                <div class="docs-list-header clearfix">
+                    <h2>Methods</h2>
+                    

<a href="#">Show details</a> | <a href="#">Hide details</a>


+                </div>
+                
+                <div class="docs-list clearfix">
+                    <xsl:for-each select="//function[position() != 1]">
+                        <div class="param">
+                            <div class="param-header">
+                                <h3><span><xsl:value-of select="//function[1]/@name"/>(
<xsl:value-of select="params[1]/@name"/>
+                                <xsl:for-each select="params[position() != 1]">
+                                    <xsl:text>, </xsl:text><xsl:value-of select="@name"/>
+                                </xsl:for-each>
+                                 )</span></h3>
+                            &nbs