Fix: giving a review is possible again
This commit is contained in:
parent
af81be70a6
commit
0879ff97ed
1 changed files with 7 additions and 1 deletions
|
@ -21,6 +21,12 @@ export default class SpecialVisualisationUtils {
|
||||||
* const templ = <Exclude<RenderingSpecification, string>> templates[0]
|
* const templ = <Exclude<RenderingSpecification, string>> templates[0]
|
||||||
* templ.func.funcName // => "send_email"
|
* templ.func.funcName // => "send_email"
|
||||||
* templ.args[0] = "{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(
|
public static constructSpecification(
|
||||||
template: string,
|
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'
|
// 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 (matched === null) {
|
||||||
// IF we end up here, no changes have to be made - except to remove any resting {}
|
// IF we end up here, no changes have to be made - except to remove any resting {}
|
||||||
return [template]
|
return [template]
|
||||||
|
|
Loading…
Reference in a new issue