summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristoph Schlosser <2466365+cschlosser@users.noreply.github.com>2020-10-03 17:15:04 +0200
committerGitHub <noreply@github.com>2020-10-03 17:15:04 +0200
commit15dcabb5903b68bbc8b490b1d0e220d13acf63b7 (patch)
treea62d3347ba3cf1c3044ca2b153f6374af56dec6c /src
parent2af50bd62c2e26975a46b499c1c687be42be80a1 (diff)
downloaddoxdocgen-15dcabb5903b68bbc8b490b1d0e220d13acf63b7.tar.gz
Add custom tags to generic order (#173)
Diffstat (limited to 'src')
-rw-r--r--src/Config.ts2
-rw-r--r--src/Lang/Cpp/CppDocGen.ts12
-rw-r--r--src/test/CppTests/Config.test.ts8
3 files changed, 20 insertions, 2 deletions
diff --git a/src/Config.ts b/src/Config.ts
index 1d942a1..51aebc3 100644
--- a/src/Config.ts
+++ b/src/Config.ts
@@ -57,6 +57,7 @@ class Generic {
public generateSmartText: boolean = true;
public splitCasingSmartText: boolean = true;
public order: string[] = ["brief", "empty", "tparam", "param", "return"];
+ public customTags: string[] = [];
public filteredKeywords: string[] = [];
}
@@ -96,6 +97,7 @@ export class Config {
values.Generic.generateSmartText = Generic.getConfiguration().get<boolean>("generateSmartText", values.Generic.generateSmartText);
values.Generic.splitCasingSmartText = Generic.getConfiguration().get<boolean>("splitCasingSmartText", values.Generic.splitCasingSmartText);
values.Generic.order = Generic.getConfiguration().get<string[]>("order", values.Generic.order);
+ values.Generic.customTags = Generic.getConfiguration().get<string[]>("customTags", values.Generic.customTags);
values.Generic.filteredKeywords = Generic.getConfiguration().get<string[]>("filteredKeywords", values.Generic.filteredKeywords);
return values;
diff --git a/src/Lang/Cpp/CppDocGen.ts b/src/Lang/Cpp/CppDocGen.ts
index 7be7da9..1e73804 100644
--- a/src/Lang/Cpp/CppDocGen.ts
+++ b/src/Lang/Cpp/CppDocGen.ts
@@ -449,11 +449,19 @@ export class CppDocGen implements IDocGen {
case "return": {
if (this.cfg.Generic.returnTemplate.trim().length !== 0 && this.func.type !== null) {
const returnParams = this.generateReturnParams();
- // tslint:disable-next-line:max-line-length
- this.generateFromTemplate(lines, this.cfg.typeTemplateReplace, this.cfg.Generic.returnTemplate, returnParams);
+ this.generateFromTemplate(
+ lines,
+ this.cfg.typeTemplateReplace,
+ this.cfg.Generic.returnTemplate,
+ returnParams
+ );
}
break;
}
+ case "custom": {
+ lines.push(...this.cfg.Generic.customTags);
+ break;
+ }
default: {
break;
}
diff --git a/src/test/CppTests/Config.test.ts b/src/test/CppTests/Config.test.ts
index 1769414..3915f11 100644
--- a/src/test/CppTests/Config.test.ts
+++ b/src/test/CppTests/Config.test.ts
@@ -219,4 +219,12 @@ suite("C++ - Configuration Tests", () => {
assert.equal("/**\n * @brief \n * \n * @param networkstatus \n */", result);
});
+ test("Custom tag", () => {
+ testSetup.cfg = new Config();
+ testSetup.cfg.Generic.order = ["custom"];
+ testSetup.cfg.Generic.customTags = ["@note"];
+ const result = testSetup.SetLine("void foo();").GetResult();
+ assert.equal("/**\n * @note\n */", result);
+ });
+
});