X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=build%2Fjs%2Fparse.js;h=211fe6ce0631899930c80f4c8f4337ba103d4b6e;hb=1ef930b3845248379f37a6b26c826122e9f65932;hp=c9454d173ce1c36ca361ca2224815542e34f834a;hpb=ccabf2823b528c09455432cafdb504c6a0216a18;p=jquery.git diff --git a/build/js/parse.js b/build/js/parse.js index c9454d1..211fe6c 100644 --- a/build/js/parse.js +++ b/build/js/parse.js @@ -5,7 +5,7 @@ function parse( f ) { while ( bm = blockMatch.exec(f) ) { block = bm[1].replace(/^\s*\* ?/mg,"") + "!!!"; - var ret = { params: [], examples: [], tests: [] }; + var ret = { params: [], examples: [], tests: [], options: [] }; while ( m = paramMatch.exec( block ) ) { block = block.replace( paramMatch, "" ); @@ -25,12 +25,11 @@ function parse( f ) { return ret; })*/ || 1; - if ( n == 'param' || n == 'any' ) { + if ( n == 'param' || n == 'option' ) { var args = v.split(/\s+/); v = args.slice( 2, args.length ); v = { type: args[0], name: args[1], desc: v.join(' ') }; - if ( n == 'any' ) v.any = 1; - n = "params"; + n = n + "s"; } else if ( n == 'example' ) { v = { code: v }; n = "examples"; @@ -69,7 +68,7 @@ function parse( f ) { } function categorize( json ) { - var obj = { methods: [] }; + var obj = { cat: [], method: [] }; for ( var i = 0; i < json.length; i++ ) { if ( !json[i].cat ) json[i].cat = ""; @@ -79,17 +78,26 @@ function categorize( json ) { var pos = obj; for ( var j = 0; j < cat.length; 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 - 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 ( j == cat.length - 1 ) - pos[c].methods.push( json[i] ); + curCat.method.push( json[i] ); // Otherwise, traverse deeper else - pos = pos[c]; + pos = curCat; } }