Create a customized myers diff based system for snip content

This commit is contained in:
Tim
2025-04-14 23:25:11 +02:00
parent a18eda6748
commit 2db9c5f1d9
8 changed files with 317 additions and 88 deletions

View File

@ -5,6 +5,7 @@ namespace App\Service\SnipParser\Stages;
use App\Repository\SnipContentRepository;
use App\Repository\SnipRepository;
use App\Security\Voter\SnipVoter;
use App\Service\SnipContent\SnipContentService;
use App\Service\SnipParser\Pipeline;
use League\Pipeline\StageInterface;
use Symfony\Bundle\SecurityBundle\Security;
@ -17,6 +18,7 @@ class IncludeReferenceStage implements StageInterface
#[Autowire(lazy: true)] private readonly SnipRepository $snipRepository,
#[Autowire(lazy: true)] private readonly SnipContentRepository $snipContentRepository,
#[Autowire(lazy: true)] private readonly Pipeline $pipeline,
#[Autowire(lazy: true)] private readonly SnipContentService $snipContentService,
) {}
public function __invoke(mixed $payload): string
@ -51,7 +53,9 @@ class IncludeReferenceStage implements StageInterface
return sprintf('<span title="access denied">%s</span>', $matches[0]);
}
return $this->pipeline->parse($content->getText());
return $this->pipeline->parse(
$this->snipContentService->rebuildText($content)
);
}, $payload);
}
}