diff --git a/app/Data/Casts/ChangelogCast.php b/app/Data/Casts/ChangelogCast.php
index 021937d..30d3f45 100644
--- a/app/Data/Casts/ChangelogCast.php
+++ b/app/Data/Casts/ChangelogCast.php
@@ -26,11 +26,13 @@ class ChangelogCast implements Cast
'allow_unsafe_links' => false,
];
- protected array $tagsFrom = ['h2', '
', ''];
+ protected array $tagsFrom = ['h2', '', '', ''];
- protected array $tagsTo = ['b', '- ', ''];
+ protected array $tagsTo = ['b', '- ', '', '', '
'];
- protected array $allowedTags = ['h2', 'li', 'i', 'em'];
+ protected array $allowedTags = ['h2', 'li', 'i', 'em', 'ul'];
+
+ protected string $resolveSpaces = '/\n?\s*(.+)\n?\s*<\/li>/';
public function cast(DataProperty $property, mixed $value, array $properties, CreationContext $context): string
{
@@ -38,8 +40,8 @@ public function cast(DataProperty $property, mixed $value, array $properties, Cr
->replaceMatches([$this->from, $this->fullLink], '')
->replaceMatches($this->contributors, $this->contributor)
->trim()
- ->limitRows($this->limit())
->markdown($this->options)
+ ->replaceMatches($this->resolveSpaces, '$1')
->stripTags($this->allowedTags)
->replace($this->tagsFrom, $this->tagsTo)
->replaceMatches('/-\s+\[(.+)]/', $this->listItem)
@@ -67,9 +69,4 @@ protected function emoji(): EmojiDetector
{
return new EmojiDetector();
}
-
- protected function limit(): int
- {
- return config('services.telegram.changelog.limit');
- }
}
diff --git a/app/Providers/.gitkeep b/app/Providers/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/app/Providers/StringServiceProvider.php b/app/Providers/StringServiceProvider.php
deleted file mode 100644
index 66ebe08..0000000
--- a/app/Providers/StringServiceProvider.php
+++ /dev/null
@@ -1,46 +0,0 @@
-explode("\n")->unique(
- fn (string $value) => Str::startsWith($value, '-') ? $value : Str::random()
- );
-
- $need = $limit;
-
- $lines = 0;
-
- $rows->each(function (string $value) use (&$lines, &$need) {
- if (Str::of($value)->trim()->startsWith('-')) {
- --$need;
- }
-
- if ($need > 0) {
- ++$lines;
- }
- });
-
- $result = $rows->take($lines)->when($need < 0, function (Collection $items) use ($need) {
- $count = abs($need);
-
- $pluralized = $count === 1 ? 'change' : 'changes';
-
- $items->push("\n_(and $count more $pluralized)_");
- })->implode(PHP_EOL);
-
- return new Stringable($result);
- });
- }
-}
diff --git a/bootstrap/providers.php b/bootstrap/providers.php
index 3926ce6..e73ba5b 100644
--- a/bootstrap/providers.php
+++ b/bootstrap/providers.php
@@ -1,9 +1,7 @@
[
- 'limit' => 20,
- ],
-
'max_errors' => 10,
],