Skip to content

Commit 01df60f

Browse files
author
matheo
committed
fix attribute regex
1 parent 4bfbee5 commit 01df60f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/TwigComponent/src/Twig/ComponentLexer.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,12 @@
2121
* @internal
2222
*
2323
* thanks to @giorgiopogliani for the inspiration on this lexer <3
24+
*
2425
* @see https://github.com/giorgiopogliani/twig-components
2526
*/
2627
class ComponentLexer extends Lexer
2728
{
28-
public const ATTRIBUTES_REGEX = '(?<attributes>(?:\s+[\w\-:.@]+(=(?:\\\"[^\\\"]*\\\"|\'[^\']*\'|[^\'\\\"=<>]+))?)*\s*)';
29+
public const ATTRIBUTES_REGEX = '(?<attributes>(?:\s+[\w\-:.@]+(=(?:"[^"]*"|\'[^\']*\'|[^\'\\\"=<>]+))?)*\s*)';
2930
public const OPEN_TAGS_REGEX = '/<\s*t:(?<name>([[\w\-\:\.]+))\s*'.self::ATTRIBUTES_REGEX.'(\s?)+>/';
3031
public const CLOSE_TAGS_REGEX = '/<\/\s*t:([\w\-\:\.]+)\s*>/';
3132
public const SELF_CLOSE_TAGS_REGEX = '/<\s*t:(?<name>([\w\-\:\.]+))\s*'.self::ATTRIBUTES_REGEX.'(\s?)+\/>/';
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
<t:component_a propA propB='hello'>
1+
<t:component_a propA propB="hello">
22
</t:component_a>

0 commit comments

Comments
 (0)