From 36c40ff671ae1f8a05aac77c8694e9bccdda85fb Mon Sep 17 00:00:00 2001 From: Cashew <52880648+Scrub1492@users.noreply.github.com> Date: Sat, 13 Jan 2024 11:58:48 +0700 Subject: type updates (#500) * type updates * remove comments * fix comment * remove types --- ext/js/templates/sandbox/anki-template-renderer.js | 30 ++++++++++++---------- 1 file changed, 17 insertions(+), 13 deletions(-) (limited to 'ext/js/templates/sandbox') diff --git a/ext/js/templates/sandbox/anki-template-renderer.js b/ext/js/templates/sandbox/anki-template-renderer.js index 15810239..3311097f 100644 --- a/ext/js/templates/sandbox/anki-template-renderer.js +++ b/ext/js/templates/sandbox/anki-template-renderer.js @@ -235,14 +235,16 @@ export class AnkiTemplateRenderer { return this._stringToMultiLineHtml(this._computeValueString(options, context)); } - /** @type {import('template-renderer').HelperFunction} */ + /** + * Usage: + * ```{{#regexReplace regex string [flags] [content]...}}content{{/regexReplace}}``` + * - regex: regular expression string + * - string: string to replace + * - flags: optional flags for regular expression. + * e.g. "i" for case-insensitive, "g" for replace all + * @type {import('template-renderer').HelperFunction} + */ _regexReplace(args, context, options) { - // Usage: - // {{#regexReplace regex string [flags] [content]...}}content{{/regexReplace}} - // regex: regular expression string - // string: string to replace - // flags: optional flags for regular expression - // e.g. "i" for case-insensitive, "g" for replace all const argCount = args.length; let value = this._computeValueString(options, context); if (argCount > 3) { @@ -262,13 +264,15 @@ export class AnkiTemplateRenderer { return value; } - /** @type {import('template-renderer').HelperFunction} */ + /** + * Usage: + * {{#regexMatch regex [flags] [content]...}}content{{/regexMatch}} + * - regex: regular expression string + * - flags: optional flags for regular expression + * e.g. "i" for case-insensitive, "g" for match all + * @type {import('template-renderer').HelperFunction} + */ _regexMatch(args, context, options) { - // Usage: - // {{#regexMatch regex [flags] [content]...}}content{{/regexMatch}} - // regex: regular expression string - // flags: optional flags for regular expression - // e.g. "i" for case-insensitive, "g" for match all const argCount = args.length; let value = this._computeValueString(options, context); if (argCount > 2) { -- cgit v1.2.3