summaryrefslogtreecommitdiffstats
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
parent2af50bd62c2e26975a46b499c1c687be42be80a1 (diff)
downloaddoxdocgen-15dcabb5903b68bbc8b490b1d0e220d13acf63b7.tar.gz
Add custom tags to generic order (#173)
-rw-r--r--CHANGELOG.md4
-rw-r--r--README.md6
-rw-r--r--package.json12
-rw-r--r--src/Config.ts2
-rw-r--r--src/Lang/Cpp/CppDocGen.ts12
-rw-r--r--src/test/CppTests/Config.test.ts8
6 files changed, 40 insertions, 4 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d1c6992..552b4bc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,10 @@
## [UNRELEASED]
+### Feature
+
+- Support for arbitrary tags (#169)
+
### Fix
- Incorrect parameter name of template (#170)
diff --git a/README.md b/README.md
index 24de003..fcb6f08 100644
--- a/README.md
+++ b/README.md
@@ -199,9 +199,13 @@ Each of them can be configured with its own custom text and you can decide if th
"empty",
"tparam",
"param",
- "return"
+ "return",
+ "custom"
],
+ // Custom tags to be added to the generic order. One tag per line will be added. You have to specify the prefix yourself.
+ "doxdocgen.generic.customTags": [],
+
// The template of the param Doxygen line(s) that are generated. If empty it won't get generated at all.
"doxdocgen.generic.paramTemplate": "@param {param} ",
diff --git a/package.json b/package.json
index ec2301a..a596b10 100644
--- a/package.json
+++ b/package.json
@@ -214,7 +214,17 @@
"empty",
"tparam",
"param",
- "return"
+ "return",
+ "custom"
+ ]
+ },
+ "doxdocgen.generic.customTags": {
+ "description": "Custom tags to be added to the generic order. One tag per line will be added. You have to specify the prefix yourself.",
+ "type": [
+ "array",
+ "string"
+ ],
+ "default": [
]
},
"doxdocgen.generic.filteredKeywords": {
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);
+ });
+
});