Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions apidoc/docgen.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ var common = require('./lib/common.js'),
searchPlatform = null,
argc = 0,
path = '',
metadataFile = null,
templateStr = '';

/**
Expand Down Expand Up @@ -710,6 +711,14 @@ if ((argc = process.argv.length) > 2) {
}
});
break;
case '-m':
case '--metadata':
metadataFile = process.argv[++x];
if (!fs.existsSync(metadataFile)) {
common.log(common.LOG_WARN, 'File does not exist: %s', metadataFile);
metadataFile = null;
}
break;
case '--output' :
case '-o' :
if (++x > argc) {
Expand Down Expand Up @@ -869,6 +878,14 @@ formats.forEach(function (format) {
if (searchPlatform) {
processedData.__platform = searchPlatform;
}
if (format === 'alloy') {
if (metadataFile) {
processedData.__alloyMetadata = JSON.parse(fs.readFileSync(metadataFile, 'utf8'));
} else {
common.log(common.LOG_ERROR, 'No metadata file. Skipping alloy.');
return;
}
}
exportData = exporter.exportData(processedData);
templatePath = apidocPath + '/templates/';
output = outputPath;
Expand Down Expand Up @@ -903,6 +920,11 @@ formats.forEach(function (format) {
});
common.log('Generated output at %s', output);
break;
case 'alloy' :
templateStr = fs.readFileSync(templatePath + 'jsduck.ejs', 'utf8');
render = ejs.render(templateStr, {doc: exportData});
output = output + 'alloy.js';
break;
case 'changes' :
if (exportData.noResults) {
common.log('No API changes found.');
Expand Down
Loading