1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-08-06 12:02:45 +03:00

Includes: Added back support for parse theme event

Managed to do this in an API-compatible way although resuling output may
differ due to new dom handling in general, although user content is used
inline to remain as comptable as possible.
This commit is contained in:
Dan Brown
2023-11-27 21:38:43 +00:00
parent b569827114
commit 652d5417bf
7 changed files with 106 additions and 35 deletions

View File

@@ -2,7 +2,9 @@
namespace Tests\Unit;
use BookStack\Entities\Tools\PageIncludeContent;
use BookStack\Entities\Tools\PageIncludeParser;
use BookStack\Entities\Tools\PageIncludeTag;
use BookStack\Util\HtmlDocument;
use Tests\TestCase;
@@ -227,8 +229,9 @@ class PageIncludeParserTest extends TestCase
protected function runParserTest(string $html, array $contentById, string $expected): void
{
$doc = new HtmlDocument($html);
$parser = new PageIncludeParser($doc, function (int $id) use ($contentById) {
return $contentById[strval($id)] ?? '';
$parser = new PageIncludeParser($doc, function (PageIncludeTag $tag) use ($contentById): PageIncludeContent {
$html = $contentById[strval($tag->getPageId())] ?? '';
return PageIncludeContent::fromHtmlAndTag($html, $tag);
});
$parser->parse();