Skip to content

Commit 47af089

Browse files
author
Christian Blanquera
committed
fixed parse args for hash key values being data paths
1 parent 6fb1e90 commit 47af089

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

src/HandlebarsCompiler.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -645,12 +645,13 @@ protected function parseArguments($string)
645645
$hash = [];
646646

647647
$regex = [
648-
'([a-zA-Z0-9]+\="[^"]*")', // cat="meow"
649-
'([a-zA-Z0-9]+\=\'[^\']*\')', // mouse='squeak squeak'
650-
'([a-zA-Z0-9]+\=[a-zA-Z0-9]+)', // dog=false
651-
'("[^"]*")', // "some\'thi ' ng"
652-
'(\'[^\']*\')', // 'some"thi " ng'
653-
'([^\s]+)' // <any group with no spaces>
648+
'([a-zA-Z0-9\-_]+\="[^"]*")', // cat="meow"
649+
'([a-zA-Z0-9\-_]+\=\'[^\']*\')', // mouse='squeak squeak'
650+
'([a-zA-Z0-9\-_]+\=[a-zA-Z0-9_\./]+)', // dog=false dog=./woof dog=.././woof
651+
'([a-zA-Z0-9\-_]+\=@[a-zA-Z0-9_]+)', // dog=@woof
652+
'("[^"]*")', // "some\'thi ' ng"
653+
'(\'[^\']*\')', // 'some"thi " ng'
654+
'([^\s]+)', // <any group with no spaces>
654655
];
655656

656657
preg_match_all('#'.implode('|', $regex).'#is', $string, $matches);
@@ -659,11 +660,10 @@ protected function parseArguments($string)
659660
$name = array_shift($stringArgs);
660661

661662
$hashRegex = [
662-
'([a-zA-Z0-9]+\="[^"]*")', // cat="meow"
663-
'([a-zA-Z0-9]+\=\'[^\']*\')', // mouse='squeak squeak'
664-
'([a-zA-Z0-9]+\=[a-zA-Z0-9]+)', // dog=false
665-
'([a-zA-Z0-9]+\=@[a-zA-Z0-9_]+)', // dog=@woof
666-
'([a-zA-Z0-9]+\=[a-zA-Z0-9_\./]+)', // dog=./woof dog=.././woof
663+
'([a-zA-Z0-9\-_]+\="[^"]*")', // cat="meow"
664+
'([a-zA-Z0-9\-_]+\=\'[^\']*\')', // mouse='squeak squeak'
665+
'([a-zA-Z0-9\-_]+\=[a-zA-Z0-9_\./]+)', // dog=false dog=./woof dog=.././woof
666+
'([a-zA-Z0-9\-_]+\=@[a-zA-Z0-9_]+)', // dog=@woof
667667
];
668668

669669
foreach ($stringArgs as $arg) {

0 commit comments

Comments
 (0)