From 618fabcba60ecae04c2be4f030735a2218cdd945 Mon Sep 17 00:00:00 2001 From: helixquar <16344025+helixquar@users.noreply.github.com> Date: Thu, 22 Dec 2022 14:45:56 +0800 Subject: [PATCH 1/2] Allow "{date}" substitution in @author tag. --- src/Lang/Cpp/CppDocGen.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Lang/Cpp/CppDocGen.ts b/src/Lang/Cpp/CppDocGen.ts index 022b372..5a9fc2e 100644 --- a/src/Lang/Cpp/CppDocGen.ts +++ b/src/Lang/Cpp/CppDocGen.ts @@ -222,6 +222,10 @@ export class CppDocGen implements IDocGen { } protected generateAuthorTag(lines: string[]) { + let dateFormat: string = "YYYY-MM-DD"; // Default to ISO standard if not defined + if ( this.cfg.Generic.dateFormat.trim().length !== 0) { + dateFormat = this.cfg.Generic.dateFormat; // Overwrite with user format + } if (this.cfg.Generic.authorTag.trim().length !== 0) { const authorInfo = this.getAuthorInfo(); // Allow substitution of {author} and {email} only @@ -231,6 +235,7 @@ export class CppDocGen implements IDocGen { [ { toReplace: this.cfg.authorTemplateReplace, with: authorInfo.authorName }, { toReplace: this.cfg.emailTemplateReplace, with: authorInfo.authorEmail }, + { toReplace: this.cfg.dateTemplateReplace, with: moment().format(dateFormat) }, ], ).split("\n"), ); From 5d9849c4d344664d96288234aae4a499e5ab5474 Mon Sep 17 00:00:00 2001 From: helixquar <16344025+helixquar@users.noreply.github.com> Date: Thu, 22 Dec 2022 14:53:09 +0800 Subject: [PATCH 2/2] Update comment to new behavior --- src/Lang/Cpp/CppDocGen.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Lang/Cpp/CppDocGen.ts b/src/Lang/Cpp/CppDocGen.ts index 5a9fc2e..d83ad9a 100644 --- a/src/Lang/Cpp/CppDocGen.ts +++ b/src/Lang/Cpp/CppDocGen.ts @@ -228,7 +228,7 @@ export class CppDocGen implements IDocGen { } if (this.cfg.Generic.authorTag.trim().length !== 0) { const authorInfo = this.getAuthorInfo(); - // Allow substitution of {author} and {email} only + // Allow substitution of {author}, {email}, and {date} only lines.push( ...templates.getMultiTemplatedString( this.cfg.Generic.authorTag,