Commit c8009abc authored by John Resig's avatar John Resig

Lots of documentation overhaul - much more documented, cat output works better now.

parent 805d21c2
...@@ -23,6 +23,6 @@ function output( c, n ) { ...@@ -23,6 +23,6 @@ function output( c, n ) {
writeFile( dir + "/" + ( n == "docs" ? "index" : n ) + ".xml", writeFile( dir + "/" + ( n == "docs" ? "index" : n ) + ".xml",
"<?xml version='1.0' encoding='ISO-8859-1'?>\n" + "<?xml version='1.0' encoding='ISO-8859-1'?>\n" +
"<?xml-stylesheet type='text/xsl' href='style/docs.xsl'?>\n" + xml "<?xml-stylesheet type='text/xsl' href='style/" + n + ".xsl'?>\n" + xml
); );
} }
...@@ -17,9 +17,11 @@ $(document).ready(function(){ ...@@ -17,9 +17,11 @@ $(document).ready(function(){
}).ToolTipDemo('#fff'); }).ToolTipDemo('#fff');
$("a.name").click(function(){ $("a.name").click(function(){
$("div.more,div.short",this.parentNode.parentNode).toggle('slow').find("div.desc",function(){ $("div.more,div.short",this.parentNode.parentNode)
$(this).html( $(this).html().replace(/\n\n/g, "<br/><br/>") ); .find("div.desc",function(){
}); $(this).html( $(this).html().replace(/\n\n/g, "<br/><br/>") );
})
.toggle('slow');
return false; return false;
}); });
......
...@@ -116,7 +116,6 @@ ul#docs li div.more { ...@@ -116,7 +116,6 @@ ul#docs li div.more {
} }
ul#docs li div.example { ul#docs li div.example {
overflow: auto;
border-top: 1px solid #DDD; border-top: 1px solid #DDD;
margin-top: 15px; margin-top: 15px;
} }
...@@ -130,7 +129,6 @@ ul#docs li div.example pre { ...@@ -130,7 +129,6 @@ ul#docs li div.example pre {
color: #000; color: #000;
background: #EEE; background: #EEE;
padding: 5px; padding: 5px;
overflow: auto;
font-size: 0.8em; font-size: 0.8em;
} }
......
...@@ -69,7 +69,7 @@ function parse( f ) { ...@@ -69,7 +69,7 @@ function parse( f ) {
} }
function categorize( json ) { function categorize( json ) {
var obj = { methods: [] }; var obj = { cat: [], method: [] };
for ( var i = 0; i < json.length; i++ ) { for ( var i = 0; i < json.length; i++ ) {
if ( !json[i].cat ) json[i].cat = ""; if ( !json[i].cat ) json[i].cat = "";
...@@ -79,17 +79,26 @@ function categorize( json ) { ...@@ -79,17 +79,26 @@ function categorize( json ) {
var pos = obj; var pos = obj;
for ( var j = 0; j < cat.length; j++ ) { for ( var j = 0; j < cat.length; j++ ) {
var c = cat[j]; var c = cat[j];
var curCat = null;
// Locate current category
for ( var n = 0; n < pos.cat.length; n++ )
if ( pos.cat[n].value == c )
curCat = pos.cat[n];
// Create current category // Create current category
if ( !pos[c] ) pos[c] = { methods: [] }; if ( !curCat ) {
curCat = { value: c, cat: [], method: [] };
pos.cat.push( curCat )
}
// If we're at the end, add the method // If we're at the end, add the method
if ( j == cat.length - 1 ) if ( j == cat.length - 1 )
pos[c].methods.push( json[i] ); curCat.method.push( json[i] );
// Otherwise, traverse deeper // Otherwise, traverse deeper
else else
pos = pos[c]; pos = curCat;
} }
} }
......
...@@ -9,15 +9,13 @@ Object.toXML = function( obj, tag ) { ...@@ -9,15 +9,13 @@ Object.toXML = function( obj, tag ) {
var p = "", child = ""; var p = "", child = "";
for ( var i in obj ) for ( var i in obj )
if ( obj[i].constructor != String || /</.test(obj[i] + "") || Object.toXML.force[i] ) if ( ( obj[i].constructor != String && obj[i].constructor != Number ) || /</.test(obj[i] + "") || Object.toXML.force[i] )
child += Object.toXML( obj[i], i ); child += Object.toXML( obj[i], i );
else else
p += " " + i + "='" + (obj[i] + "").replace(/'/g, "&apos;") + "'"; p += " " + i + "='" + (obj[i] + "").replace(/'/g, "&apos;") + "'";
return "<" + tag + p + ( child ? ">\n" + child + "</" + tag + ">\n" : "/>\n" ); return "<" + tag + p + ( child ? ">\n" + child + "</" + tag + ">\n" : "/>\n" );
} else if ( obj.constructor == String ) { } else if ( obj.constructor == String || obj.constructor == Number ) {
//obj = obj.replace(/&lt;/g,"<").replace(/&gt;/g,">");
//return "<" + tag + "><![CDATA[" + obj + "]]></" + tag + ">";
return "<" + tag + ">" + obj + "</" + tag + ">\n"; return "<" + tag + ">" + obj + "</" + tag + ">\n";
} }
......
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment