From 34e8e242f6f066f813493a2f6765909d41eab5e2 Mon Sep 17 00:00:00 2001 From: mic Date: Tue, 10 Feb 2026 21:42:26 +0100 Subject: [PATCH] hasPlaceholder and replacePlaceholder can now work with dynamic placeholders. see #525 #554 --- js/mzta-placeholders.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/mzta-placeholders.js b/js/mzta-placeholders.js index 171267fb..2b05e7d1 100644 --- a/js/mzta-placeholders.js +++ b/js/mzta-placeholders.js @@ -436,7 +436,7 @@ export const placeholdersUtils = { return match; } // Replace if found, otherwise keep the original or substitute with default value - return replacements[p1] || (use_default_value ? currPlaceholder.default_value : match); + return replacements[p1] || replacements[currPlaceholder.id] || (use_default_value ? currPlaceholder.default_value : match); }); }, @@ -459,7 +459,7 @@ export const placeholdersUtils = { // If a specific placeholder is provided, we search for it if (placeholder !== "") { // Dynamically build the regex for the specific placeholder - regex = new RegExp(`{%\s*${placeholder}\s*%}`); + regex = new RegExp(`{%\s*${placeholder}(:.*?)?\s*%}`); } else { // Otherwise, we search for any placeholder in the format {% ... %} regex = /{%\s*(.*?)\s*%}/;