Skip to content

Commit

Permalink
Fix issue with hyphens in endx names
Browse files Browse the repository at this point in the history
  • Loading branch information
Tam committed Feb 12, 2021
1 parent 0a60be1 commit 8b68556
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.0.2 - 2020-02-12
### Fixed
- Fix issue with hyphens in endx names

## 1.0.1 - 2020-02-12
### Improved
- Added self-closing tag support!
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ether/atom",
"description": "Adding enhanced modularity to Craft CMS Twig templating",
"version": "1.0.1",
"version": "1.0.2",
"type": "craft-plugin",
"license": "MIT",
"minimum-stability": "dev",
Expand Down
6 changes: 5 additions & 1 deletion src/web/twig/tokenparsers/AtomTokenParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,11 @@ public function parse (Token $token): Node

$stream->expect(Token::PUNCTUATION_TYPE, ':');
$stream->nextIf(Token::PUNCTUATION_TYPE, '[');
$stream->expect(Token::NAME_TYPE, $strHandle);
foreach (preg_split('/(-)/', $strHandle, -1, PREG_SPLIT_DELIM_CAPTURE) as $word)
{
if ($word === '-') $stream->expect(Token::OPERATOR_TYPE, $word);
else $stream->expect(Token::NAME_TYPE, $word);
}
$stream->nextIf(Token::PUNCTUATION_TYPE, ']');
}

Expand Down

0 comments on commit 8b68556

Please sign in to comment.