From 0879ff97ed4b0b5de572dbf50cc45433b60423f2 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Fri, 16 Aug 2024 01:54:14 +0200 Subject: [PATCH] Fix: giving a review is possible again --- src/UI/SpecialVisualisationUtils.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/UI/SpecialVisualisationUtils.ts b/src/UI/SpecialVisualisationUtils.ts index cd011c2a6..4c5d3100c 100644 --- a/src/UI/SpecialVisualisationUtils.ts +++ b/src/UI/SpecialVisualisationUtils.ts @@ -21,6 +21,12 @@ export default class SpecialVisualisationUtils { * const templ = > templates[0] * templ.func.funcName // => "send_email" * templ.args[0] = "{email}" + * + * // Regression test - multiple special functions should all be found + * const spec = "{create_review()}{list_reviews()}" + * const parsed = SpecialVisualisationUtils.constructSpecification(spec, SpecialVisualisations.specialVisualisationsDict) + * parsed[0].func.funcName // => "create_review" + * parsed[1].func.funcName // => "list_reviews" */ public static constructSpecification( template: string, @@ -40,7 +46,7 @@ export default class SpecialVisualisationUtils { } // Note: the '.*?' in the regex reads as 'any character, but in a non-greedy way' - const matched = template.match(new RegExp(`(.*){\([a-zA-Z_]+\)\\((.*?)\\)(:.*)?}(.*)`, "s")) + const matched = template.match(new RegExp(`(.*?){\([a-zA-Z_]+\)\\((.*?)\\)(:.*)?}(.*)`, "s")) if (matched === null) { // IF we end up here, no changes have to be made - except to remove any resting {} return [template]