aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/ngdoc.js
diff options
context:
space:
mode:
authorVojta Jina2011-05-18 13:31:26 +0200
committerIgor Minar2011-06-06 22:51:59 -0700
commit7fe46e8d7e35c21167932c57b4ed53171164d1e2 (patch)
tree066f0069c793244c00e30704932e609e784da45c /docs/src/ngdoc.js
parent864da8b553f04d772ef359ed721c7c2daf849653 (diff)
downloadangular.js-7fe46e8d7e35c21167932c57b4ed53171164d1e2.tar.bz2
Bit of refactoring
Diffstat (limited to 'docs/src/ngdoc.js')
-rw-r--r--docs/src/ngdoc.js35
1 files changed, 16 insertions, 19 deletions
diff --git a/docs/src/ngdoc.js b/docs/src/ngdoc.js
index decce79b..d68aaaea 100644
--- a/docs/src/ngdoc.js
+++ b/docs/src/ngdoc.js
@@ -669,36 +669,33 @@ function indent(text, spaceCount) {
//////////////////////////////////////////////////////////
function merge(docs){
- // TODO(vojta) refactor to use only byFullId hash map
- var byName = {},
- byFullId = {};
+ var byFullId = {};
- docs.forEach(function(doc){
- byName[doc.name] = doc;
+ docs.forEach(function (doc) {
byFullId[doc.section + '/' + doc.id] = doc;
});
- for(var i=0; i<docs.length;) {
- if (findParent(docs[i], 'method') ||
- findParent(docs[i], 'property')) {
+
+ for(var i = 0; i < docs.length;) {
+ var doc = docs[i];
+
+ // check links - do they exist ?
+ doc.links.forEach(function(link) {
+ if (!byFullId[link]) console.log('WARNING: Non existing link "' + link + '" in ' + doc.section + '/' + doc.id);
+ });
+
+ // merge into parents
+ if (findParent(doc, 'method') || findParent(doc, 'property')) {
docs.splice(i, 1);
} else {
i++;
}
}
- // check links
- // TODO(vojta) refactor to reuse the loop above
- docs.forEach(function(doc) {
- doc.links.forEach(function(link) {
- if (!byFullId[link]) console.log('WARNING: Non existing link "' + link + '" in ' + doc.section + '/' + doc.id);
- });
- });
-
- function findParent(doc, name){
- var parentName = doc[name+'Of'];
+ function findParent(doc, name) {
+ var parentName = doc[name + 'Of'];
if (!parentName) return false;
- var parent = byName[parentName];
+ var parent = byFullId['api/' + parentName];
if (!parent)
throw new Error("No parent named '" + parentName + "' for '" +
doc.name + "' in @" + name + "Of.");