Now have accurate version information built into jquery.js - will build it into the...
[jquery.git] / build / docs / docs.js
index 6e77b94..500b91c 100644 (file)
@@ -1,19 +1,28 @@
 load("build/js/json.js", "build/js/xml.js", "build/js/writeFile.js", "build/js/parse.js");
 
-var c = parse( readFile(arguments[0]) );
-var json = Object.toJSON( c );
+var dir = arguments[1];
 
-writeFile( arguments[1] + "/data/jquery-docs-json.js", json );
-writeFile( arguments[1] + "/data/jquery-docs-jsonp.js", "docsLoaded(" + json + ")" );
+var c = parse( read(arguments[0]) );
+output( c, "docs" );
 
-Object.toXML.force = { desc: 1, code: 1, before: 1, result: 1 };
+c = categorize( c );
+output( c, "cat" );
 
-var xml = Object.toXML( { method: c }, "docs" );
+function output( c, n ) {
+       var json = Object.toJSON( c );
 
-writeFile( arguments[1] + "/data/jquery-docs-xml.xml", 
-       "<?xml version='1.0' encoding='ISO-8859-1'?>\n" + xml );
+       writeFile( dir + "/data/jquery-" + n + "-json.js", json );
+       writeFile( dir + "/data/jquery-" + n + "-jsonp.js", "docsLoaded(" + json + ")" );
 
-writeFile( arguments[1] + "/index.xml",
-       "<?xml version='1.0' encoding='ISO-8859-1'?>\n" +
-       "<?xml-stylesheet type='text/xsl' href='style/docs.xsl'?>\n" + xml
-);
+       Object.toXML.force = { desc: 1, code: 1, before: 1, result: 1 };
+       
+       var xml = Object.toXML( n == "docs" ? { method: c } : c, "docs" );
+
+       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/" + n + ".xsl'?>\n" + xml
+       );
+}