X-Git-Url: http://git.roojs.org/?a=blobdiff_plain;f=docs.js;h=6af0dda2c65b3e4e08a52b48ecc4a3d23eea3cbb;hb=7376856dcf57f0283a3174b9e3e0ab594829ee93;hp=b23fc2cfb8888f3982827fc37e19023bc5259709;hpb=75a33e8fbea0b516ddc8dd4e6207cb85a97bd6d3;p=gnome.introspection-doc-generator diff --git a/docs.js b/docs.js index b23fc2c..6af0dda 100644 --- a/docs.js +++ b/docs.js @@ -23,27 +23,49 @@ if (!outputdir) { }; } + if (!File.isDirectory(outputdir)) { console.log("Creating directory " + outputdir); File.mkdir(outputdir); }; -// list namespace.. -//var ns_list = [ 'GIRepository' ]; - - + +// Which libraries to build. var ns_list = Introspect.namespaces(); if (typeof(Seed.argv[3]) == 'string') { console.log(Seed.argv.length); ns_list = Seed.argv[3].split(','); } - + ns_list = ns_list.sort(); -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'); + +// which languages do we want to output for. +langs=[]; +File.list(__script_path__ + '/templates/').forEach(function(f) { + if (!File.isDirectory(__script_path__ + '/templates/' + f)) { + continue; + } + if (f == 'resources') { + continue; + } + langs.push({ + name : f, + cls_template : new Template(__script_path__ + '/templates/' + f + '/class.html'), + cls_ix_template : new Template(__script_path__ + '/templates/' + f + '/class_ix.html'), + reference_template : new Template(__script_path__ + '/templates/' + f + '/references.html'), + }); +}); + + +/* +var cls_template = new Template(__script_path__ + '/templates/class.html'); +var cls_ix_template = new Template(__script_path__ + '/templates/class_ix.html'); +var reference_template = new Template(__script_path__ + '/templates/references.html'); +*/ + + var ns_idx = []; ns_list.forEach(function(ns_name) { @@ -63,10 +85,14 @@ ns_list.forEach(function(ns_name) ns['left_bar'] = cls_ix_template.process(ns); - Gio.simple_write(outputdir + '/'+ ns_name + '.html', cls_template.process(ns)); - - // left bar index of elements in namespace... - Gio.simple_write(outputdir + '/_ix_'+ ns_name + '.shtml', cls_ix_template.process(ns)); + langs.forEach(function(lang) { + // namespace template + Gio.simple_write(outputdir + '/'+ lang + '/' +ns_name + '.html', lang.cls_template.process(ns)); + + // left bar index of elements in namespace... + Gio.simple_write(outputdir + '/'+ lang + '/_ix_'+ ns_name + '.shtml', lang.cls_ix_template.process(ns)); + + }); var actions = { @@ -81,6 +107,8 @@ ns_list.forEach(function(ns_name) // we flag GLib as a GObject lib... idx[i]= ns_name == 'GLib' ? 1 : ns[i].length ; ns[i].forEach( function(n) { + + Gio.simple_write(outputdir + '/'+ ns_name + '.' + n + '.html', cls_template.process( XObject.extend( @@ -127,6 +155,6 @@ for (var i in Introspect.references) { } -var ix_template = new Template(__script_path__ + '/docs/index.html'); +var ix_template = new Template(__script_path__ + '/templates/index.html'); Gio.simple_write(outputdir + '/index.html', ix_template.process(ns_idx)); -File.silentRecursiveCopy(__script_path__ + '/docs/resources/', outputdir, Gio.FileCopyFlags.OVERWRITE); +File.silentRecursiveCopy(__script_path__ + '/templates/resources/', outputdir, Gio.FileCopyFlags.OVERWRITE);