All the docs related files (docs-app, doc-gen, content, etc) are now to be found inside the `/aio` folder. The related gulp tasks have been moved from the top level gulp file to a new one inside the `/aio` folder. The structure of the `/aio` folder now looks like: ``` /aio/ build/ # gulp tasks content/ #MARKDOWN FILES for devguides, cheatsheet, etc devguides/ cheatsheets/ transforms/ #dgeni packages, templates, etc src/ app/ assets/ content/ #HTML + JSON build artifacts produced by dgeni from /aio/content. #This dir is .gitignored-ed e2e/ #protractor tests for the doc viewer app node_modules/ #dependencies for both the doc viewer builds and the dgeni stuff #This dir is .gitignored-ed gulpfile.js #Tasks for generating docs and building & deploying the doc viewer ``` Closes #14361
31 lines
1.0 KiB
JavaScript
31 lines
1.0 KiB
JavaScript
var _ = require('lodash');
|
|
|
|
/**
|
|
* @dgService getDocFromAlias
|
|
* @description Get an array of docs that match this alias, relative to the originating doc.
|
|
*/
|
|
module.exports = function getDocFromAlias(aliasMap, log) {
|
|
|
|
return function getDocFromAlias(alias, originatingDoc) {
|
|
var docs = aliasMap.getDocs(alias);
|
|
|
|
// If there is more than one item with this name then try to filter them by the originatingDoc's
|
|
// area
|
|
if (docs.length > 1 && originatingDoc && originatingDoc.area) {
|
|
docs = _.filter(docs, function(doc) { return doc.area === originatingDoc.area; });
|
|
}
|
|
|
|
// If filtering by area left us with none then let's start again
|
|
if (docs.length === 0) {
|
|
docs = aliasMap.getDocs(alias);
|
|
}
|
|
|
|
// If there is more than one item with this name then try to filter them by the originatingDoc's
|
|
// module
|
|
if (docs.length > 1 && originatingDoc && originatingDoc.module) {
|
|
docs = _.filter(docs, function(doc) { return doc.module === originatingDoc.module; });
|
|
}
|
|
|
|
return docs;
|
|
};
|
|
}; |