From 512cbf80140e2584eb90099986f93c90a35ca66c Mon Sep 17 00:00:00 2001 From: "pmoreno.rodriguez" Date: Wed, 14 Aug 2024 19:20:04 +0200 Subject: [PATCH] Allows dash to be used in parameter, using shortcode in twig (issue #125) --- .../thunderer/shortcode/src/Utility/RegexBuilderUtility.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/vendor/thunderer/shortcode/src/Utility/RegexBuilderUtility.php b/vendor/thunderer/shortcode/src/Utility/RegexBuilderUtility.php index 847ff38..563806f 100644 --- a/vendor/thunderer/shortcode/src/Utility/RegexBuilderUtility.php +++ b/vendor/thunderer/shortcode/src/Utility/RegexBuilderUtility.php @@ -40,7 +40,7 @@ public static function buildParametersRegex(SyntaxInterface $syntax) // equals sign and value without unescaped string delimiters enclosed in them $complex = $space.$equals.$space.$string.'([^'.$string.'\\\\]*(?:\\\\.[^'.$string.'\\\\]*)*?)'.$string; - return '~(?:\s*(\w+(?:'.$complex.'|'.$simple.'|'.$empty.')))~us'; + return '~(?:\s*([\w-]+(?:'.$complex.'|'.$simple.'|'.$empty.')))~us'; } /** @return string */ @@ -63,7 +63,7 @@ private static function createShortcodeRegexContent(SyntaxInterface $syntax) // equals sign and value without unescaped string delimiters enclosed in them $complex = $string.'(?:[^'.$string.'\\\\]*(?:\\\\.[^'.$string.'\\\\]*)*)'.$string; // complete parameters matching regex - $parameters = '(?(?:\s*(?:\w+(?:'.$equalsSpaced.$complex.'|'.$equalsSpaced.$simple.'|'.$empty.')))*)'; + $parameters = '(?(?:\s*(?:[\w-]+(?:'.$equalsSpaced.$complex.'|'.$equalsSpaced.$simple.'|'.$empty.')))*)'; // BBCode is the part after name that makes it behave like a non-empty parameter value $bbCode = '(?:'.$equals.$space.'(?'.$complex.'|'.$simple.'))?';