From 8b4b768045c593fd5b2293ce35944dbbc23ad0fb Mon Sep 17 00:00:00 2001 From: Naum Azeredo Date: Mon, 15 Jan 2018 07:44:37 -0300 Subject: [PATCH 01/56] Add exception parameterlist --- package.json | 2 +- src/parser.js | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d346b39a..8e5a2752 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moxygen", - "version": "0.7.6", + "version": "0.7.7", "description": "Doxygen XML to Markdown documentation converter", "main": "index.js", "scripts": { diff --git a/src/parser.js b/src/parser.js index f021b83d..09d649b0 100644 --- a/src/parser.js +++ b/src/parser.js @@ -39,7 +39,15 @@ function toMarkdown(element, context) { case 'bold': s = '**'; break; case 'parametername': case 'computeroutput': s = '`'; break; - case 'parameterlist': s = '\n#### Parameters\n'; break; + case 'parameterlist': + if (element.$.kind == 'exception') { + s = '\n#### Exceptions\n' + } + else { + s = '\n#### Parameters\n' + } + break; + case 'parameteritem': s = '* '; break; case 'programlisting': s = '\n```cpp\n'; break; case 'itemizedlist': s = '\n\n'; break; From 21f892461362ede2973f23b16b02cfc371e7f59d Mon Sep 17 00:00:00 2001 From: Paris MEULEMAN Date: Mon, 19 Feb 2018 16:42:28 +1100 Subject: [PATCH 02/56] fix for #3 TypeError: Cannot read property 'forEach' of undefined --- src/parser.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/parser.js b/src/parser.js index 09d649b0..3f448397 100644 --- a/src/parser.js +++ b/src/parser.js @@ -196,11 +196,13 @@ module.exports = { m = m.concat(memberdef.$.prot, ' '); // public, private, ... if (memberdef.templateparamlist) { m.push('template<'); - memberdef.templateparamlist[0].param.forEach(function (param, argn) { - m = m.concat(argn == 0 ? [] : ','); - m = m.concat([toMarkdown(param.type)]); - m = m.concat(param.declname ? [' ', toMarkdown(param.declname)] : []); - }); + if (memberdef.templateparamlist.length > 0 && memberdef.templateparamlist.param) { + memberdef.templateparamlist[0].param.forEach(function (param, argn) { + m = m.concat(argn == 0 ? [] : ','); + m = m.concat([toMarkdown(param.type)]); + m = m.concat(param.declname ? [' ', toMarkdown(param.declname)] : []); + }); + } m.push('> \n'); } m = m.concat(memberdef.$.inline == 'yes' ? ['inline', ' '] : []); From 0a8807f34dd04d66b1f89966df3982a3a1cd8294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayberk=20=C3=96zg=C3=BCr?= Date: Wed, 7 Mar 2018 13:24:27 +0100 Subject: [PATCH 03/56] Support for QT signals and slots --- index.js | 5 ++++- src/parser.js | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 2536ace7..bc849aea 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,10 @@ module.exports = { 'public-attrib', 'public-func', 'protected-attrib', - 'protected-func' + 'protected-func', + 'signal', + 'public-slot', + 'protected-slot' ], compounds: [ 'namespace', diff --git a/src/parser.js b/src/parser.js index 3f448397..306193f6 100644 --- a/src/parser.js +++ b/src/parser.js @@ -192,6 +192,10 @@ module.exports = { var m = []; switch (member.kind) { + case 'signal': + case 'slot': + m = m.concat(['{', member.kind, '} ']); + case 'function': m = m.concat(memberdef.$.prot, ' '); // public, private, ... if (memberdef.templateparamlist) { From 163e2d07a25395b61c4aa9037b3c352165243586 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayberk=20=C3=96zg=C3=BCr?= Date: Wed, 7 Mar 2018 14:15:52 +0100 Subject: [PATCH 04/56] Support for QT properties --- index.js | 1 + src/parser.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/index.js b/index.js index bc849aea..df207500 100644 --- a/index.js +++ b/index.js @@ -35,6 +35,7 @@ module.exports = { // 'enumvalue', 'func', // 'variable', + 'property', 'public-attrib', 'public-func', 'protected-attrib', diff --git a/src/parser.js b/src/parser.js index 306193f6..4054cc87 100644 --- a/src/parser.js +++ b/src/parser.js @@ -241,6 +241,13 @@ module.exports = { m = m.concat(markdown.link(member.name, '#' + member.refid, true)); break; + case 'property': + m = m.concat(['{', member.kind, '} ']); + m = m.concat(toMarkdown(memberdef.type), ' '); + // m = m.concat(memberdef.name[0]._); + m = m.concat(markdown.link(member.name, '#' + member.refid, true)); + break; + case 'enum': member.enumvalue = []; if (memberdef.enumvalue) { From c34e2527050203fa1282922ee6aa56aa9a6f3620 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ayberk=20=C3=96zg=C3=BCr?= Date: Wed, 7 Mar 2018 17:50:23 +0100 Subject: [PATCH 05/56] Support for in-class enum --- index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index df207500..518a37ed 100644 --- a/index.js +++ b/index.js @@ -42,7 +42,8 @@ module.exports = { 'protected-func', 'signal', 'public-slot', - 'protected-slot' + 'protected-slot', + 'public-type' ], compounds: [ 'namespace', From 73dd1d0674c2ad388639b229eaf5425130ea66c3 Mon Sep 17 00:00:00 2001 From: Kam Date: Tue, 20 Mar 2018 07:37:33 +0100 Subject: [PATCH 06/56] Update package.json --- .gitignore | 1 + package.json | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c2658d7d..504afef8 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ node_modules/ +package-lock.json diff --git a/package.json b/package.json index 8e5a2752..18334b24 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "moxygen", - "version": "0.7.7", + "version": "0.7.8", "description": "Doxygen XML to Markdown documentation converter", "main": "index.js", "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" + "release": "release-it" }, "bin": { "moxygen": "./bin/moxygen.js" @@ -16,7 +16,8 @@ "keywords": [ "doxygen", "markdown", - "documentation" + "documentation", + "generator" ], "author": "Kam Low", "license": "MIT", From 63e22ca33339394d1f3a6464bcb7fff178dba9b9 Mon Sep 17 00:00:00 2001 From: Kam Date: Tue, 20 Mar 2018 07:38:43 +0100 Subject: [PATCH 07/56] Release 0.7.9 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 18334b24..c75446dd 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moxygen", - "version": "0.7.8", + "version": "0.7.9", "description": "Doxygen XML to Markdown documentation converter", "main": "index.js", "scripts": { From 66a639e0756025bea693d78b973d65802fc31613 Mon Sep 17 00:00:00 2001 From: Kam Date: Tue, 20 Mar 2018 07:38:59 +0100 Subject: [PATCH 08/56] Release 0.7.10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c75446dd..f447f6ed 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moxygen", - "version": "0.7.9", + "version": "0.7.10", "description": "Doxygen XML to Markdown documentation converter", "main": "index.js", "scripts": { From 8a791b78febb95c57e67390c21b9966f7c04a0d9 Mon Sep 17 00:00:00 2001 From: Kam Date: Tue, 20 Mar 2018 07:40:18 +0100 Subject: [PATCH 09/56] Release 0.7.11 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f447f6ed..d2788694 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moxygen", - "version": "0.7.10", + "version": "0.7.11", "description": "Doxygen XML to Markdown documentation converter", "main": "index.js", "scripts": { From defa3a827d331858d3bc10306874ee06cfa38186 Mon Sep 17 00:00:00 2001 From: Kam Date: Tue, 20 Mar 2018 07:41:57 +0100 Subject: [PATCH 10/56] Release 0.7.12 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d2788694..70734661 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moxygen", - "version": "0.7.11", + "version": "0.7.12", "description": "Doxygen XML to Markdown documentation converter", "main": "index.js", "scripts": { From dcbd27118ceef7f35e1da096611df26db54d5a68 Mon Sep 17 00:00:00 2001 From: tony_kero Date: Sat, 14 Apr 2018 07:11:00 +0200 Subject: [PATCH 11/56] Added pages output --- bin/moxygen.js | 2 ++ index.js | 16 +++++++++++++++- src/parser.js | 2 +- src/templates.js | 3 +++ templates/cpp/page.md | 34 ++++++++++++++++++++++++++++++++++ 5 files changed, 55 insertions(+), 2 deletions(-) create mode 100644 templates/cpp/page.md diff --git a/bin/moxygen.js b/bin/moxygen.js index 01158782..1a9e30fe 100755 --- a/bin/moxygen.js +++ b/bin/moxygen.js @@ -11,6 +11,7 @@ program.version(pjson.version) .usage('[options] ') .option('-o, --output ', 'output file (must contain %s when using groups)', String, 'api.md') .option('-g, --groups', 'output doxygen groups into separate files', false) + .option('-p, --pages', 'output doxygen pages into separate files', false) .option('-n, --noindex', 'disable generation of the index (no effect with `groups` option', false) .option('-a, --anchors', 'add anchors to internal links', false) .option('-l, --language ', 'programming language', String, 'cpp') @@ -27,6 +28,7 @@ if (program.args.length) { directory: program.args[0], output: program.output, groups: program.groups, + pages: program.pages, noindex: program.noindex, anchors: program.anchors, language: program.language, diff --git a/index.js b/index.js index 518a37ed..3a701ade 100644 --- a/index.js +++ b/index.js @@ -27,6 +27,7 @@ module.exports = { anchors: true, /** Generate anchors for internal links **/ language: 'cpp', /** Programming language **/ templates: 'templates', /** Templates directory **/ + pages: false, /** Output doxygen pages separately **/ filters: { members: [ @@ -77,7 +78,6 @@ module.exports = { doxyparser.loadIndex(options, function (err, root) { if (err) throw err; - // Output groups if (options.groups) { var groups = root.toArray('compounds', 'group'); @@ -106,6 +106,20 @@ module.exports = { contents.push('Generated by [Moxygen](https://sourcey.com/moxygen)') helpers.writeFile(options.output, contents); } + + if(options.pages){ + var pages = root.toArray('compounds', 'page'); + if(!pages.length) + throw "You have enabled `pages` output, but no pages were " + + "located in your doxygen XML files." + pages.forEach(function(page){ + var compounds = page.toFilteredArray('compounds'); + compounds.unshift(page); + var contents = templates.renderArray(compounds); + helpers.writeFile(path.dirname(options.output) + "/page-" + page.name + ".md", contents); + }) + } + }); } } diff --git a/src/parser.js b/src/parser.js index 4054cc87..8d2e30f7 100644 --- a/src/parser.js +++ b/src/parser.js @@ -434,7 +434,7 @@ module.exports = { this.parseMembers(compound, element.$, element.member); - if (compound.kind !== 'page') { // && compound.kind !== 'file' + if (compound.kind !== 'file') { // && compound.kind !== 'file' log.verbose('Parsing ' + path.join(options.directory, compound.refid + '.xml')); doxygen = fs.readFileSync(path.join(options.directory, compound.refid + '.xml'), 'utf8'); xmlParser.parseString(doxygen, function (err, data) { diff --git a/src/templates.js b/src/templates.js index 58e01f49..8fdfd05f 100644 --- a/src/templates.js +++ b/src/templates.js @@ -42,6 +42,9 @@ module.exports = { case 'index': template = 'index'; break; + case 'page': + template = 'page' + break; case 'group': case 'namespace': if (Object.keys(compound.compounds).length === 1 diff --git a/templates/cpp/page.md b/templates/cpp/page.md new file mode 100644 index 00000000..e4dacc8e --- /dev/null +++ b/templates/cpp/page.md @@ -0,0 +1,34 @@ +# {{kind}} `{{name}}` {{anchor refid}} + +{{briefdescription}} + +{{detaileddescription}} + +{{#if filtered.members}} + +## Summary + + Members | Descriptions +--------------------------------|--------------------------------------------- +{{#each filtered.members}}{{cell proto}} | {{cell summary}} +{{/each}}{{#each filtered.compounds}}{{cell proto}} | {{cell summary}} +{{/each}} + +## Members + +{{#each filtered.members}} +#### {{title proto}} {{anchor refid}} + +{{#if enumvalue}} + Values | Descriptions +--------------------------------|--------------------------------------------- +{{#each enumvalue}}{{cell name}} | {{cell summary}} +{{/each}} +{{/if}} + +{{briefdescription}} + +{{detaileddescription}} + +{{/each}} +{{/if}} From 187fea28d0c33c15b02121ac5c2edbfeec208fb4 Mon Sep 17 00:00:00 2001 From: tony_kero Date: Sat, 14 Apr 2018 16:32:58 +0200 Subject: [PATCH 12/56] Fixed unwanted newlines --- src/templates.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/templates.js b/src/templates.js index 8fdfd05f..f66d7b28 100644 --- a/src/templates.js +++ b/src/templates.js @@ -62,8 +62,8 @@ module.exports = { console.log('Skipping ', compound); return undefined; } - - return this.templates[template](compound).replace(/(\r\n|\r|\n){2,}/g, '$1\n'); + + return this.templates[template](compound).replace(/(\r\n|\r|\n){3,}/g, '$1\n'); }, renderArray: function (compounds) { From cefc2a6458e1fde51657c2e6568c8c5d11a3fd0b Mon Sep 17 00:00:00 2001 From: PoTa Date: Mon, 10 Sep 2018 12:05:59 +0200 Subject: [PATCH 13/56] Add support for formulas. --- src/parser.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/parser.js b/src/parser.js index 8d2e30f7..a6067e1c 100644 --- a/src/parser.js +++ b/src/parser.js @@ -69,6 +69,12 @@ function toMarkdown(element, context) { console.assert(element.$.kind + ' not supported.'); } break; + case 'formula': + s = trim(element._); + if (s.startsWith('$') && s.endsWith('$')) return s; + if (s.startsWith('\\[') && s.endsWith('\\]')) + s = trim(s.substring(2, s.length - 2)); + return '\n$$\n' + s + '\n$$\n'; case 'xreftitle': case 'entry': From 3f842a46087584c309c48ae168ce58bd849bb20d Mon Sep 17 00:00:00 2001 From: Viktor Gal Date: Mon, 10 Sep 2018 12:27:23 +0200 Subject: [PATCH 14/56] output classes and structs separately --- bin/moxygen.js | 2 ++ index.js | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/bin/moxygen.js b/bin/moxygen.js index 1a9e30fe..4c82e801 100755 --- a/bin/moxygen.js +++ b/bin/moxygen.js @@ -11,6 +11,7 @@ program.version(pjson.version) .usage('[options] ') .option('-o, --output ', 'output file (must contain %s when using groups)', String, 'api.md') .option('-g, --groups', 'output doxygen groups into separate files', false) + .option('-c, --classes', 'output doxygen groups into separate files', false) .option('-p, --pages', 'output doxygen pages into separate files', false) .option('-n, --noindex', 'disable generation of the index (no effect with `groups` option', false) .option('-a, --anchors', 'add anchors to internal links', false) @@ -29,6 +30,7 @@ if (program.args.length) { output: program.output, groups: program.groups, pages: program.pages, + classes: program.classes, noindex: program.noindex, anchors: program.anchors, language: program.language, diff --git a/index.js b/index.js index 3a701ade..b9da99b7 100644 --- a/index.js +++ b/index.js @@ -28,6 +28,7 @@ module.exports = { language: 'cpp', /** Programming language **/ templates: 'templates', /** Templates directory **/ pages: false, /** Output doxygen pages separately **/ + classes: false, /** Output doxygen classes separately **/ filters: { members: [ @@ -94,7 +95,20 @@ module.exports = { helpers.writeFile(util.format(options.output, group.name), contents); }); } - + else if (options.classes) { + var rootCompounds = root.toArray('compounds'); + if (!rootCompounds.length) + throw "You have enabled `classes` output, but no classes were " + + "located in your doxygen XML files." + rootCompounds.forEach(function (comp) { + var compounds = comp.toArray(); + compounds.forEach(function (e) { + e.filterChildren(options.filters) + var contents = templates.render(e); + helpers.writeFile(util.format(options.output, e.name), [contents]); + }); + }); + } // Output single file else { root.filterChildren(options.filters); From 06bb30f0453fe71b566d8cfa7e30caee1faafda6 Mon Sep 17 00:00:00 2001 From: PoTa Date: Tue, 18 Sep 2018 13:17:57 +0200 Subject: [PATCH 15/56] add html anchors, fixes #31 --- bin/moxygen.js | 2 ++ src/templates.js | 3 +++ 2 files changed, 5 insertions(+) diff --git a/bin/moxygen.js b/bin/moxygen.js index 4c82e801..7baf9281 100755 --- a/bin/moxygen.js +++ b/bin/moxygen.js @@ -15,6 +15,7 @@ program.version(pjson.version) .option('-p, --pages', 'output doxygen pages into separate files', false) .option('-n, --noindex', 'disable generation of the index (no effect with `groups` option', false) .option('-a, --anchors', 'add anchors to internal links', false) + .option('-h, --html-anchors', 'add html anchors to internal links', false) .option('-l, --language ', 'programming language', String, 'cpp') .option('-t, --templates ', 'custom templates directory', String, 'templates') .option('-q, --quiet', 'quiet mode', false) @@ -33,6 +34,7 @@ if (program.args.length) { classes: program.classes, noindex: program.noindex, anchors: program.anchors, + htmlAnchors: program.htmlAnchors, language: program.language, templates: program.templates })); diff --git a/src/templates.js b/src/templates.js index f66d7b28..4e743123 100644 --- a/src/templates.js +++ b/src/templates.js @@ -96,6 +96,9 @@ module.exports = { if (options.anchors) { return '{#' + name + '}'; } + else if (options.htmlAnchors) { + return ''; + } else { return ''; } From ab4d79201f267b7cecdaa6f7be69b9cb4f085db2 Mon Sep 17 00:00:00 2001 From: PoTa Date: Tue, 18 Sep 2018 17:01:34 +0200 Subject: [PATCH 16/56] Fix linking to external file (e.g. if groups or classes options used). --- src/helpers.js | 20 ++++++------ src/parser.js | 84 ++++++++++++++++++++++++++++++------------------ src/templates.js | 6 ---- 3 files changed, 61 insertions(+), 49 deletions(-) diff --git a/src/helpers.js b/src/helpers.js index af99c5b0..4ddb69e6 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -46,17 +46,15 @@ module.exports = { } }, - // Replace group links to point to correct output file - replaceGroupReflink: function (outfile, references, str) { - var match = str.match(/\((#(.*))\)/), - anchor = match[1], - refid = match[2], - ref = references[refid]; - if (ref && ref.groupname) { - var href = util.format(outfile, ref.groupname) + anchor; - str = str.replace(/\((#(.*))\)/, '(' + href + ')') - } - return str; + // Replace group and class links to point to correct output file if needed + resolveRef: function(options, compound, references) { + return function(refid) { + if ((options.groups || options.classes) && compound.refid !== refid && references[refid]) { + return util.format(options.output, options.groups ? references[refid].groupname : references[refid].name) + '#' + refid; + } else { + return '#' + refid; + } + }; }, // Write the output file diff --git a/src/parser.js b/src/parser.js index a6067e1c..9a370df3 100644 --- a/src/parser.js +++ b/src/parser.js @@ -33,7 +33,7 @@ function toMarkdown(element, context) { // opening the element switch (element['#name']) { - case 'ref': return s + markdown.link(toMarkdown(element.$$), '#' + element.$.refid, true); + case 'ref': return s + markdown.link(toMarkdown(element.$$), module.exports.resolveRef(element.$.refid), true); case '__text__': s = element._; break; case 'emphasis': s = '*'; break; case 'bold': s = '**'; break; @@ -320,23 +320,10 @@ module.exports = { parseCompound: function (compound, compounddef) { log.verbose('Processing compound ' + compound.name); - Object.keys(compounddef.$).forEach(function(prop) { - compound[prop] = compounddef.$[prop]; - }); - compound.fullname = compounddef.compoundname[0]._; copy(compound, 'briefdescription', compounddef); copy(compound, 'detaileddescription', compounddef); summary(compound, compounddef); - if (compounddef.basecompoundref) { - compounddef.basecompoundref.forEach(function (basecompoundref) { - compound.basecompoundref.push({ - prot: basecompoundref.$.prot, - name: basecompoundref._, - }); - }); - } - if (compounddef.sectiondef) { compounddef.sectiondef.forEach(function (section) { // switch (section.$['kind']) { @@ -373,6 +360,24 @@ module.exports = { } compound.proto = helpers.inline([compound.kind, ' ', markdown.link(compound.name, '#' + compound.refid, true)]); + return; + }, + + preprocessCompound: function (compound, compounddef) { + log.verbose('Preprocessing compound ' + compound.name); + Object.keys(compounddef.$).forEach(function(prop) { + compound[prop] = compounddef.$[prop]; + }); + compound.fullname = compounddef.compoundname[0]._; + + if (compounddef.basecompoundref) { + compounddef.basecompoundref.forEach(function (basecompoundref) { + compound.basecompoundref.push({ + prot: basecompoundref.$.prot, + name: basecompoundref._, + }); + }); + } // kind specific parsing switch (compound.kind) { @@ -429,29 +434,45 @@ module.exports = { return; }, - parseIndex: function (root, index, options) { + parseIndex: function (root, index, options, callback) { + var compounds = [], defs = []; + var processTogether = function(compound, def) { + this.preprocessCompound(compound, def); + defs.push([compound, def]); + if (compounds.length == defs.length) { + defs.forEach(function(item) { + this.resolveRef = helpers.resolveRef(options, item[0], this.references); + this.parseCompound(item[0], item[1]); + }.bind(this)); + callback(null, this.root); // TODO: return errors properly + } + }.bind(this); + index.forEach(function (element) { - var doxygen, compound = root.find(element.name[0], true); + var compound = root.find(element.name[0], true); + this.parseMembers(compound, element.$, element.member); + if (compound.kind !== 'file') { // && compound.kind !== 'file' + compounds.push(compound); + } + }.bind(this)); + + compounds.forEach(function (compound) { + var doxygen; var xmlParser = new xml2js.Parser({ explicitChildren: true, preserveChildrenOrder: true, charsAsChildren: true }); - this.parseMembers(compound, element.$, element.member); - - if (compound.kind !== 'file') { // && compound.kind !== 'file' - log.verbose('Parsing ' + path.join(options.directory, compound.refid + '.xml')); - doxygen = fs.readFileSync(path.join(options.directory, compound.refid + '.xml'), 'utf8'); - xmlParser.parseString(doxygen, function (err, data) { - if (err) { - log.verbose('warning - parse error for file' , path.join(options.directory, compound.refid + '.xml')) - return; - } - this.parseCompound(compound, data.doxygen.compounddef[0]); - }.bind(this)); - } - + log.verbose('Parsing ' + path.join(options.directory, compound.refid + '.xml')); + doxygen = fs.readFileSync(path.join(options.directory, compound.refid + '.xml'), 'utf8'); + xmlParser.parseString(doxygen, function (err, data) { + if (err) { + log.verbose('warning - parse error for file' , path.join(options.directory, compound.refid + '.xml')) + return; + } + processTogether(compound, data.doxygen.compounddef[0]); + }.bind(this)); }.bind(this)); }, @@ -469,8 +490,7 @@ module.exports = { return; } this.root.kind = 'index'; - this.parseIndex(this.root, result.doxygenindex.compound, options); - callback(null, this.root); // TODO: return errors properly + this.parseIndex(this.root, result.doxygenindex.compound, options, callback); }.bind(this)); }.bind(this)); } diff --git a/src/templates.js b/src/templates.js index f66d7b28..67a323b5 100644 --- a/src/templates.js +++ b/src/templates.js @@ -77,17 +77,11 @@ module.exports = { // Escape the code for a table cell. handlebars.registerHelper('cell', function(code) { - if (options.groups && code.indexOf('(#') !== -1) { - code = helpers.replaceGroupReflink(options.output, doxyparser.references, code); - } return code.replace(/\|/g, '\\|').replace(/\n/g, '
'); }); // Escape the code for a titles. handlebars.registerHelper('title', function(code) { - if (options.groups && code.indexOf('(#') !== -1) { - code = helpers.replaceGroupReflink(options.output, doxyparser.references, code); - } return code.replace(/\n/g, '
'); }); From 39dd4b87250b2b8ef0968870c22591b2c562b964 Mon Sep 17 00:00:00 2001 From: PoTa Date: Mon, 24 Sep 2018 04:34:53 +0200 Subject: [PATCH 17/56] Fixing linking to references, fixes #34. - reverts ab4d79201f267b7cecdaa6f7be69b9cb4f085db2 which causes OOM for large xml files - generates ref markers and replaces them after parsing is done --- index.js | 12 ++---- src/helpers.js | 56 +++++++++++++++++++++++--- src/markdown.js | 4 ++ src/parser.js | 104 +++++++++++++++++++++--------------------------- 4 files changed, 103 insertions(+), 73 deletions(-) diff --git a/index.js b/index.js index b9da99b7..e9d9fd00 100644 --- a/index.js +++ b/index.js @@ -7,7 +7,6 @@ 'use strict'; var path = require('path'); -var util = require('util'); var doxyparser = require('./src/parser'); var templates = require('./src/templates'); @@ -91,8 +90,7 @@ module.exports = { var compounds = group.toFilteredArray('compounds'); compounds.unshift(group); // insert group at top - var contents = templates.renderArray(compounds); - helpers.writeFile(util.format(options.output, group.name), contents); + helpers.writeCompound(group, templates.renderArray(compounds), doxyparser.references, options); }); } else if (options.classes) { @@ -104,8 +102,7 @@ module.exports = { var compounds = comp.toArray(); compounds.forEach(function (e) { e.filterChildren(options.filters) - var contents = templates.render(e); - helpers.writeFile(util.format(options.output, e.name), [contents]); + helpers.writeCompound(e, [templates.render(e)], doxyparser.references, options); }); }); } @@ -118,7 +115,7 @@ module.exports = { compounds.unshift(root); // insert root at top if index is enabled var contents = templates.renderArray(compounds); contents.push('Generated by [Moxygen](https://sourcey.com/moxygen)') - helpers.writeFile(options.output, contents); + helpers.writeCompound(root, contents, doxyparser.references, options); } if(options.pages){ @@ -129,8 +126,7 @@ module.exports = { pages.forEach(function(page){ var compounds = page.toFilteredArray('compounds'); compounds.unshift(page); - var contents = templates.renderArray(compounds); - helpers.writeFile(path.dirname(options.output) + "/page-" + page.name + ".md", contents); + helpers.writeCompound(page, templates.renderArray(compounds), doxyparser.references, options); }) } diff --git a/src/helpers.js b/src/helpers.js index 4ddb69e6..eaf66c6e 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -46,15 +46,59 @@ module.exports = { } }, - // Replace group and class links to point to correct output file if needed - resolveRef: function(options, compound, references) { - return function(refid) { - if ((options.groups || options.classes) && compound.refid !== refid && references[refid]) { - return util.format(options.output, options.groups ? references[refid].groupname : references[refid].name) + '#' + refid; + findParent: function(compound, kinds) { + while (compound) { + if (kinds.includes(compound.kind)) + return compound; + compound = compound.parent; + } + }, + + // Replace ref links to point to correct output file if needed + resolveRefs: function(content, compound, references, options) { + return content.replace(/\{#ref ([^ ]+) #\}/g, function(_, refid) { + var ref = references[refid] + var page = this.findParent(ref, ['page']); + + if (page) { + if (page.refid == compound.refid) + return '#' + refid; + return this.compoundPath(page, options) + '#' + refid; + } + + if (options.groups) { + if (compound.groupid && compound.groupid == ref.groupid) + return '#' + refid; + return this.compoundPath(ref, options) + '#' + refid; + } else if (options.classes) { + var dest = this.findParent(ref, ['namespace', 'class', 'struct']); + if (!dest || compound.refid == dest.refid) + return '#' + refid; + return this.compoundPath(dest, options) + '#' + refid; } else { + if (compound.kind == 'page') + return this.compoundPath(compound.parent, options) + '#' + refid; return '#' + refid; } - }; + }.bind(this)); + }, + + compoundPath: function(compound, options) { + if (compound.kind == 'page') { + return path.dirname(options.output) + "/page-" + compound.name + ".md"; + } else if (options.groups) { + return util.format(options.output, compound.groupname); + } else if (options.classes) { + return util.format(options.output, compound.name); + } else { + return options.output; + } + }, + + writeCompound: function(compound, contents, references, options) { + this.writeFile(this.compoundPath(compound, options), contents.map(function(content) { + return this.resolveRefs(content, compound, references, options); + }.bind(this))); }, // Write the output file diff --git a/src/markdown.js b/src/markdown.js index 5e0c862e..1712c0f0 100644 --- a/src/markdown.js +++ b/src/markdown.js @@ -8,6 +8,10 @@ module.exports = { + refLink: function (text, refid) { + return this.link(text, '{#ref ' + refid + ' #}'); + }, + link: function (text, href) { return '[' + text + '](' + href + ')'; }, diff --git a/src/parser.js b/src/parser.js index 9a370df3..8bd40136 100644 --- a/src/parser.js +++ b/src/parser.js @@ -33,7 +33,7 @@ function toMarkdown(element, context) { // opening the element switch (element['#name']) { - case 'ref': return s + markdown.link(toMarkdown(element.$$), module.exports.resolveRef(element.$.refid), true); + case 'ref': return s + markdown.refLink(toMarkdown(element.$$), element.$.refid); case '__text__': s = element._; break; case 'emphasis': s = '*'; break; case 'bold': s = '**'; break; @@ -179,7 +179,7 @@ module.exports = { if (membersdef) { membersdef.forEach(function (memberdef) { - var member = { name: memberdef.name[0] }; + var member = { name: memberdef.name[0], parent: compound }; compound.members.push(member); Object.keys(memberdef.$).forEach(function(prop) { member[prop] = memberdef.$[prop]; @@ -221,7 +221,7 @@ module.exports = { m = m.concat(toMarkdown(memberdef.type), ' '); m = m.concat(memberdef.$.explicit == 'yes' ? ['explicit', ' '] : []); // m = m.concat(memberdef.name[0]._); - m = m.concat(markdown.link(member.name, '#' + member.refid, true)); + m = m.concat(markdown.refLink(member.name, member.refid)); m = m.concat('('); if (memberdef.param) { memberdef.param.forEach(function (param, argn) { @@ -244,14 +244,14 @@ module.exports = { m = m.concat(memberdef.$.mutable == 'yes' ? ['mutable', ' '] : []); m = m.concat(toMarkdown(memberdef.type), ' '); // m = m.concat(memberdef.name[0]._); - m = m.concat(markdown.link(member.name, '#' + member.refid, true)); + m = m.concat(markdown.refLink(member.name, member.refid)); break; case 'property': m = m.concat(['{', member.kind, '} ']); m = m.concat(toMarkdown(memberdef.type), ' '); // m = m.concat(memberdef.name[0]._); - m = m.concat(markdown.link(member.name, '#' + member.refid, true)); + m = m.concat(markdown.refLink(member.name, member.refid)); break; case 'enum': @@ -267,12 +267,12 @@ module.exports = { }); } // m.push(member.kind + ' ' + member.name); - m = m.concat([member.kind, ' ', markdown.link(member.name, '#' + member.refid, true)]); + m = m.concat([member.kind, ' ', markdown.refLink(member.name, member.refid)]); break; default: // m.push(member.kind + ' ' + member.name); - m = m.concat([member.kind, ' ', markdown.link(member.name, '#' + member.refid, true)]); + m = m.concat([member.kind, ' ', markdown.refLink(member.name, member.refid)]); break; } @@ -320,10 +320,23 @@ module.exports = { parseCompound: function (compound, compounddef) { log.verbose('Processing compound ' + compound.name); + Object.keys(compounddef.$).forEach(function(prop) { + compound[prop] = compounddef.$[prop]; + }); + compound.fullname = compounddef.compoundname[0]._; copy(compound, 'briefdescription', compounddef); copy(compound, 'detaileddescription', compounddef); summary(compound, compounddef); + if (compounddef.basecompoundref) { + compounddef.basecompoundref.forEach(function (basecompoundref) { + compound.basecompoundref.push({ + prot: basecompoundref.$.prot, + name: basecompoundref._, + }); + }); + } + if (compounddef.sectiondef) { compounddef.sectiondef.forEach(function (section) { // switch (section.$['kind']) { @@ -342,6 +355,7 @@ module.exports = { if (compound.kind == 'group') { member.groupid = compound.id; + member.groupname = compound.name; } else if (compound.kind == 'file') { // add free members defined inside files in the default @@ -359,25 +373,7 @@ module.exports = { }.bind(this)); } - compound.proto = helpers.inline([compound.kind, ' ', markdown.link(compound.name, '#' + compound.refid, true)]); - return; - }, - - preprocessCompound: function (compound, compounddef) { - log.verbose('Preprocessing compound ' + compound.name); - Object.keys(compounddef.$).forEach(function(prop) { - compound[prop] = compounddef.$[prop]; - }); - compound.fullname = compounddef.compoundname[0]._; - - if (compounddef.basecompoundref) { - compounddef.basecompoundref.forEach(function (basecompoundref) { - compound.basecompoundref.push({ - prot: basecompoundref.$.prot, - name: basecompoundref._, - }); - }); - } + compound.proto = helpers.inline([compound.kind, ' ', markdown.refLink(compound.name, compound.refid)]); // kind specific parsing switch (compound.kind) { @@ -399,6 +395,11 @@ module.exports = { case 'namespace': case 'group': + if (compound.kind == 'group') { + compound.groupid = compound.id; + compound.groupname = compound.name; + } + // handle innerclass for groups and namespaces if (compounddef.innerclass) { compounddef.innerclass.forEach(function (innerclassdef) { @@ -434,45 +435,29 @@ module.exports = { return; }, - parseIndex: function (root, index, options, callback) { - var compounds = [], defs = []; - var processTogether = function(compound, def) { - this.preprocessCompound(compound, def); - defs.push([compound, def]); - if (compounds.length == defs.length) { - defs.forEach(function(item) { - this.resolveRef = helpers.resolveRef(options, item[0], this.references); - this.parseCompound(item[0], item[1]); - }.bind(this)); - callback(null, this.root); // TODO: return errors properly - } - }.bind(this); - + parseIndex: function (root, index, options) { index.forEach(function (element) { - var compound = root.find(element.name[0], true); - this.parseMembers(compound, element.$, element.member); - if (compound.kind !== 'file') { // && compound.kind !== 'file' - compounds.push(compound); - } - }.bind(this)); - - compounds.forEach(function (compound) { - var doxygen; + var doxygen, compound = root.find(element.name[0], true); var xmlParser = new xml2js.Parser({ explicitChildren: true, preserveChildrenOrder: true, charsAsChildren: true }); - log.verbose('Parsing ' + path.join(options.directory, compound.refid + '.xml')); - doxygen = fs.readFileSync(path.join(options.directory, compound.refid + '.xml'), 'utf8'); - xmlParser.parseString(doxygen, function (err, data) { - if (err) { - log.verbose('warning - parse error for file' , path.join(options.directory, compound.refid + '.xml')) - return; - } - processTogether(compound, data.doxygen.compounddef[0]); - }.bind(this)); + this.parseMembers(compound, element.$, element.member); + + if (compound.kind !== 'file') { // && compound.kind !== 'file' + log.verbose('Parsing ' + path.join(options.directory, compound.refid + '.xml')); + doxygen = fs.readFileSync(path.join(options.directory, compound.refid + '.xml'), 'utf8'); + xmlParser.parseString(doxygen, function (err, data) { + if (err) { + log.verbose('warning - parse error for file' , path.join(options.directory, compound.refid + '.xml')) + return; + } + this.parseCompound(compound, data.doxygen.compounddef[0]); + }.bind(this)); + } + }.bind(this)); }, @@ -490,7 +475,8 @@ module.exports = { return; } this.root.kind = 'index'; - this.parseIndex(this.root, result.doxygenindex.compound, options, callback); + this.parseIndex(this.root, result.doxygenindex.compound, options); + callback(null, this.root); // TODO: return errors properly }.bind(this)); }.bind(this)); } From 9fd565e436e42f7def019aae3987d25641186297 Mon Sep 17 00:00:00 2001 From: PoTa Date: Mon, 24 Sep 2018 04:39:41 +0200 Subject: [PATCH 18/56] Fixing compounds having same name overwriting each other's properties. --- src/compound.js | 9 +++++---- src/parser.js | 10 +++++----- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/compound.js b/src/compound.js index 80f44912..5c0f3698 100644 --- a/src/compound.js +++ b/src/compound.js @@ -8,8 +8,9 @@ var log = require('winston'); -function Compound(parent, name) { +function Compound(parent, id, name) { this.parent = parent; + this.id = id; this.name = name; this.compounds = {}; this.members = []; @@ -19,11 +20,11 @@ function Compound(parent, name) { Compound.prototype = { - find: function (name, create) { - var compound = this.compounds[name]; + find: function (id, name, create) { + var compound = this.compounds[id]; if (!compound && create) { - compound = this.compounds[name] = new Compound(this, name); + compound = this.compounds[id] = new Compound(this, id, name); } return compound; diff --git a/src/parser.js b/src/parser.js index 8bd40136..52e105d0 100644 --- a/src/parser.js +++ b/src/parser.js @@ -285,15 +285,15 @@ module.exports = { // namespaces take ownership of the child compound if (child.parent) - delete child.parent.compounds[child.name]; - compound.compounds[child.name] = child; + delete child.parent.compounds[child.id]; + compound.compounds[child.id] = child; child.parent = compound; }, assignNamespaceToGroup: function (compound, child) { // add the namespace to the group - compound.compounds[child.name] = child; + compound.compounds[child.id] = child; // remove namespace clildren from direct group children Object.keys(child.compounds).forEach(function(id) { @@ -306,7 +306,7 @@ module.exports = { // add the namespace to the group // if the child already belongs to a child namespace it will be removed // on the call to `assignNamespaceToGroup` - compound.compounds[child.name] = child; + compound.compounds[child.id] = child; // add a groupid and reference to the compound and all it's members child.groupid = compound.id; @@ -437,7 +437,7 @@ module.exports = { parseIndex: function (root, index, options) { index.forEach(function (element) { - var doxygen, compound = root.find(element.name[0], true); + var doxygen, compound = root.find(element.$.refid, element.name[0], true); var xmlParser = new xml2js.Parser({ explicitChildren: true, preserveChildrenOrder: true, From 156506110a5e57b1a2c3c7bbf745696ccc644ac9 Mon Sep 17 00:00:00 2001 From: PoTa Date: Mon, 24 Sep 2018 04:42:40 +0200 Subject: [PATCH 19/56] Generate namespace files for `--classes`. --- index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index e9d9fd00..fca68cf6 100644 --- a/index.js +++ b/index.js @@ -94,12 +94,14 @@ module.exports = { }); } else if (options.classes) { - var rootCompounds = root.toArray('compounds'); + var rootCompounds = root.toArray('compounds', 'namespace'); if (!rootCompounds.length) throw "You have enabled `classes` output, but no classes were " + "located in your doxygen XML files." rootCompounds.forEach(function (comp) { - var compounds = comp.toArray(); + comp.filterChildren(options.filters); + var compounds = comp.toFilteredArray(); + helpers.writeCompound(comp, [templates.render(comp)], doxyparser.references, options); compounds.forEach(function (e) { e.filterChildren(options.filters) helpers.writeCompound(e, [templates.render(e)], doxyparser.references, options); From 73630ba6af879be00c297231be136b5bffd381db Mon Sep 17 00:00:00 2001 From: PoTa Date: Mon, 24 Sep 2018 04:44:11 +0200 Subject: [PATCH 20/56] Add support for sections, subsections and subsubsections for pages. --- src/helpers.js | 12 ++++++++++++ src/parser.js | 35 +++++++++++++++++++++++++++++++++++ src/templates.js | 10 +--------- 3 files changed, 48 insertions(+), 9 deletions(-) diff --git a/src/helpers.js b/src/helpers.js index eaf66c6e..8fdf0ea5 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -46,6 +46,18 @@ module.exports = { } }, + getAnchor: function(name, options) { + if (options.anchors) { + return '{#' + name + '}'; + } + else if (options.htmlAnchors) { + return ''; + } + else { + return ''; + } + }, + findParent: function(compound, kinds) { while (compound) { if (kinds.includes(compound.kind)) diff --git a/src/parser.js b/src/parser.js index 52e105d0..1a5a7afc 100644 --- a/src/parser.js +++ b/src/parser.js @@ -76,6 +76,17 @@ function toMarkdown(element, context) { s = trim(s.substring(2, s.length - 2)); return '\n$$\n' + s + '\n$$\n'; + case 'sect1': + case 'sect2': + case 'sect3': + context.push(element); + s = '\n' + helpers.getAnchor(element.$.id, module.exports.parserOptions) + '\n'; + break; + case 'title': + var level = '#'.repeat(context[context.length - 1]['#name'].slice(-1)); + s = '\n#' + level + ' ' + element._ + '\n'; + break; + case 'xreftitle': case 'entry': case 'row': @@ -118,6 +129,12 @@ function toMarkdown(element, context) { case 'listitem': s += '\n'; break; case 'entry': s = ' | '; break; case 'xreftitle': s += ': '; break; + case 'sect1': + case 'sect2': + case 'sect3': + context.pop(); + s += '\n'; + break; case 'row': s = '\n' + markdown.escape.row(s); if (element.$$ && element.$$[0].$.thead == "yes") { @@ -318,6 +335,19 @@ module.exports = { }); }, + extractPageSections: function(page, elements) { + elements.forEach(function(element) { + if (element['#name'] == 'sect1' || element['#name'] == 'sect2' || element['#name'] == 'sect3') { + var id = element.$.id; + var member = { section: element['#name'], id: id, name: id, refid: id, parent: page }; + page.members.push(member); + this.references[member.refid] = member; + } + if (element.$$) + this.extractPageSections(page, element.$$); + }.bind(this)); + }, + parseCompound: function (compound, compounddef) { log.verbose('Processing compound ' + compound.name); Object.keys(compounddef.$).forEach(function(prop) { @@ -392,6 +422,10 @@ module.exports = { // parse add all contained members to the root compound. break; + case 'page': + this.extractPageSections(compound, compounddef.$$); + break; + case 'namespace': case 'group': @@ -462,6 +496,7 @@ module.exports = { }, loadIndex: function (options, callback) { + this.parserOptions = options; log.verbose('Parsing ' + path.join(options.directory, 'index.xml')); fs.readFile(path.join(options.directory, 'index.xml'), 'utf8', function(err, data) { if (err) { diff --git a/src/templates.js b/src/templates.js index e3d69b1a..e87f9097 100644 --- a/src/templates.js +++ b/src/templates.js @@ -87,15 +87,7 @@ module.exports = { // Generate an anchor for internal links handlebars.registerHelper('anchor', function(name) { - if (options.anchors) { - return '{#' + name + '}'; - } - else if (options.htmlAnchors) { - return ''; - } - else { - return ''; - } + return helpers.getAnchor(name, options); }); } }; From d240344b36b36849585016bd894abf3b2a13519e Mon Sep 17 00:00:00 2001 From: PoTa Date: Mon, 24 Sep 2018 04:14:37 +0200 Subject: [PATCH 21/56] Add support for orderedlist, preformatted, mdash, ndash, linebreak. --- src/parser.js | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/parser.js b/src/parser.js index 1a5a7afc..f4cf0b11 100644 --- a/src/parser.js +++ b/src/parser.js @@ -50,8 +50,14 @@ function toMarkdown(element, context) { case 'parameteritem': s = '* '; break; case 'programlisting': s = '\n```cpp\n'; break; + case 'orderedlist': + context.push(element); + s = '\n\n'; + break; case 'itemizedlist': s = '\n\n'; break; - case 'listitem': s = '* '; break; + case 'listitem': + s = (context.length > 0 && context[context.length - 1]['#name'] == 'orderedlist') ? '1. ' : '* '; + break; case 'sp': s = ' '; break; case 'heading': s = '## '; break; case 'xrefsect': s += '\n> '; break; @@ -63,7 +69,7 @@ function toMarkdown(element, context) { s = '\n#### Returns\n' } else if (element.$.kind == 'see') { - s = '\n**See also**: ' + s = '**See also**: ' } else { console.assert(element.$.kind + ' not supported.'); @@ -75,6 +81,7 @@ function toMarkdown(element, context) { if (s.startsWith('\\[') && s.endsWith('\\]')) s = trim(s.substring(2, s.length - 2)); return '\n$$\n' + s + '\n$$\n'; + case 'preformatted': s = '\n
'; break;
 
           case 'sect1':
           case 'sect2':
@@ -87,6 +94,10 @@ function toMarkdown(element, context) {
             s = '\n#' + level + ' ' + element._ + '\n';
             break;
 
+          case 'mdash': s = '—'; break;
+          case 'ndash': s = '–'; break;
+          case 'linebreak': s = '
'; break; + case 'xreftitle': case 'entry': case 'row': @@ -125,10 +136,15 @@ function toMarkdown(element, context) { case 'programlisting': s += '```\n'; break; case 'codeline': s += '\n'; break; case 'ulink': s = markdown.link(s, element.$.url); break; + case 'orderedlist': + context.pop(); + s += '\n'; + break; case 'itemizedlist': s += '\n'; break; case 'listitem': s += '\n'; break; case 'entry': s = ' | '; break; case 'xreftitle': s += ': '; break; + case 'preformatted': s += '
\n'; break; case 'sect1': case 'sect2': case 'sect3': From 8b109342cb67e72d47ecdf03a3db219faa0c498e Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 25 Oct 2018 15:09:21 -0700 Subject: [PATCH 22/56] regenerate and add a page --- example/doc/api-bicycle.md | 12 ++++----- example/doc/api-mountainbike.md | 16 ++++++------ example/doc/api-racingbike.md | 10 ++++---- example/doc/page-md_src_overview.md | 4 +++ example/src/overview.md | 3 +++ example/xml/bicycle_8cpp.xml | 10 ++++---- example/xml/bicycle_8h.xml | 2 +- example/xml/classtransport_1_1Bicycle.xml | 2 +- .../xml/classtransport_1_1MountainBike.xml | 2 +- example/xml/classtransport_1_1RacingBike.xml | 2 +- example/xml/compound.xsd | 18 ++++++++++++- .../dir_68267d1309a1af8e8297ef4c3efbcdba.xml | 2 +- example/xml/group__bicycle.xml | 2 +- example/xml/group__mountainbike.xml | 2 +- example/xml/group__racingbike.xml | 2 +- example/xml/index.xml | 6 ++++- example/xml/md_src_overview.xml | 11 ++++++++ example/xml/mountainbike_8cpp.xml | 18 ++++++------- example/xml/mountainbike_8h.xml | 8 +++--- example/xml/namespacetransport.xml | 2 +- example/xml/overview_8md.xml | 16 ++++++++++++ example/xml/racingbike_8cpp.xml | 20 +++++++-------- example/xml/racingbike_8h.xml | 12 ++++----- example/xml/transport_8h.xml | 25 ++++++++++--------- package.json | 3 ++- 25 files changed, 133 insertions(+), 77 deletions(-) create mode 100644 example/doc/page-md_src_overview.md create mode 100644 example/src/overview.md create mode 100644 example/xml/md_src_overview.xml create mode 100644 example/xml/overview_8md.xml diff --git a/example/doc/api-bicycle.md b/example/doc/api-bicycle.md index 6aaf8830..cbc3c2ff 100644 --- a/example/doc/api-bicycle.md +++ b/example/doc/api-bicycle.md @@ -1,4 +1,4 @@ -# group `bicycle` {#group__bicycle} +# group `bicycle` Bicycle module contains the bycicle class. Bicycles are a useful way of transporting oneself, without too much effort. @@ -6,9 +6,9 @@ Bicycle module contains the bycicle class. Bicycles are a useful way of transpor Members | Descriptions --------------------------------|--------------------------------------------- -`class `[`transport::Bicycle`](example/doc/api-bicycle.md#classtransport_1_1Bicycle) | Standard bicycle class. +`class `[`transport::Bicycle`](#classtransport_1_1Bicycle) | Standard bicycle class. -# class `transport::Bicycle` {#classtransport_1_1Bicycle} +# class `transport::Bicycle` Standard bicycle class. @@ -24,17 +24,17 @@ Standard bicycle class. ## Members -#### `public virtual void `[`PedalHarder`](#classtransport_1_1Bicycle_1a7df6cce8f18012fb07bef5be9dadd8ef)`()` {#classtransport_1_1Bicycle_1a7df6cce8f18012fb07bef5be9dadd8ef} +#### `public virtual void `[`PedalHarder`](#classtransport_1_1Bicycle_1a7df6cce8f18012fb07bef5be9dadd8ef)`()` PedalHarder makes you go faster (usually). -#### `public virtual void `[`RingBell`](#classtransport_1_1Bicycle_1a7d2be572f09c78b4d4ae38ef22f3e98b)`()` {#classtransport_1_1Bicycle_1a7d2be572f09c78b4d4ae38ef22f3e98b} +#### `public virtual void `[`RingBell`](#classtransport_1_1Bicycle_1a7d2be572f09c78b4d4ae38ef22f3e98b)`()` Ring bell on the bike. RingBell rings the bell on the bike. Note that not all bikes have bells. -#### `public virtual `[`~Bicycle`](#classtransport_1_1Bicycle_1a5f62d09b772a7705634bfb3551803c25)`()` {#classtransport_1_1Bicycle_1a5f62d09b772a7705634bfb3551803c25} +#### `public virtual `[`~Bicycle`](#classtransport_1_1Bicycle_1a5f62d09b772a7705634bfb3551803c25)`()` Default destructor. diff --git a/example/doc/api-mountainbike.md b/example/doc/api-mountainbike.md index 22e2adc7..467224a3 100644 --- a/example/doc/api-mountainbike.md +++ b/example/doc/api-mountainbike.md @@ -1,4 +1,4 @@ -# group `mountainbike` {#group__mountainbike} +# group `mountainbike` Mountain bike module contains the `MountainBike` class. Mountain bikes are a kind of bike for cycling on rough terrain. @@ -6,29 +6,29 @@ Mountain bike module contains the `MountainBike` class. Mountain bikes are a kin Members | Descriptions --------------------------------|--------------------------------------------- -`class `[`transport::MountainBike`](example/doc/api-mountainbike.md#classtransport_1_1MountainBike) | Mountain bike implementation of a `[Bicycle](example/doc/api-bicycle.md#classtransport_1_1Bicycle)`. +`class `[`transport::MountainBike`](#classtransport_1_1MountainBike) | Mountain bike implementation of a `[Bicycle](./example/doc/api-bicycle.md#classtransport_1_1Bicycle)`. -# class `transport::MountainBike` {#classtransport_1_1MountainBike} +# class `transport::MountainBike` ``` class transport::MountainBike : public transport::Bicycle ``` -Mountain bike implementation of a `[Bicycle](#classtransport_1_1Bicycle)`. +Mountain bike implementation of a `[Bicycle](./example/doc/api-bicycle.md#classtransport_1_1Bicycle)`. -[MountainBike](#classtransport_1_1MountainBike) is an implementation of a [Bicycle](#classtransport_1_1Bicycle) providing a bike for cycling on rough terrain. Mountain bikes are pretty cool because they have stuff like **Suspension** (and you can even adjust it using SetSuspension). If you're looking for a bike for use on the road, you might be better off using a [RacingBike](#classtransport_1_1RacingBike) though. +[MountainBike](#classtransport_1_1MountainBike) is an implementation of a [Bicycle](./example/doc/api-bicycle.md#classtransport_1_1Bicycle) providing a bike for cycling on rough terrain. Mountain bikes are pretty cool because they have stuff like **Suspension** (and you can even adjust it using SetSuspension). If you're looking for a bike for use on the road, you might be better off using a [RacingBike](./example/doc/api-racingbike.md#classtransport_1_1RacingBike) though. ## Summary Members | Descriptions --------------------------------|--------------------------------------------- `public bool `[`SetSuspension`](#classtransport_1_1MountainBike_1a04caecd7e5ff7572b6ac1dc283510301)`(double stiffness)` | Set suspension stiffness. the suspension stiffness. -`public template`
`inline bool `[`ChangeBreak`](#classtransport_1_1MountainBike_1afd02513876a196e98acaacdc555aeb52)`(BreakType breakType)` | Change the break type. the break type. the type of the break. +`public template<>`
`inline bool `[`ChangeBreak`](#classtransport_1_1MountainBike_1afd02513876a196e98acaacdc555aeb52)`(BreakType breakType)` | Change the break type. the break type. the type of the break. ## Members -#### `public bool `[`SetSuspension`](#classtransport_1_1MountainBike_1a04caecd7e5ff7572b6ac1dc283510301)`(double stiffness)` {#classtransport_1_1MountainBike_1a04caecd7e5ff7572b6ac1dc283510301} +#### `public bool `[`SetSuspension`](#classtransport_1_1MountainBike_1a04caecd7e5ff7572b6ac1dc283510301)`(double stiffness)` Set suspension stiffness. the suspension stiffness. @@ -37,7 +37,7 @@ SetSuspension changes the stiffness of the suspension on the bike. The method wi #### Returns true if the suspension was adjusted successfully, false otherwise. -#### `public template`
`inline bool `[`ChangeBreak`](#classtransport_1_1MountainBike_1afd02513876a196e98acaacdc555aeb52)`(BreakType breakType)` {#classtransport_1_1MountainBike_1afd02513876a196e98acaacdc555aeb52} +#### `public template<>`
`inline bool `[`ChangeBreak`](#classtransport_1_1MountainBike_1afd02513876a196e98acaacdc555aeb52)`(BreakType breakType)` Change the break type. the break type. the type of the break. diff --git a/example/doc/api-racingbike.md b/example/doc/api-racingbike.md index a9ae08f2..439c91cf 100644 --- a/example/doc/api-racingbike.md +++ b/example/doc/api-racingbike.md @@ -1,4 +1,4 @@ -# group `racingbike` {#group__racingbike} +# group `racingbike` Racing bike module contains the `RacingBike` class. Racing bikes are a special kind of bike which can go much faster on the road, with much less effort. @@ -6,9 +6,9 @@ Racing bike module contains the `RacingBike` class. Racing bikes are a special k Members | Descriptions --------------------------------|--------------------------------------------- -`class `[`transport::RacingBike`](example/doc/api-racingbike.md#classtransport_1_1RacingBike) | Racing bike class. +`class `[`transport::RacingBike`](#classtransport_1_1RacingBike) | Racing bike class. -# class `transport::RacingBike` {#classtransport_1_1RacingBike} +# class `transport::RacingBike` ``` class transport::RacingBike @@ -28,11 +28,11 @@ Racing bike class. ## Members -#### `public virtual void `[`PedalHarder`](#classtransport_1_1RacingBike_1ab557c5727daa07a5001782d5dcd46c5b)`()` {#classtransport_1_1RacingBike_1ab557c5727daa07a5001782d5dcd46c5b} +#### `public virtual void `[`PedalHarder`](#classtransport_1_1RacingBike_1ab557c5727daa07a5001782d5dcd46c5b)`()` PedalHarder makes you go faster (usually). -#### `public virtual void `[`RingBell`](#classtransport_1_1RacingBike_1ad32dc3b06a453fba3e20329842bb318b)`()` {#classtransport_1_1RacingBike_1ad32dc3b06a453fba3e20329842bb318b} +#### `public virtual void `[`RingBell`](#classtransport_1_1RacingBike_1ad32dc3b06a453fba3e20329842bb318b)`()` Ring bell on the bike. diff --git a/example/doc/page-md_src_overview.md b/example/doc/page-md_src_overview.md new file mode 100644 index 00000000..31d31df8 --- /dev/null +++ b/example/doc/page-md_src_overview.md @@ -0,0 +1,4 @@ +# page `md_src_overview` + +This is an overview of Transport::Bicycle, the greatest new CPP program. + diff --git a/example/src/overview.md b/example/src/overview.md new file mode 100644 index 00000000..a46a1580 --- /dev/null +++ b/example/src/overview.md @@ -0,0 +1,3 @@ +# Overview + +This is an overview of `transport::Bicycle`, the greatest new CPP program. \ No newline at end of file diff --git a/example/xml/bicycle_8cpp.xml b/example/xml/bicycle_8cpp.xml index 5ec02e39..55561e22 100644 --- a/example/xml/bicycle_8cpp.xml +++ b/example/xml/bicycle_8cpp.xml @@ -1,19 +1,19 @@ - + bicycle.cpp bicycle.h + + + + - - - - diff --git a/example/xml/bicycle_8h.xml b/example/xml/bicycle_8h.xml index d3ab5a06..387f82fa 100644 --- a/example/xml/bicycle_8h.xml +++ b/example/xml/bicycle_8h.xml @@ -1,5 +1,5 @@ - + bicycle.h src/bicycle.cpp diff --git a/example/xml/classtransport_1_1Bicycle.xml b/example/xml/classtransport_1_1Bicycle.xml index 617a94ae..da039342 100644 --- a/example/xml/classtransport_1_1Bicycle.xml +++ b/example/xml/classtransport_1_1Bicycle.xml @@ -1,5 +1,5 @@ - + transport::Bicycle transport::MountainBike diff --git a/example/xml/classtransport_1_1MountainBike.xml b/example/xml/classtransport_1_1MountainBike.xml index 7b3de1ce..1b2a8869 100644 --- a/example/xml/classtransport_1_1MountainBike.xml +++ b/example/xml/classtransport_1_1MountainBike.xml @@ -1,5 +1,5 @@ - + transport::MountainBike transport::Bicycle diff --git a/example/xml/classtransport_1_1RacingBike.xml b/example/xml/classtransport_1_1RacingBike.xml index b38c5f8f..60286c22 100644 --- a/example/xml/classtransport_1_1RacingBike.xml +++ b/example/xml/classtransport_1_1RacingBike.xml @@ -1,5 +1,5 @@ - + transport::RacingBike transport::Bicycle diff --git a/example/xml/compound.xsd b/example/xml/compound.xsd index 223f7192..81b5e513 100644 --- a/example/xml/compound.xsd +++ b/example/xml/compound.xsd @@ -29,6 +29,7 @@ + @@ -146,9 +147,11 @@ + + @@ -263,6 +266,7 @@ + @@ -277,12 +281,16 @@ - + + + + + @@ -937,6 +945,13 @@ + + + + + + + @@ -952,6 +967,7 @@ + diff --git a/example/xml/dir_68267d1309a1af8e8297ef4c3efbcdba.xml b/example/xml/dir_68267d1309a1af8e8297ef4c3efbcdba.xml index 853925e8..298a4fe2 100644 --- a/example/xml/dir_68267d1309a1af8e8297ef4c3efbcdba.xml +++ b/example/xml/dir_68267d1309a1af8e8297ef4c3efbcdba.xml @@ -1,5 +1,5 @@ - + src bicycle.cpp diff --git a/example/xml/group__bicycle.xml b/example/xml/group__bicycle.xml index b02bf6f3..c7126515 100644 --- a/example/xml/group__bicycle.xml +++ b/example/xml/group__bicycle.xml @@ -1,5 +1,5 @@ - + bicycle Bycicle module diff --git a/example/xml/group__mountainbike.xml b/example/xml/group__mountainbike.xml index 622ae7c3..ef17ce7f 100644 --- a/example/xml/group__mountainbike.xml +++ b/example/xml/group__mountainbike.xml @@ -1,5 +1,5 @@ - + mountainbike Mountain bike module diff --git a/example/xml/group__racingbike.xml b/example/xml/group__racingbike.xml index 0b924fd8..2280b78b 100644 --- a/example/xml/group__racingbike.xml +++ b/example/xml/group__racingbike.xml @@ -1,5 +1,5 @@ - + racingbike Racing bike module diff --git a/example/xml/index.xml b/example/xml/index.xml index 81ea73ff..5dda8d3d 100644 --- a/example/xml/index.xml +++ b/example/xml/index.xml @@ -1,5 +1,5 @@ - + transport::Bicycle PedalHarder RingBell @@ -23,6 +23,8 @@ mountainbike.h + overview.md + racingbike.cpp racingbike.h @@ -40,6 +42,8 @@ mountainbike + md_src_overview + src diff --git a/example/xml/md_src_overview.xml b/example/xml/md_src_overview.xml new file mode 100644 index 00000000..99a05814 --- /dev/null +++ b/example/xml/md_src_overview.xml @@ -0,0 +1,11 @@ + + + + md_src_overview + Overview + + + +This is an overview of transport::Bicycle, the greatest new CPP program. + + diff --git a/example/xml/mountainbike_8cpp.xml b/example/xml/mountainbike_8cpp.xml index 784b86ca..c85f2f31 100644 --- a/example/xml/mountainbike_8cpp.xml +++ b/example/xml/mountainbike_8cpp.xml @@ -1,22 +1,22 @@ - + mountainbike.cpp mountainbike.h - - - - + + + + - - - - + + + + diff --git a/example/xml/mountainbike_8h.xml b/example/xml/mountainbike_8h.xml index 1a9caeb2..5f251e88 100644 --- a/example/xml/mountainbike_8h.xml +++ b/example/xml/mountainbike_8h.xml @@ -1,19 +1,19 @@ - + mountainbike.h transport/bicycle.h src/mountainbike.cpp - - - + + + transport::MountainBike transport diff --git a/example/xml/namespacetransport.xml b/example/xml/namespacetransport.xml index c0a82f88..75424705 100644 --- a/example/xml/namespacetransport.xml +++ b/example/xml/namespacetransport.xml @@ -1,5 +1,5 @@ - + transport transport::Bicycle diff --git a/example/xml/overview_8md.xml b/example/xml/overview_8md.xml new file mode 100644 index 00000000..8e28e0e2 --- /dev/null +++ b/example/xml/overview_8md.xml @@ -0,0 +1,16 @@ + + + + overview.md + + + + + +#Overview + +Thisisanoverviewof`transport::Bicycle`,thegreatestnewCPPprogram. + + + + diff --git a/example/xml/racingbike_8cpp.xml b/example/xml/racingbike_8cpp.xml index f69f88b9..65e88dd4 100644 --- a/example/xml/racingbike_8cpp.xml +++ b/example/xml/racingbike_8cpp.xml @@ -1,22 +1,22 @@ - + racingbike.cpp racingbike.h - - - - - - - + - + - + + + + + + + diff --git a/example/xml/racingbike_8h.xml b/example/xml/racingbike_8h.xml index bb99cc43..d52dbbd6 100644 --- a/example/xml/racingbike_8h.xml +++ b/example/xml/racingbike_8h.xml @@ -1,19 +1,19 @@ - + racingbike.h transport/bicycle.h src/racingbike.cpp - + + + + - + - - - transport::RacingBike transport diff --git a/example/xml/transport_8h.xml b/example/xml/transport_8h.xml index 32641ca8..96014b38 100644 --- a/example/xml/transport_8h.xml +++ b/example/xml/transport_8h.xml @@ -1,28 +1,28 @@ - + transport.h transport/bicycle.h transport/racingbike.h transport/mountainbike.h - + + + + + + + - + - + - + - - - - - - @@ -40,7 +40,8 @@ - + + TransportType Bycicle diff --git a/package.json b/package.json index 70734661..845f2192 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "description": "Doxygen XML to Markdown documentation converter", "main": "index.js", "scripts": { - "release": "release-it" + "release": "release-it", + "test": "node bin/moxygen.js example/xml -o ./example/doc/api-%s.md --groups --pages" }, "bin": { "moxygen": "./bin/moxygen.js" From e0569e36f56f8f88cce827857b36871f5c431482 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 25 Oct 2018 15:10:16 -0700 Subject: [PATCH 23/56] run doxygen on build --- example/doc/page-md_src_overview.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/example/doc/page-md_src_overview.md b/example/doc/page-md_src_overview.md index 31d31df8..cb937a23 100644 --- a/example/doc/page-md_src_overview.md +++ b/example/doc/page-md_src_overview.md @@ -1,4 +1,4 @@ # page `md_src_overview` -This is an overview of Transport::Bicycle, the greatest new CPP program. +This is an overview of `[transport::Bicycle](./example/doc/api-bicycle.md#classtransport_1_1Bicycle)`, the greatest new CPP program. diff --git a/package.json b/package.json index 845f2192..e7ed5755 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "release": "release-it", - "test": "node bin/moxygen.js example/xml -o ./example/doc/api-%s.md --groups --pages" + "test": "cd example/ && doxygen && cd .. && node bin/moxygen.js example/xml -o ./example/doc/api-%s.md --groups --pages" }, "bin": { "moxygen": "./bin/moxygen.js" From fcefea240d06ad02218047360455fc7e16df9495 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 25 Oct 2018 15:14:54 -0700 Subject: [PATCH 24/56] multiple pages --- example/doc/page-md_src_history.md | 10 ++++++++++ example/doc/page-md_src_overview.md | 4 ++++ example/src/history.md | 7 +++++++ example/src/overview.md | 8 ++++++-- example/xml/history_8md.xml | 20 ++++++++++++++++++++ example/xml/index.xml | 4 ++++ example/xml/md_src_history.xml | 17 +++++++++++++++++ example/xml/md_src_overview.xml | 5 +++-- example/xml/mountainbike_8cpp.xml | 10 +++++----- example/xml/mountainbike_8h.xml | 6 +++--- example/xml/overview_8md.xml | 6 +++++- example/xml/racingbike_8cpp.xml | 10 +++++----- example/xml/racingbike_8h.xml | 6 +++--- example/xml/transport_8h.xml | 14 +++++++------- 14 files changed, 99 insertions(+), 28 deletions(-) create mode 100644 example/doc/page-md_src_history.md create mode 100644 example/src/history.md create mode 100644 example/xml/history_8md.xml create mode 100644 example/xml/md_src_history.xml diff --git a/example/doc/page-md_src_history.md b/example/doc/page-md_src_history.md new file mode 100644 index 00000000..59b853ae --- /dev/null +++ b/example/doc/page-md_src_history.md @@ -0,0 +1,10 @@ +# page `md_src_history` + +## Version 1.0.1 + +* Pedalling harder no longer stands in the saddle by default. This is just better form. + +## Version 1.0.0 + +* Initial release + diff --git a/example/doc/page-md_src_overview.md b/example/doc/page-md_src_overview.md index cb937a23..9f7fcfae 100644 --- a/example/doc/page-md_src_overview.md +++ b/example/doc/page-md_src_overview.md @@ -2,3 +2,7 @@ This is an overview of `[transport::Bicycle](./example/doc/api-bicycle.md#classtransport_1_1Bicycle)`, the greatest new CPP program. +## Changelog + +See ./history.md "history". + diff --git a/example/src/history.md b/example/src/history.md new file mode 100644 index 00000000..b1225172 --- /dev/null +++ b/example/src/history.md @@ -0,0 +1,7 @@ +# Changelog + +## Version 1.0.1 +- Pedalling harder no longer stands in the saddle by default. This is just better form. + +## Version 1.0.0 +- Initial release \ No newline at end of file diff --git a/example/src/overview.md b/example/src/overview.md index a46a1580..10b991c7 100644 --- a/example/src/overview.md +++ b/example/src/overview.md @@ -1,3 +1,7 @@ -# Overview +# Transport -This is an overview of `transport::Bicycle`, the greatest new CPP program. \ No newline at end of file +This is an overview of `transport::Bicycle`, the greatest new CPP program. + +## Changelog + +See [history](history.md). \ No newline at end of file diff --git a/example/xml/history_8md.xml b/example/xml/history_8md.xml new file mode 100644 index 00000000..3f2a7cb3 --- /dev/null +++ b/example/xml/history_8md.xml @@ -0,0 +1,20 @@ + + + + history.md + + + + + +#Changelog + +##Version1.0.1 +-Pedallinghardernolongerstandsinthesaddlebydefault.Thisisjustbetterform. + +##Version1.0.0 +-Initialrelease + + + + diff --git a/example/xml/index.xml b/example/xml/index.xml index 5dda8d3d..249672c2 100644 --- a/example/xml/index.xml +++ b/example/xml/index.xml @@ -19,6 +19,8 @@ bicycle.h + history.md + mountainbike.cpp mountainbike.h @@ -42,6 +44,8 @@ mountainbike + md_src_history + md_src_overview src diff --git a/example/xml/md_src_history.xml b/example/xml/md_src_history.xml new file mode 100644 index 00000000..e1706a0b --- /dev/null +++ b/example/xml/md_src_history.xml @@ -0,0 +1,17 @@ + + + + md_src_history + Changelog + + + +Version 1.0.1 + +Pedalling harder no longer stands in the saddle by default. This is just better form. +Version 1.0.0 + +Initial release + + + diff --git a/example/xml/md_src_overview.xml b/example/xml/md_src_overview.xml index 99a05814..636d7875 100644 --- a/example/xml/md_src_overview.xml +++ b/example/xml/md_src_overview.xml @@ -2,10 +2,11 @@ md_src_overview - Overview + Transport -This is an overview of transport::Bicycle, the greatest new CPP program. +This is an overview of transport::Bicycle, the greatest new CPP program.Changelog +See ./history.md "history". diff --git a/example/xml/mountainbike_8cpp.xml b/example/xml/mountainbike_8cpp.xml index c85f2f31..7b08c21e 100644 --- a/example/xml/mountainbike_8cpp.xml +++ b/example/xml/mountainbike_8cpp.xml @@ -4,19 +4,19 @@ mountainbike.cpp mountainbike.h - + - + - + - + - + diff --git a/example/xml/mountainbike_8h.xml b/example/xml/mountainbike_8h.xml index 5f251e88..7164ee21 100644 --- a/example/xml/mountainbike_8h.xml +++ b/example/xml/mountainbike_8h.xml @@ -5,13 +5,13 @@ transport/bicycle.h src/mountainbike.cpp - + - + - + diff --git a/example/xml/overview_8md.xml b/example/xml/overview_8md.xml index 8e28e0e2..0dca8f56 100644 --- a/example/xml/overview_8md.xml +++ b/example/xml/overview_8md.xml @@ -7,9 +7,13 @@ -#Overview +#Transport Thisisanoverviewof`transport::Bicycle`,thegreatestnewCPPprogram. + +##Changelog + +See[history](./history.md). diff --git a/example/xml/racingbike_8cpp.xml b/example/xml/racingbike_8cpp.xml index 65e88dd4..46a1f4d7 100644 --- a/example/xml/racingbike_8cpp.xml +++ b/example/xml/racingbike_8cpp.xml @@ -4,19 +4,19 @@ racingbike.cpp racingbike.h - + - + - + - + - + diff --git a/example/xml/racingbike_8h.xml b/example/xml/racingbike_8h.xml index d52dbbd6..208a583c 100644 --- a/example/xml/racingbike_8h.xml +++ b/example/xml/racingbike_8h.xml @@ -5,13 +5,13 @@ transport/bicycle.h src/racingbike.cpp - + - + - + diff --git a/example/xml/transport_8h.xml b/example/xml/transport_8h.xml index 96014b38..e65a5ba0 100644 --- a/example/xml/transport_8h.xml +++ b/example/xml/transport_8h.xml @@ -6,23 +6,23 @@ transport/racingbike.h transport/mountainbike.h - + - + - + - + - + - + - + From 757aedff8694384bbbea037c40a2f327689e52c3 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 25 Oct 2018 15:23:07 -0700 Subject: [PATCH 25/56] generate proper relative links --- example/doc/api-bicycle.md | 12 ++++++------ example/doc/api-mountainbike.md | 14 +++++++------- example/doc/api-racingbike.md | 8 ++++---- example/doc/page-md_src_history.md | 2 +- example/doc/page-md_src_overview.md | 6 +++--- example/src/overview.md | 2 +- example/src/transport.h | 2 +- example/xml/group__bicycle.xml | 2 +- example/xml/md_src_overview.xml | 4 ++-- example/xml/overview_8md.xml | 4 ++-- package.json | 2 +- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/example/doc/api-bicycle.md b/example/doc/api-bicycle.md index cbc3c2ff..41986251 100644 --- a/example/doc/api-bicycle.md +++ b/example/doc/api-bicycle.md @@ -1,6 +1,6 @@ -# group `bicycle` +# group `bicycle` {#group__bicycle} -Bicycle module contains the bycicle class. Bicycles are a useful way of transporting oneself, without too much effort. +Bicycle module contains the bicycle class. Bicycles are a useful way of transporting oneself, without too much effort. ## Summary @@ -8,7 +8,7 @@ Bicycle module contains the bycicle class. Bicycles are a useful way of transpor --------------------------------|--------------------------------------------- `class `[`transport::Bicycle`](#classtransport_1_1Bicycle) | Standard bicycle class. -# class `transport::Bicycle` +# class `transport::Bicycle` {#classtransport_1_1Bicycle} Standard bicycle class. @@ -24,17 +24,17 @@ Standard bicycle class. ## Members -#### `public virtual void `[`PedalHarder`](#classtransport_1_1Bicycle_1a7df6cce8f18012fb07bef5be9dadd8ef)`()` +#### `public virtual void `[`PedalHarder`](#classtransport_1_1Bicycle_1a7df6cce8f18012fb07bef5be9dadd8ef)`()` {#classtransport_1_1Bicycle_1a7df6cce8f18012fb07bef5be9dadd8ef} PedalHarder makes you go faster (usually). -#### `public virtual void `[`RingBell`](#classtransport_1_1Bicycle_1a7d2be572f09c78b4d4ae38ef22f3e98b)`()` +#### `public virtual void `[`RingBell`](#classtransport_1_1Bicycle_1a7d2be572f09c78b4d4ae38ef22f3e98b)`()` {#classtransport_1_1Bicycle_1a7d2be572f09c78b4d4ae38ef22f3e98b} Ring bell on the bike. RingBell rings the bell on the bike. Note that not all bikes have bells. -#### `public virtual `[`~Bicycle`](#classtransport_1_1Bicycle_1a5f62d09b772a7705634bfb3551803c25)`()` +#### `public virtual `[`~Bicycle`](#classtransport_1_1Bicycle_1a5f62d09b772a7705634bfb3551803c25)`()` {#classtransport_1_1Bicycle_1a5f62d09b772a7705634bfb3551803c25} Default destructor. diff --git a/example/doc/api-mountainbike.md b/example/doc/api-mountainbike.md index 467224a3..cb237c2e 100644 --- a/example/doc/api-mountainbike.md +++ b/example/doc/api-mountainbike.md @@ -1,4 +1,4 @@ -# group `mountainbike` +# group `mountainbike` {#group__mountainbike} Mountain bike module contains the `MountainBike` class. Mountain bikes are a kind of bike for cycling on rough terrain. @@ -6,18 +6,18 @@ Mountain bike module contains the `MountainBike` class. Mountain bikes are a kin Members | Descriptions --------------------------------|--------------------------------------------- -`class `[`transport::MountainBike`](#classtransport_1_1MountainBike) | Mountain bike implementation of a `[Bicycle](./example/doc/api-bicycle.md#classtransport_1_1Bicycle)`. +`class `[`transport::MountainBike`](#classtransport_1_1MountainBike) | Mountain bike implementation of a `[Bicycle](./api-bicycle.md#classtransport_1_1Bicycle)`. -# class `transport::MountainBike` +# class `transport::MountainBike` {#classtransport_1_1MountainBike} ``` class transport::MountainBike : public transport::Bicycle ``` -Mountain bike implementation of a `[Bicycle](./example/doc/api-bicycle.md#classtransport_1_1Bicycle)`. +Mountain bike implementation of a `[Bicycle](./api-bicycle.md#classtransport_1_1Bicycle)`. -[MountainBike](#classtransport_1_1MountainBike) is an implementation of a [Bicycle](./example/doc/api-bicycle.md#classtransport_1_1Bicycle) providing a bike for cycling on rough terrain. Mountain bikes are pretty cool because they have stuff like **Suspension** (and you can even adjust it using SetSuspension). If you're looking for a bike for use on the road, you might be better off using a [RacingBike](./example/doc/api-racingbike.md#classtransport_1_1RacingBike) though. +[MountainBike](#classtransport_1_1MountainBike) is an implementation of a [Bicycle](./api-bicycle.md#classtransport_1_1Bicycle) providing a bike for cycling on rough terrain. Mountain bikes are pretty cool because they have stuff like **Suspension** (and you can even adjust it using SetSuspension). If you're looking for a bike for use on the road, you might be better off using a [RacingBike](./api-racingbike.md#classtransport_1_1RacingBike) though. ## Summary @@ -28,7 +28,7 @@ Mountain bike implementation of a `[Bicycle](./example/doc/api-bicycle.md#classt ## Members -#### `public bool `[`SetSuspension`](#classtransport_1_1MountainBike_1a04caecd7e5ff7572b6ac1dc283510301)`(double stiffness)` +#### `public bool `[`SetSuspension`](#classtransport_1_1MountainBike_1a04caecd7e5ff7572b6ac1dc283510301)`(double stiffness)` {#classtransport_1_1MountainBike_1a04caecd7e5ff7572b6ac1dc283510301} Set suspension stiffness. the suspension stiffness. @@ -37,7 +37,7 @@ SetSuspension changes the stiffness of the suspension on the bike. The method wi #### Returns true if the suspension was adjusted successfully, false otherwise. -#### `public template<>`
`inline bool `[`ChangeBreak`](#classtransport_1_1MountainBike_1afd02513876a196e98acaacdc555aeb52)`(BreakType breakType)` +#### `public template<>`
`inline bool `[`ChangeBreak`](#classtransport_1_1MountainBike_1afd02513876a196e98acaacdc555aeb52)`(BreakType breakType)` {#classtransport_1_1MountainBike_1afd02513876a196e98acaacdc555aeb52} Change the break type. the break type. the type of the break. diff --git a/example/doc/api-racingbike.md b/example/doc/api-racingbike.md index 439c91cf..a8674a8d 100644 --- a/example/doc/api-racingbike.md +++ b/example/doc/api-racingbike.md @@ -1,4 +1,4 @@ -# group `racingbike` +# group `racingbike` {#group__racingbike} Racing bike module contains the `RacingBike` class. Racing bikes are a special kind of bike which can go much faster on the road, with much less effort. @@ -8,7 +8,7 @@ Racing bike module contains the `RacingBike` class. Racing bikes are a special k --------------------------------|--------------------------------------------- `class `[`transport::RacingBike`](#classtransport_1_1RacingBike) | Racing bike class. -# class `transport::RacingBike` +# class `transport::RacingBike` {#classtransport_1_1RacingBike} ``` class transport::RacingBike @@ -28,11 +28,11 @@ Racing bike class. ## Members -#### `public virtual void `[`PedalHarder`](#classtransport_1_1RacingBike_1ab557c5727daa07a5001782d5dcd46c5b)`()` +#### `public virtual void `[`PedalHarder`](#classtransport_1_1RacingBike_1ab557c5727daa07a5001782d5dcd46c5b)`()` {#classtransport_1_1RacingBike_1ab557c5727daa07a5001782d5dcd46c5b} PedalHarder makes you go faster (usually). -#### `public virtual void `[`RingBell`](#classtransport_1_1RacingBike_1ad32dc3b06a453fba3e20329842bb318b)`()` +#### `public virtual void `[`RingBell`](#classtransport_1_1RacingBike_1ad32dc3b06a453fba3e20329842bb318b)`()` {#classtransport_1_1RacingBike_1ad32dc3b06a453fba3e20329842bb318b} Ring bell on the bike. diff --git a/example/doc/page-md_src_history.md b/example/doc/page-md_src_history.md index 59b853ae..1f55218f 100644 --- a/example/doc/page-md_src_history.md +++ b/example/doc/page-md_src_history.md @@ -1,4 +1,4 @@ -# page `md_src_history` +# page `md_src_history` {#md_src_history} ## Version 1.0.1 diff --git a/example/doc/page-md_src_overview.md b/example/doc/page-md_src_overview.md index 9f7fcfae..6053828a 100644 --- a/example/doc/page-md_src_overview.md +++ b/example/doc/page-md_src_overview.md @@ -1,8 +1,8 @@ -# page `md_src_overview` +# page `md_src_overview` {#md_src_overview} -This is an overview of `[transport::Bicycle](./example/doc/api-bicycle.md#classtransport_1_1Bicycle)`, the greatest new CPP program. +The `transport` namespace provides several differnt types of bycicles, including [transport::Bicycle](./api-bicycle.md#classtransport_1_1Bicycle), [transport::MountainBike](./api-mountainbike.md#classtransport_1_1MountainBike) (designed for rough terrain), and [transport::RacingBike](./api-racingbike.md#classtransport_1_1RacingBike) (designed specifically for challenging races). ## Changelog -See ./history.md "history". +See history. diff --git a/example/src/overview.md b/example/src/overview.md index 10b991c7..62ca7c5f 100644 --- a/example/src/overview.md +++ b/example/src/overview.md @@ -1,6 +1,6 @@ # Transport -This is an overview of `transport::Bicycle`, the greatest new CPP program. +The `transport` namespace provides several differnt types of bycicles, including transport::Bicycle, transport::MountainBike (designed for rough terrain), and transport::RacingBike (designed specifically for challenging races). ## Changelog diff --git a/example/src/transport.h b/example/src/transport.h index 231fe2e4..4e704aa2 100644 --- a/example/src/transport.h +++ b/example/src/transport.h @@ -3,7 +3,7 @@ /** @defgroup bicycle Bycicle module * - * Bicycle module contains the bycicle class. Bicycles are a useful way of + * Bicycle module contains the bicycle class. Bicycles are a useful way of * transporting oneself, without too much effort. */ diff --git a/example/xml/group__bicycle.xml b/example/xml/group__bicycle.xml index c7126515..5ac35668 100644 --- a/example/xml/group__bicycle.xml +++ b/example/xml/group__bicycle.xml @@ -7,6 +7,6 @@ -Bicycle module contains the bycicle class. Bicycles are a useful way of transporting oneself, without too much effort. +Bicycle module contains the bicycle class. Bicycles are a useful way of transporting oneself, without too much effort.
diff --git a/example/xml/md_src_overview.xml b/example/xml/md_src_overview.xml index 636d7875..d25f5b86 100644 --- a/example/xml/md_src_overview.xml +++ b/example/xml/md_src_overview.xml @@ -6,7 +6,7 @@ -This is an overview of transport::Bicycle, the greatest new CPP program.Changelog -See ./history.md "history". +The transport namespace provides several differnt types of bycicles, including transport::Bicycle, transport::MountainBike (designed for rough terrain), and transport::RacingBike (designed specifically for challenging races).Changelog +See history.
diff --git a/example/xml/overview_8md.xml b/example/xml/overview_8md.xml index 0dca8f56..eb2f6685 100644 --- a/example/xml/overview_8md.xml +++ b/example/xml/overview_8md.xml @@ -9,11 +9,11 @@ #Transport -Thisisanoverviewof`transport::Bicycle`,thegreatestnewCPPprogram. +The`transport`namespaceprovidesseveraldiffernttypesofbycicles,includingtransport::Bicycle,transport::MountainBike(designedforroughterrain),andtransport::RacingBike(designedspecificallyforchallengingraces). ##Changelog -See[history](./history.md). +See[history](history.md).
diff --git a/package.json b/package.json index e7ed5755..99fdb89e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "release": "release-it", - "test": "cd example/ && doxygen && cd .. && node bin/moxygen.js example/xml -o ./example/doc/api-%s.md --groups --pages" + "test": "cd example/ && doxygen && cd doc/ && node ../../bin/moxygen.js ../xml -o ./api-%s.md --groups --pages --anchors" }, "bin": { "moxygen": "./bin/moxygen.js" From 2459dd2e26f173ab38358eaae988675532df6387 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 25 Oct 2018 15:32:17 -0700 Subject: [PATCH 26/56] update README and generate invalid links --- README.md | 19 ++++++++++++++++--- example/doc/api-mountainbike.md | 6 +++--- example/doc/page-md_src_overview.md | 2 +- package.json | 2 +- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index c00c5774..4911a66f 100644 --- a/README.md +++ b/README.md @@ -54,10 +54,23 @@ To get a feel for how Moxygen works you can play with the example which is locat * Pre-generated XML output in [example/xml](/example/xml) * Pre-generated output Markdown files in [example/doc](/example/doc) -The rebuild the example XML you can run `doxygen` from within the example folder. +To fully build the example, follow these steps (once you've installed `doxygen`. See **Development & Contribution**, below): -Now you can build the example documentation with the following command from within the example folder: +1. Rebuild the XML: run `doxygen` from within the example folder. +2. Rebuild the Moxygen output: from within this directory, ``` -moxygen --anchors --groups --output=example/doc/api-%s.md example/xml +node bin/moxygen.js --groups --pages --anchors --output=example/doc/api-%s.md example/xml ``` + +## Development & Contribution + +You can develop this project as you would any other Node project: + +1. Clone this repo. +2. `npm install` from this directory. + +This project is tested through integration, by building the `example/`. To quickly test this project: + +1. Install `doxygen` (`brew install doxygen`, `choco install doxygen`, for example). Only must be done once per computer. +2. `npm test` from this directory. This will run Doxygen on the `example/` and build the output. diff --git a/example/doc/api-mountainbike.md b/example/doc/api-mountainbike.md index cb237c2e..c052c0c1 100644 --- a/example/doc/api-mountainbike.md +++ b/example/doc/api-mountainbike.md @@ -6,7 +6,7 @@ Mountain bike module contains the `MountainBike` class. Mountain bikes are a kin Members | Descriptions --------------------------------|--------------------------------------------- -`class `[`transport::MountainBike`](#classtransport_1_1MountainBike) | Mountain bike implementation of a `[Bicycle](./api-bicycle.md#classtransport_1_1Bicycle)`. +`class `[`transport::MountainBike`](#classtransport_1_1MountainBike) | Mountain bike implementation of a `[Bicycle](example/doc/api-bicycle.md#classtransport_1_1Bicycle)`. # class `transport::MountainBike` {#classtransport_1_1MountainBike} @@ -15,9 +15,9 @@ class transport::MountainBike : public transport::Bicycle ``` -Mountain bike implementation of a `[Bicycle](./api-bicycle.md#classtransport_1_1Bicycle)`. +Mountain bike implementation of a `[Bicycle](example/doc/api-bicycle.md#classtransport_1_1Bicycle)`. -[MountainBike](#classtransport_1_1MountainBike) is an implementation of a [Bicycle](./api-bicycle.md#classtransport_1_1Bicycle) providing a bike for cycling on rough terrain. Mountain bikes are pretty cool because they have stuff like **Suspension** (and you can even adjust it using SetSuspension). If you're looking for a bike for use on the road, you might be better off using a [RacingBike](./api-racingbike.md#classtransport_1_1RacingBike) though. +[MountainBike](#classtransport_1_1MountainBike) is an implementation of a [Bicycle](example/doc/api-bicycle.md#classtransport_1_1Bicycle) providing a bike for cycling on rough terrain. Mountain bikes are pretty cool because they have stuff like **Suspension** (and you can even adjust it using SetSuspension). If you're looking for a bike for use on the road, you might be better off using a [RacingBike](example/doc/api-racingbike.md#classtransport_1_1RacingBike) though. ## Summary diff --git a/example/doc/page-md_src_overview.md b/example/doc/page-md_src_overview.md index 6053828a..dc7ec70e 100644 --- a/example/doc/page-md_src_overview.md +++ b/example/doc/page-md_src_overview.md @@ -1,6 +1,6 @@ # page `md_src_overview` {#md_src_overview} -The `transport` namespace provides several differnt types of bycicles, including [transport::Bicycle](./api-bicycle.md#classtransport_1_1Bicycle), [transport::MountainBike](./api-mountainbike.md#classtransport_1_1MountainBike) (designed for rough terrain), and [transport::RacingBike](./api-racingbike.md#classtransport_1_1RacingBike) (designed specifically for challenging races). +The `transport` namespace provides several differnt types of bycicles, including [transport::Bicycle](example/doc/api-bicycle.md#classtransport_1_1Bicycle), [transport::MountainBike](example/doc/api-mountainbike.md#classtransport_1_1MountainBike) (designed for rough terrain), and [transport::RacingBike](example/doc/api-racingbike.md#classtransport_1_1RacingBike) (designed specifically for challenging races). ## Changelog diff --git a/package.json b/package.json index 99fdb89e..d029bfdc 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "release": "release-it", - "test": "cd example/ && doxygen && cd doc/ && node ../../bin/moxygen.js ../xml -o ./api-%s.md --groups --pages --anchors" + "test": "cd example/ && doxygen && cd .. && node bin/moxygen.js --groups --pages --anchors --output=example/doc/api-%s.md example/xml" }, "bin": { "moxygen": "./bin/moxygen.js" From e72367a000c93a525d528bb1d72a56000da2ac76 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 25 Oct 2018 15:53:26 -0700 Subject: [PATCH 27/56] clean before build --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index d029bfdc..82193483 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "index.js", "scripts": { "release": "release-it", - "test": "cd example/ && doxygen && cd .. && node bin/moxygen.js --groups --pages --anchors --output=example/doc/api-%s.md example/xml" + "test": "npm run clean && cd example/ && doxygen && cd .. && node bin/moxygen.js --groups --pages --anchors --output=example/doc/api-%s.md example/xml", + "clean": "rm -rf example/doc/*.md example/xml/" }, "bin": { "moxygen": "./bin/moxygen.js" From daa4ed2e4144ffd98f67524f22599dd3a1bc6d5e Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 25 Oct 2018 16:04:34 -0700 Subject: [PATCH 28/56] fix markdown spacing --- example/src/history.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/example/src/history.md b/example/src/history.md index b1225172..81b1a1d0 100644 --- a/example/src/history.md +++ b/example/src/history.md @@ -1,7 +1,9 @@ # Changelog ## Version 1.0.1 + - Pedalling harder no longer stands in the saddle by default. This is just better form. ## Version 1.0.0 + - Initial release \ No newline at end of file From ad781b90b1eece4f0cf566185021505844cb715e Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 25 Oct 2018 16:07:56 -0700 Subject: [PATCH 29/56] add attribute IDs --- .../doc/{page-md_src_history.md => page-changelog.md} | 2 +- .../doc/{page-md_src_overview.md => page-overview.md} | 4 ++-- example/src/{history.md => changelog.md} | 2 +- example/src/overview.md | 4 ++-- example/xml/{md_src_history.xml => changelog.xml} | 4 ++-- example/xml/{history_8md.xml => changelog_8md.xml} | 10 ++++++---- example/xml/index.xml | 6 +++--- example/xml/{md_src_overview.xml => overview.xml} | 6 +++--- example/xml/overview_8md.xml | 4 ++-- 9 files changed, 22 insertions(+), 20 deletions(-) rename example/doc/{page-md_src_history.md => page-changelog.md} (77%) rename example/doc/{page-md_src_overview.md => page-overview.md} (88%) rename example/src/{history.md => changelog.md} (85%) rename example/xml/{md_src_history.xml => changelog.xml} (88%) rename example/xml/{history_8md.xml => changelog_8md.xml} (74%) rename example/xml/{md_src_overview.xml => overview.xml} (83%) diff --git a/example/doc/page-md_src_history.md b/example/doc/page-changelog.md similarity index 77% rename from example/doc/page-md_src_history.md rename to example/doc/page-changelog.md index 1f55218f..6aa5e944 100644 --- a/example/doc/page-md_src_history.md +++ b/example/doc/page-changelog.md @@ -1,4 +1,4 @@ -# page `md_src_history` {#md_src_history} +# page `changelog` {#changelog} ## Version 1.0.1 diff --git a/example/doc/page-md_src_overview.md b/example/doc/page-overview.md similarity index 88% rename from example/doc/page-md_src_overview.md rename to example/doc/page-overview.md index dc7ec70e..9445d8f8 100644 --- a/example/doc/page-md_src_overview.md +++ b/example/doc/page-overview.md @@ -1,8 +1,8 @@ -# page `md_src_overview` {#md_src_overview} +# page `overview` {#overview} The `transport` namespace provides several differnt types of bycicles, including [transport::Bicycle](example/doc/api-bicycle.md#classtransport_1_1Bicycle), [transport::MountainBike](example/doc/api-mountainbike.md#classtransport_1_1MountainBike) (designed for rough terrain), and [transport::RacingBike](example/doc/api-racingbike.md#classtransport_1_1RacingBike) (designed specifically for challenging races). ## Changelog -See history. +See the changelog. diff --git a/example/src/history.md b/example/src/changelog.md similarity index 85% rename from example/src/history.md rename to example/src/changelog.md index 81b1a1d0..c896cf33 100644 --- a/example/src/history.md +++ b/example/src/changelog.md @@ -1,4 +1,4 @@ -# Changelog +# Changelog {#changelog} ## Version 1.0.1 diff --git a/example/src/overview.md b/example/src/overview.md index 62ca7c5f..e3d27673 100644 --- a/example/src/overview.md +++ b/example/src/overview.md @@ -1,7 +1,7 @@ -# Transport +# Transport {#overview} The `transport` namespace provides several differnt types of bycicles, including transport::Bicycle, transport::MountainBike (designed for rough terrain), and transport::RacingBike (designed specifically for challenging races). ## Changelog -See [history](history.md). \ No newline at end of file +See [the changelog](changelog.md). \ No newline at end of file diff --git a/example/xml/md_src_history.xml b/example/xml/changelog.xml similarity index 88% rename from example/xml/md_src_history.xml rename to example/xml/changelog.xml index e1706a0b..41da1885 100644 --- a/example/xml/md_src_history.xml +++ b/example/xml/changelog.xml @@ -1,7 +1,7 @@ - - md_src_history + + changelog Changelog diff --git a/example/xml/history_8md.xml b/example/xml/changelog_8md.xml similarity index 74% rename from example/xml/history_8md.xml rename to example/xml/changelog_8md.xml index 3f2a7cb3..2e899367 100644 --- a/example/xml/history_8md.xml +++ b/example/xml/changelog_8md.xml @@ -1,20 +1,22 @@ - - history.md + + changelog.md -#Changelog +#Changelog{#changelog} ##Version1.0.1 + -Pedallinghardernolongerstandsinthesaddlebydefault.Thisisjustbetterform. ##Version1.0.0 + -Initialrelease - + diff --git a/example/xml/index.xml b/example/xml/index.xml index 249672c2..e5b56677 100644 --- a/example/xml/index.xml +++ b/example/xml/index.xml @@ -19,7 +19,7 @@ bicycle.h - history.md + changelog.md mountainbike.cpp @@ -44,9 +44,9 @@ mountainbike - md_src_history + changelog - md_src_overview + overview src diff --git a/example/xml/md_src_overview.xml b/example/xml/overview.xml similarity index 83% rename from example/xml/md_src_overview.xml rename to example/xml/overview.xml index d25f5b86..c65a629e 100644 --- a/example/xml/md_src_overview.xml +++ b/example/xml/overview.xml @@ -1,12 +1,12 @@ - - md_src_overview + + overview Transport The transport namespace provides several differnt types of bycicles, including transport::Bicycle, transport::MountainBike (designed for rough terrain), and transport::RacingBike (designed specifically for challenging races).Changelog -See history. +See the changelog. diff --git a/example/xml/overview_8md.xml b/example/xml/overview_8md.xml index eb2f6685..4846ccbd 100644 --- a/example/xml/overview_8md.xml +++ b/example/xml/overview_8md.xml @@ -7,13 +7,13 @@ -#Transport +#Transport{#overview} The`transport`namespaceprovidesseveraldiffernttypesofbycicles,includingtransport::Bicycle,transport::MountainBike(designedforroughterrain),andtransport::RacingBike(designedspecificallyforchallengingraces). ##Changelog -See[history](history.md). +See[thechangelog](changelog.md). From 3c64a078fa627c7cccb133a361e5542d15d0ce2c Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Fri, 1 Feb 2019 23:24:35 +0900 Subject: [PATCH 30/56] update devdeps --- package.json | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 70734661..caecccd4 100644 --- a/package.json +++ b/package.json @@ -22,10 +22,10 @@ "author": "Kam Low", "license": "MIT", "dependencies": { - "commander": "^2.9.0", - "handlebars": "^4.0.5", - "object-assign": "^4.1.0", - "winston": "^2.2.0", - "xml2js": "^0.4.16" + "commander": "^2.19.0", + "handlebars": "^4.0.12", + "object-assign": "^4.1.1", + "winston": "^3.2.1", + "xml2js": "^0.4.19" } } From 97f925225088ce7fda669b123c4bbee6c4d766a8 Mon Sep 17 00:00:00 2001 From: Kam Low Date: Fri, 1 Feb 2019 15:58:56 +0100 Subject: [PATCH 31/56] Add new classes option to README --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index c00c5774..b27e7d2b 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ Moxygen is currently used in conjunction with GitBook to generate the API docume -V, --version output the version number -o, --output output file (must contain %s when using groups) -g, --groups output doxygen groups into separate files + -c, --classes output doxygen classes into separate files -n, --noindex disable generation of the index (no effect with `groups` option -a, --anchors add anchors to internal links -l, --language programming language From 204cc7ce6971e68bc56957c97d7120d191282a16 Mon Sep 17 00:00:00 2001 From: Kam Low Date: Fri, 1 Feb 2019 16:00:53 +0100 Subject: [PATCH 32/56] Add lock files to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 504afef8..c6873c31 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ node_modules/ +npm-debug.log package-lock.json From 5ff473aaf6fb1197f3675d0e0d45ba35ef19854f Mon Sep 17 00:00:00 2001 From: Kam Low Date: Fri, 1 Feb 2019 16:01:22 +0100 Subject: [PATCH 33/56] Release 0.8.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index caecccd4..6059ba61 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "moxygen", - "version": "0.7.12", + "version": "0.8.0", "description": "Doxygen XML to Markdown documentation converter", "main": "index.js", "scripts": { From e79dffe7194fd08610aaa14882b6b44b97447f85 Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Sat, 2 Feb 2019 00:24:06 +0900 Subject: [PATCH 34/56] Fix broken links --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b27e7d2b..0387970d 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Moxygen is currently used in conjunction with GitBook to generate the API docume * **Multi page output**: Output single or multiple files * **Internal linking**: Anchors in comments and function definitions are supported * **Markdown comments**: Markdown in Doxygen comments are rendered -* **Doxygen groups**: Doxygen [grouping](https://www.stack.nl/~dimitri/doxygen/manual/grouping.html) is supported for more organised documentation +* **Doxygen groups**: Doxygen [grouping](http://www.doxygen.nl/manual/grouping.html) is supported for more organised documentation * **Custom templates**: Modify the core Markdown templates to add your own flavour * **Optional index**: Optionally render a top level index @@ -38,7 +38,7 @@ Moxygen is currently used in conjunction with GitBook to generate the API docume ## Multi-page Output -Moxygen supports the doxygen [groups](http://www.stack.nl/~dimitri/doxygen/manual/grouping.html#modules) syntax for generating multi page documentation. Every [\defgroup](http://www.stack.nl/~dimitri/doxygen/manual/commands.html#cmddefgroup) in your source code will be parsed and output into a separate markdown file, with internal reference updated accordingly. +Moxygen supports the doxygen [groups](http://www.doxygen.nl/manual/grouping.html#modules) syntax for generating multi page documentation. Every [\defgroup](http://www.doxygen.nl/manual/commands.html#cmddefgroup) in your source code will be parsed and output into a separate markdown file, with internal reference updated accordingly. Example: From fc9e67b38333655426f835304eec0fbe568d38eb Mon Sep 17 00:00:00 2001 From: Junyi Xiao Date: Thu, 11 Apr 2019 11:28:05 -0700 Subject: [PATCH 35/56] fix cpp file name --- src/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers.js b/src/helpers.js index 8fdf0ea5..1858d91d 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -101,7 +101,7 @@ module.exports = { } else if (options.groups) { return util.format(options.output, compound.groupname); } else if (options.classes) { - return util.format(options.output, compound.name); + return util.format(options.output, compound.name.replace(/\:/g, '-')); } else { return options.output; } From 1f5880cf49fa840967b8f3ea08abd6a1a29a1c38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Tonn=C3=A4tt?= Date: Sat, 20 Mar 2021 00:12:53 +0100 Subject: [PATCH 36/56] Don't use level one header in class template --- templates/cpp/class.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/cpp/class.md b/templates/cpp/class.md index 09c4aaf6..02f4662c 100644 --- a/templates/cpp/class.md +++ b/templates/cpp/class.md @@ -1,4 +1,4 @@ -# {{kind}} `{{name}}` {{anchor refid}} +## {{kind}} `{{name}}` {{anchor refid}} {{#if basecompoundref}} ``` @@ -13,7 +13,7 @@ {{detaileddescription}} -## Summary +### Summary Members | Descriptions --------------------------------|--------------------------------------------- @@ -21,7 +21,7 @@ {{/each}}{{#each filtered.members}}{{cell proto}} | {{cell summary}} {{/each}} -## Members +### Members {{#each filtered.compounds}} #### {{title proto}} {{anchor refid}} From b9603b369abed53359e2675dfc7d671f91009b6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nils=20Tonn=C3=A4tt?= Date: Sat, 20 Mar 2021 00:24:12 +0100 Subject: [PATCH 37/56] Remove EOL spaces --- templates/cpp/class.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/cpp/class.md b/templates/cpp/class.md index 02f4662c..d0623177 100644 --- a/templates/cpp/class.md +++ b/templates/cpp/class.md @@ -6,7 +6,7 @@ {{#each basecompoundref}} : {{prot}} {{name}} {{/each}} -``` +``` {{/if}} {{briefdescription}} From ac5a9111848fdbeb623cdba1e3135ecf74f03495 Mon Sep 17 00:00:00 2001 From: Saulo Campos Date: Wed, 2 Jun 2021 17:32:54 -0300 Subject: [PATCH 38/56] Update index.js Included filter to generate documentation of private and static functions. --- index.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index fca68cf6..9ba07398 100644 --- a/index.js +++ b/index.js @@ -44,7 +44,12 @@ module.exports = { 'signal', 'public-slot', 'protected-slot', - 'public-type' + 'public-type', + 'private-attrib', + 'private-func', + 'private-slot', + 'public-static-func', + 'private-static-func' ], compounds: [ 'namespace', From 4cf41c15453ada5e3f1639cbd2309d4c756a565c Mon Sep 17 00:00:00 2001 From: Sebastian Seifert Date: Fri, 6 Aug 2021 14:31:30 +0200 Subject: [PATCH 39/56] Treat interface compounds (e.g. keyword "interface" in C#) like classes. --- index.js | 1 + src/templates.js | 1 + 2 files changed, 2 insertions(+) diff --git a/index.js b/index.js index 9ba07398..66cd58ea 100644 --- a/index.js +++ b/index.js @@ -57,6 +57,7 @@ module.exports = { 'struct', 'union', 'typedef', + 'interface', // 'file' ] } diff --git a/src/templates.js b/src/templates.js index e87f9097..6f71e050 100644 --- a/src/templates.js +++ b/src/templates.js @@ -55,6 +55,7 @@ module.exports = { break; case 'class': case 'struct': + case 'interface': template = 'class'; break; default: From e159bde0889dc9e43fa3973ef5b85063626c5a60 Mon Sep 17 00:00:00 2001 From: Cankar001 Date: Tue, 21 Dec 2021 13:16:49 +0100 Subject: [PATCH 40/56] fixed fileName for templated classes --- src/helpers.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/helpers.js b/src/helpers.js index 1858d91d..994a0dad 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -101,7 +101,7 @@ module.exports = { } else if (options.groups) { return util.format(options.output, compound.groupname); } else if (options.classes) { - return util.format(options.output, compound.name.replace(/\:/g, '-')); + return util.format(options.output, compound.name.replace(/\:/g, '-').replace('<', '(').replace('>', ')')); } else { return options.output; } From 05c44dc80e0760635b93b87b15f4bd0f7a3fb6ef Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Tue, 26 Jul 2022 14:36:20 -0400 Subject: [PATCH 41/56] Fix typo in help message --- bin/moxygen.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/moxygen.js b/bin/moxygen.js index 7baf9281..d6454461 100755 --- a/bin/moxygen.js +++ b/bin/moxygen.js @@ -11,7 +11,7 @@ program.version(pjson.version) .usage('[options] ') .option('-o, --output ', 'output file (must contain %s when using groups)', String, 'api.md') .option('-g, --groups', 'output doxygen groups into separate files', false) - .option('-c, --classes', 'output doxygen groups into separate files', false) + .option('-c, --classes', 'output doxygen classes into separate files', false) .option('-p, --pages', 'output doxygen pages into separate files', false) .option('-n, --noindex', 'disable generation of the index (no effect with `groups` option', false) .option('-a, --anchors', 'add anchors to internal links', false) From 07a5a0366ebd460a9938d3e89ad0e81d5f5e1fee Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Tue, 26 Jul 2022 14:54:42 -0400 Subject: [PATCH 42/56] Trim spurious trailing space --- src/templates.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates.js b/src/templates.js index 6f71e050..81116eea 100644 --- a/src/templates.js +++ b/src/templates.js @@ -63,7 +63,7 @@ module.exports = { console.log('Skipping ', compound); return undefined; } - + return this.templates[template](compound).replace(/(\r\n|\r|\n){3,}/g, '$1\n'); }, From f58d5c2ebe326483a1774078547287ef61901bb4 Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Tue, 26 Jul 2022 15:03:43 -0400 Subject: [PATCH 43/56] Add space between arguments --- src/parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parser.js b/src/parser.js index f4cf0b11..06cf4cf7 100644 --- a/src/parser.js +++ b/src/parser.js @@ -258,7 +258,7 @@ module.exports = { m = m.concat('('); if (memberdef.param) { memberdef.param.forEach(function (param, argn) { - m = m.concat(argn == 0 ? [] : ','); + m = m.concat(argn == 0 ? [] : ', '); m = m.concat([toMarkdown(param.type)]); m = m.concat(param.declname ? [' ', toMarkdown(param.declname)] : []); }); From 53daa67a1007bf7d746e5dff0d71a2bede8270d2 Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Tue, 26 Jul 2022 16:10:27 -0400 Subject: [PATCH 44/56] Fix bug in program option sanitisation --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 66cd58ea..420f3ace 100644 --- a/index.js +++ b/index.js @@ -69,7 +69,7 @@ module.exports = { run: function (options) { // Sanitize options - if (options.groups == options.output.indexOf('%s') === -1) + if (options.groups && options.output.indexOf('%s') === -1) throw "The `output` file parameter must contain an '%s' for group name " + "substitution when `groups` are enabled." From 97b63bf19ab0ec0c6b313981c97ca04eec4c93ec Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Tue, 26 Jul 2022 21:20:36 -0400 Subject: [PATCH 45/56] Fix coding style issues Add commas after last member of arrays. --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 420f3ace..2db98923 100644 --- a/index.js +++ b/index.js @@ -49,7 +49,7 @@ module.exports = { 'private-func', 'private-slot', 'public-static-func', - 'private-static-func' + 'private-static-func', ], compounds: [ 'namespace', @@ -58,7 +58,7 @@ module.exports = { 'union', 'typedef', 'interface', - // 'file' + // 'file', ] } }, From 0c2f0117979132cad06265da9e8ffd04d6fe1af6 Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Tue, 26 Jul 2022 21:20:36 -0400 Subject: [PATCH 46/56] Fix coding style issues Add commas after last member of arrays and objects in index.js and bin/moxygen.js. --- bin/moxygen.js | 2 +- index.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bin/moxygen.js b/bin/moxygen.js index d6454461..afe7639d 100755 --- a/bin/moxygen.js +++ b/bin/moxygen.js @@ -36,7 +36,7 @@ if (program.args.length) { anchors: program.anchors, htmlAnchors: program.htmlAnchors, language: program.language, - templates: program.templates + templates: program.templates, })); } else { diff --git a/index.js b/index.js index 420f3ace..db356e77 100644 --- a/index.js +++ b/index.js @@ -49,7 +49,7 @@ module.exports = { 'private-func', 'private-slot', 'public-static-func', - 'private-static-func' + 'private-static-func', ], compounds: [ 'namespace', @@ -58,9 +58,9 @@ module.exports = { 'union', 'typedef', 'interface', - // 'file' + // 'file', ] - } + }, }, /** @@ -139,5 +139,5 @@ module.exports = { } }); - } + }, } From c10e1621b2ea4457a9e9d1656df82dfd13937aae Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Tue, 26 Jul 2022 22:53:20 -0400 Subject: [PATCH 47/56] Improve the custom template folder command line option Currently the user is unable to set a custom template folder named 'templates' in its current directory since moxygen will use the built-in templates unless the user specifies '-t ./templates'. This commit solves the issue. --- bin/moxygen.js | 2 +- index.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/moxygen.js b/bin/moxygen.js index afe7639d..d8b9a9c1 100755 --- a/bin/moxygen.js +++ b/bin/moxygen.js @@ -17,7 +17,7 @@ program.version(pjson.version) .option('-a, --anchors', 'add anchors to internal links', false) .option('-h, --html-anchors', 'add html anchors to internal links', false) .option('-l, --language ', 'programming language', String, 'cpp') - .option('-t, --templates ', 'custom templates directory', String, 'templates') + .option('-t, --templates ', 'custom templates directory (default: "built-in templates")', String) .option('-q, --quiet', 'quiet mode', false) .parse(process.argv); diff --git a/index.js b/index.js index db356e77..54fc5d2f 100644 --- a/index.js +++ b/index.js @@ -73,8 +73,9 @@ module.exports = { throw "The `output` file parameter must contain an '%s' for group name " + "substitution when `groups` are enabled." - if (options.templates == this.defaultOptions.templates) - options.templates = path.join(__dirname, 'templates', options.language); + if (typeof options.templates == "undefined") { + options.templates = path.join(__dirname, this.defaultOptions.templates, options.language); + } // Load templates templates.registerHelpers(options); From 6457eaa5cee76a2379f934e620b476d089aa2dee Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Tue, 26 Jul 2022 23:04:29 -0400 Subject: [PATCH 48/56] Add throw if template file is missing --- src/templates.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/templates.js b/src/templates.js index 81116eea..d7ee0f32 100644 --- a/src/templates.js +++ b/src/templates.js @@ -64,6 +64,10 @@ module.exports = { return undefined; } + if (typeof this.templates[template] == "undefined") { + throw 'Template "' + template + '" not found in your templates directory.'; + } + return this.templates[template](compound).replace(/(\r\n|\r|\n){3,}/g, '$1\n'); }, @@ -90,5 +94,5 @@ module.exports = { handlebars.registerHelper('anchor', function(name) { return helpers.getAnchor(name, options); }); - } + }, }; From 392de2a9709b25f846f211ec875dfde9e9b050c5 Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Tue, 26 Jul 2022 23:34:44 -0400 Subject: [PATCH 49/56] Fix bug in options sanitising When using the 'classes' option, the output file name requires "%s" as with 'groups', otherwise, filenames aren't properly formatted. Update README.md to reflect the change. --- README.md | 2 +- bin/moxygen.js | 2 +- index.js | 7 ++++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 29a90cce..cea2928b 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ Moxygen is currently used in conjunction with GitBook to generate the API docume -h, --help output usage information -V, --version output the version number - -o, --output output file (must contain %s when using groups) + -o, --output output file, must contain "%s" when using groups or classes -g, --groups output doxygen groups into separate files -c, --classes output doxygen classes into separate files -n, --noindex disable generation of the index (no effect with `groups` option diff --git a/bin/moxygen.js b/bin/moxygen.js index d8b9a9c1..a43a7b6e 100755 --- a/bin/moxygen.js +++ b/bin/moxygen.js @@ -9,7 +9,7 @@ var app = require('../index.js'); program.version(pjson.version) .usage('[options] ') - .option('-o, --output ', 'output file (must contain %s when using groups)', String, 'api.md') + .option('-o, --output ', 'output file, must contain "%s" when using groups or classes', String, 'api.md') .option('-g, --groups', 'output doxygen groups into separate files', false) .option('-c, --classes', 'output doxygen classes into separate files', false) .option('-p, --pages', 'output doxygen pages into separate files', false) diff --git a/index.js b/index.js index 54fc5d2f..35b92920 100644 --- a/index.js +++ b/index.js @@ -69,9 +69,10 @@ module.exports = { run: function (options) { // Sanitize options - if (options.groups && options.output.indexOf('%s') === -1) - throw "The `output` file parameter must contain an '%s' for group name " + - "substitution when `groups` are enabled." + if ((options.classes || options.groups) && options.output.indexOf('%s') === -1) { + throw "The `output` file parameter must contain an '%s' for group or class name " + + "substitution when `groups` or `classes` are enabled." + } if (typeof options.templates == "undefined") { options.templates = path.join(__dirname, this.defaultOptions.templates, options.language); From 9d40639d8609794413b9160c51e1698b8d6e3c6a Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Tue, 26 Jul 2022 23:54:26 -0400 Subject: [PATCH 50/56] Fix issue concerning the default output file name and 'groups' or 'classes' options When using 'groups' or 'classes' options with the default output file name, moxygen should not throw an error, instead, it should use the appropriate default file name alternative. This set the default alternative to "api_%s.md". Update README.md to reflect the change. --- bin/moxygen.js | 2 +- index.js | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/bin/moxygen.js b/bin/moxygen.js index a43a7b6e..a3baff77 100755 --- a/bin/moxygen.js +++ b/bin/moxygen.js @@ -9,7 +9,7 @@ var app = require('../index.js'); program.version(pjson.version) .usage('[options] ') - .option('-o, --output ', 'output file, must contain "%s" when using groups or classes', String, 'api.md') + .option('-o, --output ', 'output file, must contain "%s" when using groups or classes (default: "api.md"/"api_%s.md")', String) .option('-g, --groups', 'output doxygen groups into separate files', false) .option('-c, --classes', 'output doxygen classes into separate files', false) .option('-p, --pages', 'output doxygen pages into separate files', false) diff --git a/index.js b/index.js index 35b92920..f132b89e 100644 --- a/index.js +++ b/index.js @@ -28,6 +28,7 @@ module.exports = { templates: 'templates', /** Templates directory **/ pages: false, /** Output doxygen pages separately **/ classes: false, /** Output doxygen classes separately **/ + output_s: 'api_%s.md', /** Output file for groups and classes **/ filters: { members: [ @@ -69,6 +70,15 @@ module.exports = { run: function (options) { // Sanitize options + if (typeof options.output == "undefined") { + if (options.classes || options.groups) { + options.output = this.defaultOptions.output_s; + } + else { + options.output = this.defaultOptions.output; + } + } + if ((options.classes || options.groups) && options.output.indexOf('%s') === -1) { throw "The `output` file parameter must contain an '%s' for group or class name " + "substitution when `groups` or `classes` are enabled." From 482f66d99c65e4116f14c7ad3c6cf922677e280c Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Wed, 27 Jul 2022 00:14:21 -0400 Subject: [PATCH 51/56] Solve style consistency issues for messages Uniformise error messages in src/parser.js with remaining messages in the project. Uniformise style in help message, fix a typo and update the usage of 'noindex' to also include the 'classes' option. Add 'XML' to the usage string to be more informative. Update README.md to reflect the changes. --- README.md | 6 +++--- bin/moxygen.js | 6 +++--- src/parser.js | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index cea2928b..18c775f0 100644 --- a/README.md +++ b/README.md @@ -20,16 +20,16 @@ Moxygen is currently used in conjunction with GitBook to generate the API docume 3. Install `moxygen` like so: `npm install moxygen -g`. 4. Run `moxygen` providing the folder location of the XML documentation as the first argument ie. `{OUTPUT_DIRECTORY}/xml`. ``` - Usage: moxygen [options] + Usage: moxygen [options] Options: -h, --help output usage information -V, --version output the version number - -o, --output output file, must contain "%s" when using groups or classes + -o, --output output file, must contain "%s" when using `groups` or `classes` -g, --groups output doxygen groups into separate files -c, --classes output doxygen classes into separate files - -n, --noindex disable generation of the index (no effect with `groups` option + -n, --noindex disable generation of the index, ignored with `groups` or `classes` -a, --anchors add anchors to internal links -l, --language programming language -t, --templates custom templates directory diff --git a/bin/moxygen.js b/bin/moxygen.js index a3baff77..6a8eedf1 100755 --- a/bin/moxygen.js +++ b/bin/moxygen.js @@ -8,12 +8,12 @@ var pjson = require('../package.json'); var app = require('../index.js'); program.version(pjson.version) - .usage('[options] ') - .option('-o, --output ', 'output file, must contain "%s" when using groups or classes (default: "api.md"/"api_%s.md")', String) + .usage('[options] ') + .option('-o, --output ', 'output file, must contain "%s" when using `groups` or `classes` (default: "api.md"/"api_%s.md")', String) .option('-g, --groups', 'output doxygen groups into separate files', false) .option('-c, --classes', 'output doxygen classes into separate files', false) .option('-p, --pages', 'output doxygen pages into separate files', false) - .option('-n, --noindex', 'disable generation of the index (no effect with `groups` option', false) + .option('-n, --noindex', 'disable generation of the index, ignored with `groups` or `classes`', false) .option('-a, --anchors', 'add anchors to internal links', false) .option('-h, --html-anchors', 'add html anchors to internal links', false) .option('-l, --language ', 'programming language', String, 'cpp') diff --git a/src/parser.js b/src/parser.js index 06cf4cf7..f03817bb 100644 --- a/src/parser.js +++ b/src/parser.js @@ -516,13 +516,13 @@ module.exports = { log.verbose('Parsing ' + path.join(options.directory, 'index.xml')); fs.readFile(path.join(options.directory, 'index.xml'), 'utf8', function(err, data) { if (err) { - callback('Failed to load Doxygen XML: ' + err); + callback('Failed to load doxygen XML: ' + err); return; } var xmlParser = new xml2js.Parser(); xmlParser.parseString(data, function (err, result) { if (err) { - callback('Failed to parse Doxygen XML: ' + err); + callback('Failed to parse doxygen XML: ' + err); return; } this.root.kind = 'index'; From 040f7e79bf93479b4c2ec3997a1a9f95894a3edd Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Wed, 27 Jul 2022 00:35:37 -0400 Subject: [PATCH 52/56] Improve log message readability and fix missindented line Add colon and space to separate warning message from file pathname. Fix a line with extra indentation space. --- src/parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/parser.js b/src/parser.js index f03817bb..f8447680 100644 --- a/src/parser.js +++ b/src/parser.js @@ -501,10 +501,10 @@ module.exports = { doxygen = fs.readFileSync(path.join(options.directory, compound.refid + '.xml'), 'utf8'); xmlParser.parseString(doxygen, function (err, data) { if (err) { - log.verbose('warning - parse error for file' , path.join(options.directory, compound.refid + '.xml')) + log.verbose('warning - parse error for file: ' , path.join(options.directory, compound.refid + '.xml')) return; } - this.parseCompound(compound, data.doxygen.compounddef[0]); + this.parseCompound(compound, data.doxygen.compounddef[0]); }.bind(this)); } From 53ca845b4e4a84d9c4fcab65bd9e3df7852db3f8 Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Wed, 27 Jul 2022 14:26:44 -0400 Subject: [PATCH 53/56] Fix command line options collision The option for generating html anchors to internal links was set to "-h" which is also the standard flag for displaying the program help. Change the option to "-i" for "internal". Update README.md to reflect the actual list of program options. --- README.md | 4 +++- bin/moxygen.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 29a90cce..0d0a7df6 100644 --- a/README.md +++ b/README.md @@ -24,16 +24,18 @@ Moxygen is currently used in conjunction with GitBook to generate the API docume Options: - -h, --help output usage information -V, --version output the version number -o, --output output file (must contain %s when using groups) -g, --groups output doxygen groups into separate files -c, --classes output doxygen classes into separate files + -p, --pages output doxygen pages into separate files -n, --noindex disable generation of the index (no effect with `groups` option -a, --anchors add anchors to internal links + -i, --html-anchors add html anchors to internal links -l, --language programming language -t, --templates custom templates directory -q, --quiet quiet mode + -h, --help output usage information ``` ## Multi-page Output diff --git a/bin/moxygen.js b/bin/moxygen.js index d6454461..d161bf25 100755 --- a/bin/moxygen.js +++ b/bin/moxygen.js @@ -15,7 +15,7 @@ program.version(pjson.version) .option('-p, --pages', 'output doxygen pages into separate files', false) .option('-n, --noindex', 'disable generation of the index (no effect with `groups` option', false) .option('-a, --anchors', 'add anchors to internal links', false) - .option('-h, --html-anchors', 'add html anchors to internal links', false) + .option('-i, --html-anchors', 'add html anchors to internal links', false) .option('-l, --language ', 'programming language', String, 'cpp') .option('-t, --templates ', 'custom templates directory', String, 'templates') .option('-q, --quiet', 'quiet mode', false) From dd3cdd07dcbfcc152d80383825fc8b0652584585 Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Wed, 27 Jul 2022 16:03:15 -0400 Subject: [PATCH 54/56] Improve logging mechanism and solve logger issues Winston v. 3 requires transports to be added, otherwise it pollutes the screen with warnings. Add a default Console transport to get rid of those warnings. Add an optional log file transport for debugging purposes; default log file name: moxygen.log. Create a centralised logger: Encapsulate a logger object in its own module and add methods to initialise the logger, set the current logging level, and get a reference to the logger object. Fix some logging missformatting. --- README.md | 1 + bin/moxygen.js | 7 +++--- index.js | 1 + src/compound.js | 10 ++++---- src/helpers.js | 6 ++--- src/logger.js | 62 ++++++++++++++++++++++++++++++++++++++++++++++++ src/parser.js | 6 ++--- src/templates.js | 2 +- 8 files changed, 80 insertions(+), 15 deletions(-) create mode 100644 src/logger.js diff --git a/README.md b/README.md index 4e182d6b..5fa55cfe 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,7 @@ Moxygen is currently used in conjunction with GitBook to generate the API docume -i, --html-anchors add html anchors to internal links -l, --language programming language -t, --templates custom templates directory + -f, --logfile [file] output log messages to file, (default: console only, default file name: "moxygen.log") -q, --quiet quiet mode -h, --help output usage information ``` diff --git a/bin/moxygen.js b/bin/moxygen.js index 39bbcb25..c5b982dd 100755 --- a/bin/moxygen.js +++ b/bin/moxygen.js @@ -1,7 +1,7 @@ #!/usr/bin/env node 'use strict'; -var log = require('winston'); +var logger = require('../src/logger'); var program = require('commander'); var assign = require('object-assign'); var pjson = require('../package.json'); @@ -18,12 +18,11 @@ program.version(pjson.version) .option('-i, --html-anchors', 'add html anchors to internal links', false) .option('-l, --language ', 'programming language', String, 'cpp') .option('-t, --templates ', 'custom templates directory (default: "built-in templates")', String) + .option('-f, --logfile [file]', 'output log messages to file, (default: console only, default file name: "moxygen.log")') .option('-q, --quiet', 'quiet mode', false) .parse(process.argv); -if (!program.quiet) { - log.level = 'verbose'; -} +logger.init(program, app.defaultOptions); if (program.args.length) { app.run(assign({}, app.defaultOptions, { diff --git a/index.js b/index.js index f132b89e..6b3e90e2 100644 --- a/index.js +++ b/index.js @@ -29,6 +29,7 @@ module.exports = { pages: false, /** Output doxygen pages separately **/ classes: false, /** Output doxygen classes separately **/ output_s: 'api_%s.md', /** Output file for groups and classes **/ + logfile: 'moxygen.log', /** Log file **/ filters: { members: [ diff --git a/src/compound.js b/src/compound.js index 5c0f3698..d39606ac 100644 --- a/src/compound.js +++ b/src/compound.js @@ -6,7 +6,7 @@ **/ 'use strict'; -var log = require('winston'); +var log = require('./logger').getLogger(); function Compound(parent, id, name) { this.parent = parent; @@ -84,14 +84,16 @@ Compound.prototype = { if (item.kind == 'namespace') { if ((!item.filtered.compounds || !item.filtered.compounds.length) && (!item.filtered.members || !item.filtered.members.length)) { - // log.verbose('Skip empty namespace', item.name); + // log.verbose('Skip empty namespace: ' + item.name); return; } } // skip items not belonging to current group else if (groupid && item.groupid != groupid) { - // log.verbose('Skip item from foreign group', item.kind, item.name, item.groupid, group.id); + // log.verbose('Skip item from foreign group: { item.kind: ' + item.kind + // + ', item.name: ' + item.name + ', item.groupid: ' + // + item.groupid + ', group.id: '+ group.id + '}'); return; } @@ -104,7 +106,7 @@ Compound.prototype = { }); return result; - } + }, } module.exports = Compound; diff --git a/src/helpers.js b/src/helpers.js index 994a0dad..d2d174ca 100644 --- a/src/helpers.js +++ b/src/helpers.js @@ -9,7 +9,7 @@ var fs = require('fs'); var path = require('path'); var util = require('util'); -var log = require('winston'); +var log = require('./logger').getLogger(); var handlebars = require('handlebars'); module.exports = { @@ -115,7 +115,7 @@ module.exports = { // Write the output file writeFile: function (filepath, contents) { - log.verbose('Writing', filepath); + log.verbose('Writing: ' + filepath); var stream = fs.createWriteStream(filepath); stream.once('open', function(fd) { contents.forEach(function (content) { @@ -124,5 +124,5 @@ module.exports = { }); stream.end(); }); - } + }, }; diff --git a/src/logger.js b/src/logger.js new file mode 100644 index 00000000..13c67b43 --- /dev/null +++ b/src/logger.js @@ -0,0 +1,62 @@ +/** + * Original work Copyright (c) 2016 Philippe FERDINAND + * Modified work Copyright (c) 2016 Kam Low + * This file added Copyright (c) 2022 Waldemar Villamayor-Venialbo + * + * @license MIT + **/ +'use strict'; + +const winston = require('winston'); + +// Create the global logger object +let logger = winston.createLogger({ + level : 'info', +}); + +module.exports = { + + init : function (options, defaultOptions) { + // Logger transports + let logfile = null; + let logterm = null; + + // Create log console transport + logterm = new winston.transports.Console({ + consoleWarnLevels : [ 'warn', 'debug' ], + stderrLevels : [ 'error' ], + silent : options.quiet, + format : winston.format.simple(), + }); + + logger.add(logterm); + + // User defined log file? + if (typeof options.logfile != 'undefined') { + // Use default log file name? + if (options.logfile === true) { + options.logfile = defaultOptions.logfile; + } + // Create log file transport + logfile = new winston.transports.File({ + filename : options.logfile, + level : 'silly', + }); + + logger.add(logfile); + } + + // Set the logging level + if (!options.quiet) { + this.setLevel('verbose'); + } + }, + + getLogger: function () { + return logger; + }, + + setLevel: function (level) { + logger.level = level; + }, +}; diff --git a/src/parser.js b/src/parser.js index f8447680..3b4bdcb7 100644 --- a/src/parser.js +++ b/src/parser.js @@ -7,7 +7,7 @@ 'use strict'; var fs = require('fs'); -var log = require('winston'); +var log = require('./logger').getLogger(); var path = require('path'); var xml2js = require('xml2js'); @@ -501,7 +501,7 @@ module.exports = { doxygen = fs.readFileSync(path.join(options.directory, compound.refid + '.xml'), 'utf8'); xmlParser.parseString(doxygen, function (err, data) { if (err) { - log.verbose('warning - parse error for file: ' , path.join(options.directory, compound.refid + '.xml')) + log.verbose('warning - parse error for file: ' + path.join(options.directory, compound.refid + '.xml')) return; } this.parseCompound(compound, data.doxygen.compounddef[0]); @@ -530,5 +530,5 @@ module.exports = { callback(null, this.root); // TODO: return errors properly }.bind(this)); }.bind(this)); - } + }, }; diff --git a/src/templates.js b/src/templates.js index d7ee0f32..cd011034 100644 --- a/src/templates.js +++ b/src/templates.js @@ -7,7 +7,7 @@ 'use strict'; var fs = require('fs'); -var log = require('winston'); +var log = require('./logger').getLogger(); var path = require('path'); var handlebars = require('handlebars'); // var tidyMarkdown = require('tidy-markdown'); From b3edf95ca7c5f49805920bf9eb1949d2a1224c6b Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Wed, 27 Jul 2022 17:01:07 -0400 Subject: [PATCH 55/56] Remove default option values from README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5fa55cfe..6ec6719e 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ Moxygen is currently used in conjunction with GitBook to generate the API docume -i, --html-anchors add html anchors to internal links -l, --language programming language -t, --templates custom templates directory - -f, --logfile [file] output log messages to file, (default: console only, default file name: "moxygen.log") + -f, --logfile [file] output log messages to file -q, --quiet quiet mode -h, --help output usage information ``` From 309b259e384d66bb6be0cf79d26a722ae80ec30c Mon Sep 17 00:00:00 2001 From: Waldemar Villamayor-Venialbo Date: Wed, 27 Jul 2022 17:29:35 -0400 Subject: [PATCH 56/56] Amend program option values "-i" and "-f" Change the option shortcuts to "-H" and "-L". --- README.md | 4 ++-- bin/moxygen.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 6ec6719e..a68c81d2 100644 --- a/README.md +++ b/README.md @@ -31,10 +31,10 @@ Moxygen is currently used in conjunction with GitBook to generate the API docume -p, --pages output doxygen pages into separate files -n, --noindex disable generation of the index, ignored with `groups` or `classes` -a, --anchors add anchors to internal links - -i, --html-anchors add html anchors to internal links + -H, --html-anchors add html anchors to internal links -l, --language programming language -t, --templates custom templates directory - -f, --logfile [file] output log messages to file + -L, --logfile [file] output log messages to file -q, --quiet quiet mode -h, --help output usage information ``` diff --git a/bin/moxygen.js b/bin/moxygen.js index c5b982dd..092681dc 100755 --- a/bin/moxygen.js +++ b/bin/moxygen.js @@ -15,10 +15,10 @@ program.version(pjson.version) .option('-p, --pages', 'output doxygen pages into separate files', false) .option('-n, --noindex', 'disable generation of the index, ignored with `groups` or `classes`', false) .option('-a, --anchors', 'add anchors to internal links', false) - .option('-i, --html-anchors', 'add html anchors to internal links', false) + .option('-H, --html-anchors', 'add html anchors to internal links', false) .option('-l, --language ', 'programming language', String, 'cpp') .option('-t, --templates ', 'custom templates directory (default: "built-in templates")', String) - .option('-f, --logfile [file]', 'output log messages to file, (default: console only, default file name: "moxygen.log")') + .option('-L, --logfile [file]', 'output log messages to file, (default: console only, default file name: "moxygen.log")') .option('-q, --quiet', 'quiet mode', false) .parse(process.argv);