Skip to content

Commit c854626

Browse files
committed
Fix error when using slash in closing tag
1 parent 178419f commit c854626

3 files changed

Lines changed: 8 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 1.0.4 - 2020-02-15
2+
### Fixed
3+
- Fix error when using nested atom name (`/`) in closing tag
4+
15
## 1.0.3 - 2020-02-12
26
### Fixed
37
- Fix issue when including a self-closing and closed tag of the same type one

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "ether/atom",
33
"description": "Adding enhanced modularity to Craft CMS Twig templating",
4-
"version": "1.0.3",
4+
"version": "1.0.4",
55
"type": "craft-plugin",
66
"license": "MIT",
77
"minimum-stability": "dev",

src/web/twig/tokenparsers/AtomTokenParser.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ public function parse (Token $token): Node
9494

9595
$stream->expect(Token::PUNCTUATION_TYPE, ':');
9696
$stream->nextIf(Token::PUNCTUATION_TYPE, '[');
97-
foreach (preg_split('/(-)/', $strHandle, -1, PREG_SPLIT_DELIM_CAPTURE) as $word)
97+
foreach (preg_split('/(-|\/)/', $strHandle, -1, PREG_SPLIT_DELIM_CAPTURE) as $word)
9898
{
99-
if ($word === '-') $stream->expect(Token::OPERATOR_TYPE, $word);
99+
if ($word === '-' || $word === '/') $stream->expect(Token::OPERATOR_TYPE, $word);
100100
else $stream->expect(Token::NAME_TYPE, $word);
101101
}
102102
$stream->nextIf(Token::PUNCTUATION_TYPE, ']');
@@ -130,7 +130,7 @@ public function getTag (): string
130130
*/
131131
public function decideBlockEnd (Token $token): bool
132132
{
133-
return $token->test('endx');
133+
return $token->test('end' . $this->getTag());
134134
}
135135

136136
// Helpers

0 commit comments

Comments
 (0)