NOW MANAGED ON CODEBERG
Updated page includes to be top-level for code blocks
Dan Browne29d03ae769d
diff --git a/app/Entities/Tools/PageContent.php b/app/Entities/Tools/PageContent.phpindex 52a10ae87..45bfe8fa1 100644--- a/app/Entities/Tools/PageContent.php+++ b/app/Entities/Tools/PageContent.php@@ -390,7 +390,7 @@ class PageContent*/protected function fetchSectionOfPage(Page $page, string $sectionId): string{- $topLevelTags = ['table', 'ul', 'ol'];+ $topLevelTags = ['table', 'ul', 'ol', 'pre'];$doc = $this->loadDocumentFromHtml($page->html);// Search included content for the id given and blank out if not exists.diff --git a/tests/Entity/PageContentTest.php b/tests/Entity/PageContentTest.phpindex 0b99c63c3..4dace533b 100644--- a/tests/Entity/PageContentTest.php+++ b/tests/Entity/PageContentTest.php@@ -62,7 +62,9 @@ class PageContentTest extends TestCasepublic function test_page_includes_do_not_break_tables(){+ /** @var Page $page */$page = Page::query()->first();+ /** @var Page $secondPage */$secondPage = Page::query()->where('id', '!=', $page->id)->first();$content = '<table id="table"><tbody><tr><td>test</td></tr></tbody></table>';@@ -72,8 +74,25 @@ class PageContentTest extends TestCase$page->html = "{{@{$secondPage->id}#table}}";$page->save();- $this->asEditor();- $pageResp = $this->get($page->getUrl());+ $pageResp = $this->asEditor()->get($page->getUrl());+ $pageResp->assertSee($content, false);+ }++ public function test_page_includes_do_not_break_code()+ {+ /** @var Page $page */+ $page = Page::query()->first();+ /** @var Page $secondPage */+ $secondPage = Page::query()->where('id', '!=', $page->id)->first();++ $content = '<pre id="bkmrk-code"><code>var cat = null;</code></pre>';+ $secondPage->html = $content;+ $secondPage->save();++ $page->html = "{{@{$secondPage->id}#bkmrk-code}}";+ $page->save();++ $pageResp = $this->asEditor()->get($page->getUrl());$pageResp->assertSee($content, false);}