X-Git-Url: http://git.roojs.org/?p=gnome.introspection-doc-generator;a=blobdiff_plain;f=docs.js;h=386f14dbd8a0a1e6c69d979df7d086284b16ecd3;hp=85cfd837c6a86a0bdbef7d3e4e691451eb28c005;hb=dd939ef42ab96c7c31349b798036a1d2b41c3cbc;hpb=11c8d8d40cd75c4585ec2fb66b6b2e82f047bc05 diff --git a/docs.js b/docs.js index 85cfd83..386f14d 100644 --- a/docs.js +++ b/docs.js @@ -51,21 +51,19 @@ File.list(__script_path__ + '/templates/').forEach(function(f) { continue; } langs.push({ - - - - 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'), + 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 = []; @@ -80,6 +78,7 @@ ns_list.forEach(function(ns_name) var ns = Introspect.ns(ns_name); + // gir goes in top level... if (File.exists(ns.gir_file)) { File.copyFile(ns.gir_file, outputdir + '/'+ ns.gir_filename, Gio.FileCopyFlags.OVERWRITE); } @@ -87,11 +86,14 @@ ns_list.forEach(function(ns_name) ns['left_bar'] = cls_ix_template.process(ns); - // namespace template - 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.name+ '/' +ns_name + '.html', lang.cls_template.process(ns)); + + // left bar index of elements in namespace... + Gio.simple_write(outputdir + '/'+ lang.name + '/_ix_'+ ns_name + '.shtml', lang.cls_ix_template.process(ns)); + + }); var actions = { @@ -106,17 +108,15 @@ 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( - Introspect.factory(actions[i], ns_name, n), - { 'left_bar' :ns['left_bar'] } - ) + var odata = XObject.extend( + Introspect.factory(actions[i], ns_name, n), + { 'left_bar' :ns['left_bar'] } + ); + langs.forEach(function(lang) { + Gio.simple_write(outputdir + '/'+ lang.name + '/' + ns_name + '.' + n + '.html', + lang.cls_template.process(odata) ) - ) - + }); console.log(ns_name + '.' +n); }); } @@ -128,32 +128,40 @@ var refs = ''; var html_file_path = ''; var html = '' - -for (var i in Introspect.references) { - html_file_path = File.join(outputdir, i + '.html'); - - if (i == 'undefined') { - console.log("Undefined name space - ignored"); - continue; - } - if (!File.isFile(html_file_path)) { - console.log("No HTML file " + html_file_path + " to insert references into - ignored"); - continue; - } +// output cross reference data.. +langs.forEach(function(lang) { - refs = reference_template.process(Introspect.references[i]); - - // HTML to put refs into - html = File.read(html_file_path); + for (var i in Introspect.references) { + + html_file_path = [ outputdir, lang.name, i + '.html'].join('/'); + + if (i == 'undefined') { + console.log("Undefined name space - ignored"); + continue; + } + + if (!File.isFile(html_file_path)) { + console.log("No HTML file " + html_file_path + " to insert references into - ignored"); + continue; + } + + refs = langs.reference_template.process(Introspect.references[i]); - // do the replacement - html = html.replace(/\