From 66631e8409c594d0c526db445cdf99d24b23790b Mon Sep 17 00:00:00 2001 From: "lina.wolf" Date: Wed, 2 Oct 2024 14:41:38 +0200 Subject: [PATCH] [BUGFIX] Reset section stack for the next document Resolves #1093 --- .../SectionCreationTransformer.php | 4 ++ .../default-menu-md/expected/anotherPage.html | 53 +++--------------- .../default-menu-md/expected/index.html | 52 ++---------------- .../default-menu-md/expected/somePage.html | 55 +++---------------- .../markdown-full/default-menu-md/input/skip | 4 -- .../link-page-md/expected/subpages/index.html | 8 +-- 6 files changed, 26 insertions(+), 150 deletions(-) delete mode 100644 tests/Integration/tests-full/markdown-full/default-menu-md/input/skip diff --git a/packages/guides/src/Compiler/NodeTransformers/SectionCreationTransformer.php b/packages/guides/src/Compiler/NodeTransformers/SectionCreationTransformer.php index dbda6251b..4bd481b16 100644 --- a/packages/guides/src/Compiler/NodeTransformers/SectionCreationTransformer.php +++ b/packages/guides/src/Compiler/NodeTransformers/SectionCreationTransformer.php @@ -34,6 +34,10 @@ final class SectionCreationTransformer implements NodeTransformer public function enterNode(Node $node, CompilerContextInterface $compilerContext): Node { + if ($node instanceof DocumentNode) { + $this->sectionStack = []; + } + if (!$compilerContext->getShadowTree()->getParent()?->getNode() instanceof DocumentNode) { return $node; } diff --git a/tests/Integration/tests-full/markdown-full/default-menu-md/expected/anotherPage.html b/tests/Integration/tests-full/markdown-full/default-menu-md/expected/anotherPage.html index 93be8de8b..40a7095c2 100644 --- a/tests/Integration/tests-full/markdown-full/default-menu-md/expected/anotherPage.html +++ b/tests/Integration/tests-full/markdown-full/default-menu-md/expected/anotherPage.html @@ -1,7 +1,7 @@ - Another Page - Bootstrap Theme + Another Page @@ -19,22 +19,7 @@ @@ -44,35 +29,18 @@
- - +
- -
+

Another Page

Lorem Ipsum Dolor.

@@ -84,14 +52,7 @@

Another Page

- - + diff --git a/tests/Integration/tests-full/markdown-full/default-menu-md/expected/index.html b/tests/Integration/tests-full/markdown-full/default-menu-md/expected/index.html index c379fcd2c..eb4e8ef2e 100644 --- a/tests/Integration/tests-full/markdown-full/default-menu-md/expected/index.html +++ b/tests/Integration/tests-full/markdown-full/default-menu-md/expected/index.html @@ -1,7 +1,7 @@ - Document Title - Bootstrap Theme + Document Title @@ -19,22 +19,7 @@
@@ -44,39 +29,21 @@
- - +
- -
+

Document Title

Lorem Ipsum Dolor.

-
@@ -84,14 +51,7 @@

Document Title

- - + diff --git a/tests/Integration/tests-full/markdown-full/default-menu-md/expected/somePage.html b/tests/Integration/tests-full/markdown-full/default-menu-md/expected/somePage.html index f1a9212c3..3fa4bdf7b 100644 --- a/tests/Integration/tests-full/markdown-full/default-menu-md/expected/somePage.html +++ b/tests/Integration/tests-full/markdown-full/default-menu-md/expected/somePage.html @@ -1,7 +1,7 @@ - Some Page - Bootstrap Theme + Some Page @@ -19,22 +19,7 @@
@@ -44,38 +29,21 @@
- - +
- -
+

Some Page

-

Lorem Ipsum Dolor.

+

Lorem Ipsum Dolor.

@@ -84,14 +52,7 @@

Some Page

- - + diff --git a/tests/Integration/tests-full/markdown-full/default-menu-md/input/skip b/tests/Integration/tests-full/markdown-full/default-menu-md/input/skip deleted file mode 100644 index 283d8b2cd..000000000 --- a/tests/Integration/tests-full/markdown-full/default-menu-md/input/skip +++ /dev/null @@ -1,4 +0,0 @@ -* The guides are rendering the content of two pages within one page -* No Menu is displayed -* The breadcrumb is strange. Even though all pages are on the same level -somePage has the following breadcrumb: Another Page / Document Title diff --git a/tests/Integration/tests/markdown/link-page-md/expected/subpages/index.html b/tests/Integration/tests/markdown/link-page-md/expected/subpages/index.html index feea5bcf7..fa8d7dbd5 100644 --- a/tests/Integration/tests/markdown/link-page-md/expected/subpages/index.html +++ b/tests/Integration/tests/markdown/link-page-md/expected/subpages/index.html @@ -1,11 +1,5 @@ -
-

Page 1

- -

This is a Markdown document with some basic formatting.

- -
-