Skip to content

Commit

Permalink
Support dotted notation on namespaced components
Browse files Browse the repository at this point in the history
  • Loading branch information
tonysm committed Oct 20, 2024
1 parent 145bd4e commit 3af0a70
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@
use Tempest\Highlight\PatternTest;
use Tempest\Highlight\Tokens\TokenTypeEnum;

#[PatternTest(input: '</a>', output: 'a')]
#[PatternTest(input: '</x-hello>', output: 'x-hello')]
#[PatternTest(input: '</x-hello::world>', output: 'x-hello::world')]
#[PatternTest(input: '</a>', output: 'a')]
#[PatternTest(input: '</x-hello::world.lorem>', output: 'x-hello::world.lorem')]
final readonly class BladeComponentCloseTagPattern implements Pattern
{
use IsPattern;

public function getPattern(): string
{
return '<\/(?<match>[\w\-\:]+)';
return '<\/(?<match>[\w\-\:\.]+)';
}

public function getTokenType(): TokenTypeEnum
Expand Down
5 changes: 3 additions & 2 deletions src/Languages/Blade/Patterns/BladeComponentOpenTagPattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,17 @@
use Tempest\Highlight\PatternTest;
use Tempest\Highlight\Tokens\TokenTypeEnum;

#[PatternTest(input: '<a attr="">', output: 'a')]
#[PatternTest(input: '<x-hello attr="">', output: 'x-hello')]
#[PatternTest(input: '<x-hello::world attr="">', output: 'x-hello::world')]
#[PatternTest(input: '<a attr="">', output: 'a')]
#[PatternTest(input: '<x-hello::world.lorem attr="">', output: 'x-hello::world.lorem')]
final readonly class BladeComponentOpenTagPattern implements Pattern
{
use IsPattern;

public function getPattern(): string
{
return '<(?<match>[\w\-\:]+)';
return '<(?<match>[\w\-\:\.]+)';
}

public function getTokenType(): TokenTypeEnum
Expand Down

0 comments on commit 3af0a70

Please sign in to comment.