build(aio): support guide authoring

This commit implements various tags, inline tags and changes the markdown
renderer to use Rho. This enables us to generate guide type documents.
This commit is contained in:
Peter Bacon Darwin
2017-02-02 08:19:20 +00:00
committed by Igor Minar
parent 470997ebb9
commit 12f03b90fd
18 changed files with 315 additions and 44 deletions

View File

@ -15,6 +15,11 @@ module.exports = new Package('content', [jsdocPackage, linksPackage])
readFilesProcessor.fileReaders.push(contentFileReader);
})
.config(function(parseTagsProcessor, getInjectables) {
parseTagsProcessor.tagDefinitions = parseTagsProcessor.tagDefinitions.concat(
getInjectables(requireFolder('./tag-defs')));
})
// Configure ids and paths
.config(function(computeIdsProcessor, computePathsProcessor) {
@ -33,3 +38,10 @@ module.exports = new Package('content', [jsdocPackage, linksPackage])
getAliases: function(doc) { return [doc.id]; }
});
});
function requireFolder(folderPath) {
const absolutePath = path.resolve(__dirname, folderPath);
return fs.readdirSync(absolutePath)
.filter(p => !/[._]spec\.js$/.test(p)) // ignore spec files
.map(p => require(path.resolve(absolutePath, p)));
}

View File

@ -20,7 +20,7 @@ module.exports = function contentFileReader() {
getDocs: function(fileInfo) {
// We return a single element array because content files only contain one document
return [{docType: 'guide', content: fileInfo.content, startingLine: 1}];
return [{docType: 'content', content: fileInfo.content, startingLine: 1}];
}
};
};

View File

@ -37,7 +37,7 @@ describe('contentFileReader', function() {
'project/path/modules/someModule/foo/docs/subfolder/bar.ngdoc', 'A load of content',
'project/path');
expect(fileReader.getDocs(fileInfo)).toEqual([
{docType: 'guide', content: 'A load of content', startingLine: 1}
{docType: 'content', content: 'A load of content', startingLine: 1}
]);
});
});

View File

@ -0,0 +1,3 @@
module.exports = function() {
return {name: 'intro'};
};

View File

@ -0,0 +1,3 @@
module.exports = function() {
return {name: 'title'};
};