Skip to content
This repository was archived by the owner on Dec 4, 2017. It is now read-only.

Commit 3bc96fb

Browse files
chore(api-builder): add a service to disambiguate docs that are deprecated
1 parent bd41a16 commit 3bc96fb

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

tools/api-builder/links-package/index.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = new Package('links', [])
1111
.factory(require('./services/getLinkInfo'))
1212
.factory(require('./services/parseArgString'))
1313
.factory(require('./services/moduleScopeLinkDisambiguator'))
14+
.factory(require('./services/deprecatedDocsLinkDisambiguator'))
1415
.factory(require('./services/getApiFragmentFileName'))
1516

1617
.config(function(inlineTagProcessor, linkInlineTagDef, linkDevGuideInlineTagDef, exampleInlineTagDef, exampleTabsInlineTagDef) {
@@ -20,6 +21,7 @@ module.exports = new Package('links', [])
2021
inlineTagProcessor.inlineTagDefinitions.push(exampleTabsInlineTagDef);
2122
})
2223

23-
.config(function(getLinkInfo, moduleScopeLinkDisambiguator) {
24+
.config(function(getLinkInfo, moduleScopeLinkDisambiguator, deprecatedDocsLinkDisambiguator) {
2425
getLinkInfo.disambiguators.push(moduleScopeLinkDisambiguator);
26+
getLinkInfo.disambiguators.push(deprecatedDocsLinkDisambiguator);
2527
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
var _ = require('lodash');
2+
3+
module.exports = function deprecatedDocsLinkDisambiguator() {
4+
return function(url, title, currentDoc, docs) {
5+
if (docs.length != 2) return docs;
6+
7+
var filteredDocs = _.filter(docs, function(doc) {
8+
return !doc.fileInfo.relativePath.match(/\/(\w+)-deprecated\//);
9+
});
10+
11+
return filteredDocs.length > 0 ? filteredDocs : docs;
12+
};
13+
};

0 commit comments

Comments
 (0)