Skip to content

Commit

Permalink
[BUGFIX] Reset section stack for the next document
Browse files Browse the repository at this point in the history
Resolves #1093
  • Loading branch information
linawolf committed Oct 2, 2024
1 parent ded7664 commit 9bc8130
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<title>Another Page - Bootstrap Theme</title>
<title>Another Page</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand All @@ -19,22 +19,7 @@
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">

<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a href="/anotherPage.html" class="nav-link current active" aria-current="page">
Another Page
</a>
</li><li class="nav-item">
<a href="/somePage.html" class="nav-link">
Some Page
</a>
</li><li class="nav-item">
<a href="/yetAnotherPage.html" class="nav-link">
Yet Another Page
</a>
</li></ul>


</div>
</div>
</nav>
Expand All @@ -44,35 +29,18 @@
<div class="container">
<div class="row">
<div class="col-lg-3">
<nav class="nav flex-column">
<ul class="menu-level-main">
<li>
<a href="/anotherPage.html"
class="nav-link current active" aria-current="page">Another Page</a>
</li>
<li>
<a href="/somePage.html"
class="nav-link">Some Page</a>
</li>
<li>
<a href="/yetAnotherPage.html"
class="nav-link">Yet Another Page</a>
</li>
</ul>
</nav>


</div>
<div class="col-lg-9">

<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/index.html">Document Title</a></li>
<li class="breadcrumb-item"><a href="/anotherPage.html">Another Page</a></li>
<li class="breadcrumb-item"><a href="index.html">Document Title</a></li>
<li class="breadcrumb-item"><a href="#">Another Page</a></li>
</ol>
</nav>
<!-- content start -->

<div class="section" id="another-page">
<div class="section" id="another-page">
<h1>Another Page</h1>

<p>Lorem Ipsum Dolor.</p>
Expand All @@ -84,14 +52,7 @@ <h1>Another Page</h1>
</div>
</div>
</main>
<footer class="bg-primary text-light">
<div class="container">

<p>Generated by <a href="https://www.phpdoc.org/">phpDocumentor</a>.</p>

</div>
</footer>


<!-- Optional JavaScript; choose one of the two! -->

<!-- Option 1: Bootstrap Bundle with Popper -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<title>Document Title - Bootstrap Theme</title>
<title>Document Title</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand All @@ -19,22 +19,7 @@
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">

<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a href="/anotherPage.html" class="nav-link">
Another Page
</a>
</li><li class="nav-item">
<a href="/somePage.html" class="nav-link">
Some Page
</a>
</li><li class="nav-item">
<a href="/yetAnotherPage.html" class="nav-link">
Yet Another Page
</a>
</li></ul>


</div>
</div>
</nav>
Expand All @@ -44,54 +29,29 @@
<div class="container">
<div class="row">
<div class="col-lg-3">
<nav class="nav flex-column">
<ul class="menu-level-main">
<li>
<a href="/anotherPage.html"
class="nav-link">Another Page</a>
</li>
<li>
<a href="/somePage.html"
class="nav-link">Some Page</a>
</li>
<li>
<a href="/yetAnotherPage.html"
class="nav-link">Yet Another Page</a>
</li>
</ul>
</nav>


</div>
<div class="col-lg-9">

<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/index.html">Document Title</a></li>
<li class="breadcrumb-item"><a href="#">Document Title</a></li>
</ol>
</nav>
<!-- content start -->

<div class="section" id="document-title">
<div class="section" id="document-title">
<h1>Document Title</h1>

<p>Lorem Ipsum Dolor.</p>


</div>
<!-- content end -->
</div>
</div>
</div>
</div>
</main>
<footer class="bg-primary text-light">
<div class="container">

<p>Generated by <a href="https://www.phpdoc.org/">phpDocumentor</a>.</p>

</div>
</footer>


<!-- Optional JavaScript; choose one of the two! -->

<!-- Option 1: Bootstrap Bundle with Popper -->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<title>Some Page - Bootstrap Theme</title>
<title>Some Page</title>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
Expand All @@ -19,22 +19,7 @@
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">

<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a href="/anotherPage.html" class="nav-link">
Another Page
</a>
</li><li class="nav-item">
<a href="/somePage.html" class="nav-link current active" aria-current="page">
Some Page
</a>
</li><li class="nav-item">
<a href="/yetAnotherPage.html" class="nav-link">
Yet Another Page
</a>
</li></ul>


</div>
</div>
</nav>
Expand All @@ -44,38 +29,21 @@
<div class="container">
<div class="row">
<div class="col-lg-3">
<nav class="nav flex-column">
<ul class="menu-level-main">
<li>
<a href="/anotherPage.html"
class="nav-link">Another Page</a>
</li>
<li>
<a href="/somePage.html"
class="nav-link current active" aria-current="page">Some Page</a>
</li>
<li>
<a href="/yetAnotherPage.html"
class="nav-link">Yet Another Page</a>
</li>
</ul>
</nav>


</div>
<div class="col-lg-9">

<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="/index.html">Document Title</a></li>
<li class="breadcrumb-item"><a href="/somePage.html">Some Page</a></li>
<li class="breadcrumb-item"><a href="index.html">Document Title</a></li>
<li class="breadcrumb-item"><a href="#">Some Page</a></li>
</ol>
</nav>
<!-- content start -->

<div class="section" id="some-page">
<div class="section" id="some-page">
<h1>Some Page</h1>

<p>Lorem Ipsum <span class="custom">Dolor</span>.</p>
<p>Lorem Ipsum <code>Dolor</code>.</p>

</div>
<!-- content end -->
Expand All @@ -84,14 +52,7 @@ <h1>Some Page</h1>
</div>
</div>
</main>
<footer class="bg-primary text-light">
<div class="container">

<p>Generated by <a href="https://www.phpdoc.org/">phpDocumentor</a>.</p>

</div>
</footer>


<!-- Optional JavaScript; choose one of the two! -->

<!-- Option 1: Bootstrap Bundle with Popper -->
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
<!-- content start -->
<div class="section" id="page-1">
<h1>Page 1</h1>

<p>This is a Markdown document with some basic formatting.</p>

</div>
<div class="section" id="markdown-with-links">
<div class="section" id="markdown-with-links">
<h1>Markdown with links</h1>

<p>This is a Markdown document with some basic formatting.</p>
Expand Down

0 comments on commit 9bc8130

Please sign in to comment.