Skip to content

Commit

Permalink
[BUGFIX] Correct Menu levels in global menu tree
Browse files Browse the repository at this point in the history
Resolves #803
  • Loading branch information
linawolf committed Jan 6, 2024
1 parent d160f4c commit 5165cfd
Show file tree
Hide file tree
Showing 22 changed files with 48 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
{% if node.caption %}
<h2>{{ renderNode(node.caption) }}</h2>
{% endif %}
<ul class="level-1">
<ul class="menu-level-main">
{% for entry in node.menuEntries -%}
<li><a href="{{ renderLink(entry.url) }}"
class="nav-link {%- if node.currentPath == entry.url %} current {%- endif -%}{% if entry.url in node.rootlinePaths %} active {%- endif -%}"
Expand Down
2 changes: 1 addition & 1 deletion packages/guides/src/Compiler/Passes/GlobalMenuPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ private function getMenuEntryWithChildren(CompilerContext $compilerContext, Menu
return $menuEntry;
}

$newMenuEntry = new InternalMenuEntryNode($menuEntry->getUrl(), $menuEntry->getValue(), [], false, 2);
$newMenuEntry = new InternalMenuEntryNode($menuEntry->getUrl(), $menuEntry->getValue(), [], false, 1);
$maxdepth = $this->settingsManager->getProjectSettings()->getMaxMenuDepth();
$maxdepth = $maxdepth < 1 ? PHP_INT_MAX : $maxdepth + 1;
$documentEntryOfMenuEntry = $compilerContext->getProjectNode()->getDocumentEntry($menuEntry->getUrl());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<div class="col-lg-3">
<nav class="nav flex-column">
<h2>Main Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="#"
class="nav-link current active" aria-current="page" >
Another Page
Expand All @@ -79,7 +79,7 @@ <h2>Main Menu</h2>
class="nav-link">
Subpages
</a>
<ul class="level-2">
<ul class="level-1">
<li><a href="subpages/subpage1.html"
class="nav-link">
Subpages 1
Expand All @@ -95,7 +95,7 @@ <h2>Main Menu</h2>
</nav>
<nav class="nav flex-column">
<h2>Additional Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="yetAnotherPage.html"
class="nav-link">
Yet Another Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<div class="col-lg-3">
<nav class="nav flex-column">
<h2>Main Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="anotherPage.html"
class="nav-link">
Another Page
Expand All @@ -79,7 +79,7 @@ <h2>Main Menu</h2>
class="nav-link">
Subpages
</a>
<ul class="level-2">
<ul class="level-1">
<li><a href="subpages/subpage1.html"
class="nav-link">
Subpages 1
Expand All @@ -95,7 +95,7 @@ <h2>Main Menu</h2>
</nav>
<nav class="nav flex-column">
<h2>Additional Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="yetAnotherPage.html"
class="nav-link">
Yet Another Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<div class="col-lg-3">
<nav class="nav flex-column">
<h2>Main Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="anotherPage.html"
class="nav-link">
Another Page
Expand All @@ -79,7 +79,7 @@ <h2>Main Menu</h2>
class="nav-link">
Subpages
</a>
<ul class="level-2">
<ul class="level-1">
<li><a href="subpages/subpage1.html"
class="nav-link">
Subpages 1
Expand All @@ -95,7 +95,7 @@ <h2>Main Menu</h2>
</nav>
<nav class="nav flex-column">
<h2>Additional Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="yetAnotherPage.html"
class="nav-link">
Yet Another Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<div class="col-lg-3">
<nav class="nav flex-column">
<h2>Main Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="../anotherPage.html"
class="nav-link">
Another Page
Expand All @@ -79,7 +79,7 @@ <h2>Main Menu</h2>
class="nav-link current active" aria-current="page" >
Subpages
</a>
<ul class="level-2">
<ul class="level-1">
<li><a href="subpage1.html"
class="nav-link">
Subpages 1
Expand All @@ -95,7 +95,7 @@ <h2>Main Menu</h2>
</nav>
<nav class="nav flex-column">
<h2>Additional Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="../yetAnotherPage.html"
class="nav-link">
Yet Another Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<div class="col-lg-3">
<nav class="nav flex-column">
<h2>Main Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="../anotherPage.html"
class="nav-link">
Another Page
Expand All @@ -79,7 +79,7 @@ <h2>Main Menu</h2>
class="nav-link active">
Subpages
</a>
<ul class="level-2">
<ul class="level-1">
<li><a href="#"
class="nav-link current active" aria-current="page">
Subpages 1
Expand All @@ -95,7 +95,7 @@ <h2>Main Menu</h2>
</nav>
<nav class="nav flex-column">
<h2>Additional Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="../yetAnotherPage.html"
class="nav-link">
Yet Another Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<div class="col-lg-3">
<nav class="nav flex-column">
<h2>Main Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="../anotherPage.html"
class="nav-link">
Another Page
Expand All @@ -79,7 +79,7 @@ <h2>Main Menu</h2>
class="nav-link active">
Subpages
</a>
<ul class="level-2">
<ul class="level-1">
<li><a href="subpage1.html"
class="nav-link">
Subpages 1
Expand All @@ -95,7 +95,7 @@ <h2>Main Menu</h2>
</nav>
<nav class="nav flex-column">
<h2>Additional Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="../yetAnotherPage.html"
class="nav-link">
Yet Another Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<div class="col-lg-3">
<nav class="nav flex-column">
<h2>Main Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="anotherPage.html"
class="nav-link">
Another Page
Expand All @@ -79,7 +79,7 @@ <h2>Main Menu</h2>
class="nav-link">
Subpages
</a>
<ul class="level-2">
<ul class="level-1">
<li><a href="subpages/subpage1.html"
class="nav-link">
Subpages 1
Expand All @@ -95,7 +95,7 @@ <h2>Main Menu</h2>
</nav>
<nav class="nav flex-column">
<h2>Additional Menu</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="#"
class="nav-link current active" aria-current="page" >
Yet Another Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<div class="row">
<div class="col-lg-3">
<nav class="nav flex-column">
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="/anotherPage.html"
class="nav-link current active" aria-current="page" >
Another Page
Expand Down Expand Up @@ -79,7 +79,7 @@


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

<p>Lorem Ipsum Dolor.</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<div class="row">
<div class="col-lg-3">
<nav class="nav flex-column">
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="/anotherPage.html"
class="nav-link">
Another Page
Expand Down Expand Up @@ -78,7 +78,7 @@


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

<p>Lorem Ipsum Dolor.</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
<div class="row">
<div class="col-lg-3">
<nav class="nav flex-column">
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="/anotherPage.html"
class="nav-link">
Another Page
Expand Down Expand Up @@ -79,7 +79,7 @@


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

<p>Lorem Ipsum <span class="custom">Dolor</span>.</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<div class="row">
<div class="col-lg-3">
<nav class="nav flex-column">
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="someDirectory/index.html"
class="nav-link">
Some Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
<div class="row">
<div class="col-lg-3">
<nav class="nav flex-column">
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="someDirectory/index.html"
class="nav-link">
Some Page
</a>
<ul class="level-2">
<ul class="level-1">
<li><a href="someDirectory/anotherDirectory/index.html"
class="nav-link">
Another Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
<div class="row">
<div class="col-lg-3">
<nav class="nav flex-column">
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="someDirectory/index.html"
class="nav-link">
Some Page
</a>
<ul class="level-2">
<ul class="level-1">
<li><a href="someDirectory/anotherDirectory/index.html"
class="nav-link">
Another Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
<div class="row">
<div class="col-lg-3">
<nav class="nav flex-column">
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="someDirectory/index.html"
class="nav-link">
Some Page
</a>
<ul class="level-2">
<ul class="level-1">
<li><a href="someDirectory/anotherDirectory/index.html"
class="nav-link">
Another Page
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<div class="rubric">Main Menu</div>

<nav class="nav flex-column">
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="/anotherPage.html"
class="nav-link">
Another Page
Expand Down Expand Up @@ -79,7 +79,7 @@


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

<p>Lorem Ipsum Dolor.</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<div class="rubric">Main Menu</div>

<nav class="nav flex-column">
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="/anotherPage.html"
class="nav-link">
Another Page
Expand Down Expand Up @@ -78,7 +78,7 @@


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

<p>Lorem Ipsum Dolor.</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<div class="rubric">Main Menu</div>

<nav class="nav flex-column">
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="/anotherPage.html"
class="nav-link">
Another Page
Expand Down Expand Up @@ -79,7 +79,7 @@


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

<p>Lorem Ipsum <span class="custom">Dolor</span>.</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
<div class="col-lg-3">
<nav class="nav flex-column">
<h2>Some Caption</h2>
<ul class="level-1">
<ul class="menu-level-main">
<li><a href="https://example.com/index.html#debug-settings"
class="nav-link">
Title
Expand Down
2 changes: 1 addition & 1 deletion tests/Integration/tests-full/index/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<body>
<!-- content start -->
<div class="section" id="document-title">
<h1>Document Title</h1>
<h1>Document Title</h1>

<p>Lorem Ipsum Dolor.</p>
</div>
Expand Down
4 changes: 4 additions & 0 deletions tools/integration-test-copy-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ function copyTests(string $directory, bool $shortenHtml=true): void
if (!is_dir($inputDirectory)) {
continue;
}
if (file_exists($inputDirectory . '/skip')) {
// ignore skipped tests
continue;
}
$tempDir = $dir->getPathname() . '/temp';
$expectedDir = $dir->getPathname() . '/expected';
if (!file_exists($tempDir)) {
Expand Down

0 comments on commit 5165cfd

Please sign in to comment.