Skip to content
Open
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
7 changes: 6 additions & 1 deletion bin/moxygen.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,16 @@ program.version(pjson.version)
.option('-t, --templates <dir>', 'custom templates directory (default: "built-in templates")', String)
.option('-L, --logfile [file]', 'output log messages to file, (default: console only, default file name: "moxygen.log")')
.option('-q, --quiet', 'quiet mode', false)
.option('-r, --relative-paths', 'links are relative (don`t include the output path)', false)
.option('-s, --separator <separator sequence>', 'separator sequence (default: "::")', '::')

.parse(process.argv);

logger.init(program, app.defaultOptions);

if (program.args.length) {
app.run(assign({}, app.defaultOptions, {
directory: program.args[0],
directory: program.args.slice(-1).pop(),
output: program.output,
groups: program.groups,
pages: program.pages,
Expand All @@ -35,6 +38,8 @@ if (program.args.length) {
anchors: program.anchors,
htmlAnchors: program.htmlAnchors,
language: program.language,
relativePaths: program.relativePaths,
separator: program.separator,
templates: program.templates,
}));
}
Expand Down
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ module.exports = {
classes: false, /** Output doxygen classes separately **/
output_s: 'api_%s.md', /** Output file for groups and classes **/
logfile: 'moxygen.log', /** Log file **/
relativePaths: false, /** Use relative paths (omit output base path) **/
separator: '::', /** Group separator sequence **/

filters: {
members: [
Expand Down
16 changes: 12 additions & 4 deletions src/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,27 @@ module.exports = {
},

compoundPath: function(compound, options) {
var target = options.output;
if (options.relativePaths) {
target = target.replace(target, path.basename(target));
}
if (compound.kind == 'page') {
return path.dirname(options.output) + "/page-" + compound.name + ".md";
} else if (options.groups) {
return util.format(options.output, compound.groupname);
return util.format(target, compound.groupname);
} else if (options.classes) {
return util.format(options.output, compound.name.replace(/\:/g, '-').replace('<', '(').replace('>', ')'));
return util.format(target, compound.name.replace(/\:\:/g, options.separator).replace(/\:/g, '-').replace('<', '(').replace('>', ')'));
} else {
return options.output;
return target;
}
},

writeCompound: function(compound, contents, references, options) {
this.writeFile(this.compoundPath(compound, options), contents.map(function(content) {
var outputPath = this.compoundPath(compound, options);
if (options.relativePaths) {
outputPath = path.join(path.dirname(options.output), outputPath);
}
this.writeFile(outputPath, contents.map(function(content) {
return this.resolveRefs(content, compound, references, options);
}.bind(this)));
},
Expand Down
2 changes: 1 addition & 1 deletion src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ module.exports = {
case 'typedef':

// set namespace reference
var nsp = compound.name.split('::');
var nsp = compound.name.split("::");
compound.namespace = nsp.splice(0, nsp.length - 1).join('::');
break;

Expand Down