summaryrefslogtreecommitdiff
path: root/ext/js/templates/sandbox
diff options
context:
space:
mode:
authorCashew <52880648+Scrub1492@users.noreply.github.com>2024-01-13 11:58:48 +0700
committerGitHub <noreply@github.com>2024-01-13 04:58:48 +0000
commit36c40ff671ae1f8a05aac77c8694e9bccdda85fb (patch)
tree4bebcaf1659dfb44e25ee60785dbc512aedf3629 /ext/js/templates/sandbox
parent60276d41ffd90044acc2f95e70b9b0c9a770417a (diff)
type updates (#500)
* type updates * remove comments * fix comment * remove types
Diffstat (limited to 'ext/js/templates/sandbox')
-rw-r--r--ext/js/templates/sandbox/anki-template-renderer.js30
1 files changed, 17 insertions, 13 deletions
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<string>} */
+ /**
+ * 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<string>}
+ */
_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<string>} */
+ /**
+ * 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<string>}
+ */
_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) {