From 04a33220a861435cb4eb380dfa77cfd0175bd4bc Mon Sep 17 00:00:00 2001 From: Andreas Hocevar Date: Tue, 8 Apr 2014 19:01:16 +0200 Subject: [PATCH] Parse olx.js and convert types into typedef properties --- apidoc/conf.json | 3 ++- apidoc/plugins/exports.js | 26 ++++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/apidoc/conf.json b/apidoc/conf.json index 0aa799c414..4b91b0d4b8 100644 --- a/apidoc/conf.json +++ b/apidoc/conf.json @@ -13,7 +13,8 @@ "src/googx/dom/fullscreen.js" ], "include": [ - "src" + "src", + "externs/olx.js" ] }, "plugins": [ diff --git a/apidoc/plugins/exports.js b/apidoc/plugins/exports.js index 73f6dae2ed..2e7886d18f 100644 --- a/apidoc/plugins/exports.js +++ b/apidoc/plugins/exports.js @@ -58,18 +58,8 @@ exports.handlers = { newDoclet: function(e) { var i, ii, j, jj; - if (e.doclet.meta.filename == "objectliterals.jsdoc" && e.doclet.properties) { - for (i = 0, ii = e.doclet.properties.length; i < ii; ++i) { - if (e.doclet.properties[i].type && e.doclet.properties[i].type.names) { - for (j = 0, jj = e.doclet.properties[i].type.names.length; j < jj; ++j) { - if (e.doclet.properties[i].type.names[j].indexOf('ol') == 0) { - if (api.indexOf(e.doclet.properties[i].type.names[j]) === -1) { - api.push(e.doclet.properties[i].type.names[j]); - } - } - } - } - } + if (e.doclet.meta.filename == "olx.js" && e.doclet.longname != 'olx') { + api.push(e.doclet.longname); } if (api.indexOf(e.doclet.longname) > -1) { var names, name; @@ -102,6 +92,18 @@ exports.handlers = { parseComplete: function(e) { for (var j = e.doclets.length - 1; j >= 0; --j) { var doclet = e.doclets[j]; + if (doclet.meta.filename == 'olx.js' && doclet.kind == 'typedef') { + for (var i = e.doclets.length - 1; i >= 0; --i) { + var propertyDoclet = e.doclets[i]; + if (propertyDoclet.memberof == doclet.longname) { + if (!doclet.properties) { + doclet.properties = []; + } + doclet.properties.unshift(propertyDoclet); + e.doclets.splice(i, 1) + } + } + } if (doclet.kind == 'namespace' || doclet.kind == 'event' || doclet.fires) { continue; }