diff options
| author | Igor Minar | 2010-11-17 11:33:30 -0800 |
|---|---|---|
| committer | Igor Minar | 2010-11-18 02:34:53 -0800 |
| commit | 51a22cf435b39f933e5a20aabb59d6c78353c9d3 (patch) | |
| tree | 65af20eb6cbafd5ab95ffc6b886f4c3cda6c3edd /docs/collect.js | |
| parent | c2c60ab49af22381e77641d61151563785e97a97 (diff) | |
| download | angular.js-51a22cf435b39f933e5a20aabb59d6c78353c9d3.tar.bz2 | |
group utility methods/objects while sorting stuff for the side bar
Diffstat (limited to 'docs/collect.js')
| -rw-r--r-- | docs/collect.js | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/docs/collect.js b/docs/collect.js index ac5b37d9..5a5e3ee9 100644 --- a/docs/collect.js +++ b/docs/collect.js @@ -31,7 +31,24 @@ var work = callback.chain(function () { }).onError(function(err){ console.log('ERROR:', err.stack || err); }).onDone(function(){ - keywordPages.sort(function(a,b){ return a.name == b.name ? 0:(a.name < b.name ? -1 : 1);}); + keywordPages.sort(function(a,b){ + // supper ugly comparator that orders all utility methods and objects before all the other stuff + // like widgets, directives, services, etc. + // Mother of all beatiful code please forgive me for the sin that this code certainly is. + + if (a.name === b.name) return 0; + if (a.name === 'angular') return -1; + if (b.name === 'angular') return 1; + + function namespacedName(page) { + return (page.name.match(/\./g).length === 1 && page.type !== 'overview' ? '0' : '1') + page.name; + } + + var namespacedA = namespacedName(a), + namespacedB = namespacedName(b); + + return namespacedA < namespacedB ? -1 : 1; + }); writeDoc(documentation.pages); mergeTemplate('docs-data.js', 'docs-data.js', {JSON:JSON.stringify(keywordPages)}, callback.chain()); mergeTemplate('docs-scenario.js', 'docs-scenario.js', documentation, callback.chain()); @@ -347,6 +364,7 @@ function processNgDoc(documentation, doc) { documentation.pages.push(doc); keywordPages.push({ name:doc.name, + type: doc.ngdoc, keywords:keywords(doc.raw.text) }); } |
