X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=docs.js;h=1d572004611481fa0c53fc18a789ad9135cd91c5;hp=cc826868eca7bd3f5c31074b9cd0fd17d5d9fa40;hb=d0445ccc41e95f9e629049d07e0e667d9cbb2273;hpb=5428554f5a5952b050f99c8e4ebf9165ccf9dfbc diff --git a/docs.js b/docs.js index cc82686..1d57200 100644 --- a/docs.js +++ b/docs.js @@ -3,13 +3,15 @@ Gtk = imports.gi.Gtk; Gio = imports.gi.Gio; Gdk = imports.gi.Gdk; +XObject = imports.XObject.XObject; -imports['Object.js'].load(Object); -File = imports['File.js'].File; -JSDOC = imports['JSDOC.js'].JSDOC; -console = imports['console.js'].console; + +File = imports.File.File; +console = imports.console.console; Introspect = imports['JSDOC/Introspect.js'].Introspect; +Template = imports['JSDOC/Template.js'].Template; + var outputdir = Seed.argv[2]; @@ -31,7 +33,7 @@ if (!File.isDirectory(outputdir)) { -var ns_list = JSDOC.Introspect.namespaces(); +var ns_list = Introspect.namespaces(); if (typeof(Seed.argv[3]) == 'string') { console.log(Seed.argv.length); ns_list = Seed.argv[3].split(','); @@ -39,17 +41,26 @@ if (typeof(Seed.argv[3]) == 'string') { ns_list = ns_list.sort(); -var cls_template = new JSDOC.Template(__script_path__ + '/docs/class.html'); -var cls_ix_template = new JSDOC.Template(__script_path__ + '/docs/class_ix.html'); -var reference_template = new JSDOC.Template(__script_path__ + '/docs/references.html'); +var cls_template = new Template(__script_path__ + '/docs/class.html'); +var cls_ix_template = new Template(__script_path__ + '/docs/class_ix.html'); +var reference_template = new Template(__script_path__ + '/docs/references.html'); var ns_idx = []; -ns_list.map(function(ns_name) +ns_list.forEach(function(ns_name) { + + //if (ns_idx.length) { return ;/* do one - for testing */ } + var core = imports.gi[ns_name]; var idx = { name: ns_name}; console.log("START:" + ns_name); var ns = Introspect.ns(ns_name); + + if (File.exists(ns.gir_file)) { + File.copyFile(ns.gir_file, outputdir + '/'+ ns.gir_filename,Gio.FileCopyFlags.OVERWRITE); + } + + ns['left_bar'] = cls_ix_template.process(ns); Gio.simple_write(outputdir + '/'+ ns_name + '.html', cls_template.process(ns)); @@ -69,10 +80,10 @@ ns_list.map(function(ns_name) for (var i in actions) { // we flag GLib as a GObject lib... idx[i]= ns_name == 'GLib' ? 1 : ns[i].length ; - ns[i].map( function(n) { + ns[i].forEach( function(n) { Gio.simple_write(outputdir + '/'+ ns_name + '.' + n + '.html', cls_template.process( - Object.extend( + XObject.extend( Introspect.factory(actions[i], ns_name, n), { 'left_bar' :ns['left_bar'] } ) @@ -83,7 +94,7 @@ ns_list.map(function(ns_name) }); } ns_idx.push(idx); - + }); var refs = ''; @@ -115,10 +126,10 @@ for (var i in Introspect.references) { Gio.simple_write(html_file_path, html); } - -var ix_template = new JSDOC.Template(__script_path__ + '/docs/index.html'); +console.log("writing index"); +var ix_template = new Template(__script_path__ + '/docs/index.html'); Gio.simple_write(outputdir + '/index.html', ix_template.process(ns_idx)); +console.log("coping images/css"); File.silentRecursiveCopy(__script_path__ + '/docs/resources/', outputdir); - - +console.log("done");