Skip to content

Commit 0a8ea64

Browse files
Add additional aliases for plain text
1 parent 9c57186 commit 0a8ea64

File tree

15 files changed

+22
-25
lines changed

15 files changed

+22
-25
lines changed

meta/stubs/Grammar.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function aliases(): array
1616
return match ($this) {
1717
{aliases}
1818
self::Antlers => [],
19-
self::Txt => [],
19+
self::Txt => ['plaintext', 'text', 'plain'],
2020
};
2121
}
2222

src/Adapters/CommonMark/Transformers/MetaTransformer.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
namespace Phiki\Adapters\CommonMark\Transformers;
44

55
use Phiki\Phast\Element;
6-
use Phiki\Support\Arr;
76
use Phiki\Transformers\AbstractTransformer;
87

98
class MetaTransformer extends AbstractTransformer
@@ -62,9 +61,9 @@ protected function parse(): void
6261
}
6362

6463
$highlights = array_map(
65-
fn(array $part) => count($part) > 1 ? $part : $part[0],
64+
fn (array $part) => count($part) > 1 ? $part : $part[0],
6665
array_map(
67-
fn(string $part) => array_map(fn(string $number) => intval($number), explode('-', trim($part))),
66+
fn (string $part) => array_map(fn (string $number) => intval($number), explode('-', trim($part))),
6867
explode(',', $highlights)
6968
)
7069
);
@@ -84,9 +83,9 @@ protected function parse(): void
8483
}
8584

8685
$focuses = array_map(
87-
fn(array $part) => count($part) > 1 ? $part : $part[0],
86+
fn (array $part) => count($part) > 1 ? $part : $part[0],
8887
array_map(
89-
fn(string $part) => array_map(fn(string $number) => intval($number), explode('-', trim($part))),
88+
fn (string $part) => array_map(fn (string $number) => intval($number), explode('-', trim($part))),
9089
explode(',', $focuses)
9190
)
9291
);

src/Grammar/Grammar.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
use Phiki\Contracts\GrammarRepositoryInterface;
66

7+
// This file is automatically generated and should not be edited manually.
78
enum Grammar: string
89
{
910
case Txt = 'txt';
@@ -449,7 +450,7 @@ public function aliases(): array
449450
self::Zenscript => [],
450451
self::Zig => [],
451452
self::Antlers => [],
452-
self::Txt => [],
453+
self::Txt => ['plaintext', 'text', 'plain'],
453454
};
454455
}
455456

src/Output/Html/PendingHtmlOutput.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function transformer(TransformerInterface $transformer): self
9191
return $this;
9292
}
9393

94-
public function decoration(LineDecoration | PreDecoration | CodeDecoration | GutterDecoration ...$decorations): self
94+
public function decoration(LineDecoration|PreDecoration|CodeDecoration|GutterDecoration ...$decorations): self
9595
{
9696
if (! Arr::any($this->transformers, fn (TransformerInterface $transformer) => $transformer instanceof DecorationTransformer)) {
9797
$this->transformers[] = new DecorationTransformer($this->decorations);
@@ -168,7 +168,7 @@ public function __toString(): string
168168
}
169169

170170
if (! isset($this->meta)) {
171-
$this->meta = new Meta();
171+
$this->meta = new Meta;
172172
}
173173

174174
foreach ($this->transformers as $transformer) {
@@ -227,7 +227,7 @@ public function __toString(): string
227227
])));
228228

229229
$gutter->children[] = new Text(sprintf('%2d', $this->startingLineNumber + $index));
230-
230+
231231
[$gutter] = $this->callTransformerMethod('gutter', $gutter, $index);
232232

233233
$line->children[] = $gutter;

src/Phast/Properties.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function remove(string $key): self
3939

4040
public function __toString(): string
4141
{
42-
$properties = array_filter($this->properties, fn ($value) => $value instanceof ClassList ? (! $value->isEmpty()) : (!! $value));
42+
$properties = array_filter($this->properties, fn ($value) => $value instanceof ClassList ? (! $value->isEmpty()) : ((bool) $value));
4343

4444
return implode(' ', array_map(
4545
fn ($key, $value) => sprintf('%s="%s"', $key, $value),

src/Theme/Theme.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use Phiki\Contracts\ThemeRepositoryInterface;
66

7-
// This file is automatically generated and should not be edited manually.
87
enum Theme: string
98
{
109
case Andromeeda = 'andromeeda';

src/Transformers/Decorations/CodeDecoration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ public function __construct(
1212

1313
public static function make(): self
1414
{
15-
return new self(new ClassList());
15+
return new self(new ClassList);
1616
}
1717

1818
public function class(string ...$classes): self
1919
{
2020
$this->classes->add(...$classes);
21-
21+
2222
return $this;
2323
}
2424
}

src/Transformers/Decorations/GutterDecoration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public function __construct(
1212

1313
public static function make(): self
1414
{
15-
return new self(new ClassList());
15+
return new self(new ClassList);
1616
}
1717

1818
public function class(string ...$classes): self

src/Transformers/Decorations/LineDecoration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ public function __construct(
1616

1717
public static function forLine(int $line): self
1818
{
19-
return new self($line, new ClassList());
19+
return new self($line, new ClassList);
2020
}
2121

2222
public function class(string ...$classes): self
2323
{
2424
$this->classes->add(...$classes);
25-
25+
2626
return $this;
2727
}
2828

src/Transformers/Decorations/PreDecoration.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ public function __construct(
1212

1313
public static function make(): self
1414
{
15-
return new self(new ClassList());
15+
return new self(new ClassList);
1616
}
1717

1818
public function class(string ...$classes): self
1919
{
2020
$this->classes->add(...$classes);
21-
21+
2222
return $this;
2323
}
2424
}

0 commit comments

Comments
 (0)