Skip to content

Commit

Permalink
Fix ASI regex extraction
Browse files Browse the repository at this point in the history
Fixes #143
  • Loading branch information
matthiasmullie committed Nov 10, 2016
1 parent 7dd8d25 commit 9bcf6e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/JS.php
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ protected function extractRegex()
// (https://github.com/matthiasmullie/minify/issues/56)
$operators = $this->getOperatorsForRegex($this->operatorsBefore, '/');
$operators += $this->getOperatorsForRegex($this->keywordsReserved, '/');
$this->registerPattern('/'.$pattern.'\s*\n?(?=\s*('.implode('|', $operators).'))/', $callback);
$this->registerPattern('/'.$pattern.'\s*\n(?=\s*('.implode('|', $operators).'))/', $callback);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions tests/js/JSTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,11 @@ function otherFuncName() {
}",
"if(nutritionalPortionWeightUnit=='lbs'&&blockUnit=='oz'){itemFat=(qty*(fat/nutritionalPortionWeight))/16;itemProtein=(qty*(protein/nutritionalPortionWeight))/16;itemCarbs=(qty*(carbs/nutritionalPortionWeight))/16;itemKcal=(qty*(kcal/nutritionalPortionWeight))/16}",
);
$tests[] = array(
'itemFat = (qty * (fat/nutritionalPortionWeight))/16;
itemFat = (qty * (fat/nutritionalPortionWeight))/(28.3495*16);',
'itemFat=(qty*(fat/nutritionalPortionWeight))/16;itemFat=(qty*(fat/nutritionalPortionWeight))/(28.3495*16)',
);

// update tests' expected results for cross-system compatibility
foreach ($tests as &$test) {
Expand Down

0 comments on commit 9bcf6e2

Please sign in to comment.