Skip to content

Commit 6fb1e90

Browse files
author
Christian Blanquera
committed
options hash in helper args fix
1 parent 7ca03e9 commit 6fb1e90

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/HandlebarsCompiler.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ protected function generateOpen(array $node, array &$open)
499499

500500
if (!$helper) {
501501
//run noop
502-
$node['value'] = 'noop '.$node['value'];
502+
$node['value'] = 'noop ' . $node['value'];
503503
list($name, $args, $hash) = $this->parseArguments($node['value']);
504504
}
505505

@@ -662,13 +662,15 @@ protected function parseArguments($string)
662662
'([a-zA-Z0-9]+\="[^"]*")', // cat="meow"
663663
'([a-zA-Z0-9]+\=\'[^\']*\')', // mouse='squeak squeak'
664664
'([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
665667
];
666668

667669
foreach ($stringArgs as $arg) {
668670
//if it's an attribute
669671
if (!(substr($arg, 0, 1) === "'" && substr($arg, -1) === "'")
670672
&& !(substr($arg, 0, 1) === '"' && substr($arg, -1) === '"')
671-
&& preg_match('#'.implode('|', $hashRegex).'#is', $arg)
673+
&& preg_match('#' . implode('|', $hashRegex) . '#is', $arg)
672674
) {
673675
list($hashKey, $hashValue) = explode('=', $arg, 2);
674676
$hash[$hashKey] = $this->parseArgument($hashValue);

0 commit comments

Comments
 (0)