1 load("build/js/json.js", "build/js/xml.js", "build/js/writeFile.js");
4 jQuery: "A jQuery object.",
5 Object: "A simple Javascript object. For example, it could be a String or a Number.",
6 String: "A string of characters.",
7 Number: "A numeric valid.",
8 Element: "The Javascript object representation of a DOM Element.",
9 Hash: "A Javascript object that contains key/value pairs in the form of properties and values.",
10 "Array<Element>": "An Array of DOM Elements.",
11 "Array<String>": "An Array of strings.",
12 Function: "A reference to a Javascript function."
15 var f = readFile(arguments[0]);
18 var blockMatch = /\/\*\*\s*((.|\n)*?)\s*\*\//g;
19 var paramMatch = /\@(\S+) *((.|\n)*?)(?=\n\@|!!!)/m;
21 while ( bm = blockMatch.exec(f) ) {
22 block = bm[1].replace(/^\s*\* ?/mg,"") + "!!!";
23 var ret = { params: [], examples: [] };
25 while ( m = paramMatch.exec( block ) ) {
26 block = block.replace( paramMatch, "" );
32 .replace(/&/g, "&")
33 .replace(/</g, "<")
34 .replace(/>/g, ">")
35 .replace(/\n/g, "<br/>")
36 /*.replace(/(\s\s+)/g, function(a){
38 for ( var i = 0; i < a.length; i++ )
43 if ( n == 'param' || n == 'any' ) {
44 var args = v.split(/\s+/);
45 v = args.slice( 2, args.length );
46 v = { type: args[0], name: args[1], desc: v.join(' ') };
47 if ( n == 'any' ) v.any = 1;
49 } else if ( n == 'example' ) {
54 if ( n == 'desc' || n == 'before' || n == 'after' || n == 'result' ) {
55 ret.examples[ ret.examples.length - 1 ][ n ] = v;
58 if ( ret[ n ].constructor == Array ) {
61 ret[ n ] = [ ret[ n ], v ];
69 ret.desc = block.replace(/\s*!!!$/,"")
70 .replace(/</g, "<")
71 .replace(/>/g, ">");
72 //.replace(/\n\n/g, "<br/><br/>")
73 //.replace(/\n/g, " ");
75 var m = /^((.|\n)*?(\.|$))/.exec( ret.desc );
76 if ( m ) ret['short'] = m[1];
78 if ( ret.name ) c.push( ret );
81 var json = Object.toJSON( c );
83 writeFile( arguments[1] + "/data/jquery-docs-json.js", json );
84 writeFile( arguments[1] + "/data/jquery-docs-jsonp.js", "docsLoaded(" + json + ")" );
86 Object.toXML.force = { desc: 1, code: 1, before: 1, result: 1 };
88 var xml = Object.toXML( { method: c }, "docs" );
90 writeFile( arguments[1] + "/data/jquery-docs-xml.xml",
91 "<?xml version='1.0' encoding='ISO-8859-1'?>\n" + xml );
93 writeFile( arguments[1] + "/index.xml",
94 "<?xml version='1.0' encoding='ISO-8859-1'?>\n" +
95 "<?xml-stylesheet type='text/xsl' href='style/docs.xsl'?>\n" + xml