Updated the documentation parser to work with categories. Additionally, I updated the copyright notice in the jQuery header and removed some extraneous whitespace from jQuery Lite.
This commit is contained in:
parent
5ae02b2ecd
commit
ccabf2823b
|
@ -1,6 +1,6 @@
|
||||||
load("build/js/writeFile.js");
|
load("build/js/writeFile.js");
|
||||||
|
|
||||||
var blockMatch = /\s*\/\*\*\s*((.|\n)*?)\s*\*\/\n*/g;
|
var blockMatch = /\s*\/\*\*\s*((.|\n)*?)\s*\*\/\n*/g;
|
||||||
var f = readFile(arguments[0]).replace( blockMatch, "\n" );
|
var f = readFile(arguments[0]).replace( blockMatch, "\n" ).replace( /\n\n+/g, "\n\n" );
|
||||||
|
|
||||||
writeFile( arguments[1], f );
|
writeFile( arguments[1], f );
|
||||||
|
|
|
@ -1,19 +1,28 @@
|
||||||
load("build/js/json.js", "build/js/xml.js", "build/js/writeFile.js", "build/js/parse.js");
|
load("build/js/json.js", "build/js/xml.js", "build/js/writeFile.js", "build/js/parse.js");
|
||||||
|
|
||||||
|
var dir = arguments[1];
|
||||||
|
|
||||||
var c = parse( readFile(arguments[0]) );
|
var c = parse( readFile(arguments[0]) );
|
||||||
var json = Object.toJSON( c );
|
output( c, "docs" );
|
||||||
|
|
||||||
writeFile( arguments[1] + "/data/jquery-docs-json.js", json );
|
c = categorize( c );
|
||||||
writeFile( arguments[1] + "/data/jquery-docs-jsonp.js", "docsLoaded(" + json + ")" );
|
output( c, "cat" );
|
||||||
|
|
||||||
Object.toXML.force = { desc: 1, code: 1, before: 1, result: 1 };
|
function output( c, n ) {
|
||||||
|
var json = Object.toJSON( c );
|
||||||
|
|
||||||
var xml = Object.toXML( { method: c }, "docs" );
|
writeFile( dir + "/data/jquery-" + n + "-json.js", json );
|
||||||
|
writeFile( dir + "/data/jquery-" + n + "-jsonp.js", "docsLoaded(" + json + ")" );
|
||||||
|
|
||||||
writeFile( arguments[1] + "/data/jquery-docs-xml.xml",
|
Object.toXML.force = { desc: 1, code: 1, before: 1, result: 1 };
|
||||||
"<?xml version='1.0' encoding='ISO-8859-1'?>\n" + xml );
|
|
||||||
|
|
||||||
writeFile( arguments[1] + "/index.xml",
|
var xml = Object.toXML( n == "docs" ? { method: c } : c, "docs" );
|
||||||
"<?xml version='1.0' encoding='ISO-8859-1'?>\n" +
|
|
||||||
"<?xml-stylesheet type='text/xsl' href='style/docs.xsl'?>\n" + xml
|
writeFile( dir + "/data/jquery-" + n + "-xml.xml",
|
||||||
);
|
"<?xml version='1.0' encoding='ISO-8859-1'?>\n" + xml );
|
||||||
|
|
||||||
|
writeFile( dir + "/" + ( n == "docs" ? "index" : n ) + ".xml",
|
||||||
|
"<?xml version='1.0' encoding='ISO-8859-1'?>\n" +
|
||||||
|
"<?xml-stylesheet type='text/xsl' href='style/docs.xsl'?>\n" + xml
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
|
@ -67,3 +67,31 @@ function parse( f ) {
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function categorize( json ) {
|
||||||
|
var obj = { methods: [] };
|
||||||
|
|
||||||
|
for ( var i = 0; i < json.length; i++ ) {
|
||||||
|
if ( !json[i].cat ) json[i].cat = "";
|
||||||
|
|
||||||
|
var cat = json[i].cat.split("/");
|
||||||
|
|
||||||
|
var pos = obj;
|
||||||
|
for ( var j = 0; j < cat.length; j++ ) {
|
||||||
|
var c = cat[j];
|
||||||
|
|
||||||
|
// Create current category
|
||||||
|
if ( !pos[c] ) pos[c] = { methods: [] };
|
||||||
|
|
||||||
|
// If we're at the end, add the method
|
||||||
|
if ( j == cat.length - 1 )
|
||||||
|
pos[c].methods.push( json[i] );
|
||||||
|
|
||||||
|
// Otherwise, traverse deeper
|
||||||
|
else
|
||||||
|
pos = pos[c];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@ 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 == Array || /</.test(obj[i] + "") || Object.toXML.force[i] )
|
if ( obj[i].constructor != String || /</.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, "'") + "'";
|
p += " " + i + "='" + (obj[i] + "").replace(/'/g, "'") + "'";
|
||||||
|
|
3
src/jquery/jquery.js
vendored
3
src/jquery/jquery.js
vendored
|
@ -2,7 +2,8 @@
|
||||||
* jQuery - New Wave Javascript
|
* jQuery - New Wave Javascript
|
||||||
*
|
*
|
||||||
* Copyright (c) 2006 John Resig (jquery.com)
|
* Copyright (c) 2006 John Resig (jquery.com)
|
||||||
* Dual licensed under the MIT and GPL licenses.
|
* Dual licensed under the MIT (MIT-LICENSE.txt)
|
||||||
|
* and GPL (GPL-LICENSE.txt) licenses.
|
||||||
*
|
*
|
||||||
* $Date$
|
* $Date$
|
||||||
* $Rev$
|
* $Rev$
|
||||||
|
|
Loading…
Reference in a new issue