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:

committed by
Igor Minar

parent
470997ebb9
commit
12f03b90fd
@ -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)));
|
||||
}
|
@ -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}];
|
||||
}
|
||||
};
|
||||
};
|
@ -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}
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
3
tools/docs/content-package/tag-defs/intro.js
Normal file
3
tools/docs/content-package/tag-defs/intro.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = function() {
|
||||
return {name: 'intro'};
|
||||
};
|
3
tools/docs/content-package/tag-defs/title.js
Normal file
3
tools/docs/content-package/tag-defs/title.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = function() {
|
||||
return {name: 'title'};
|
||||
};
|
Reference in New Issue
Block a user