Skip to content

Commit

Permalink
[FEATURE] enable subtitles on menus
Browse files Browse the repository at this point in the history
Just like toctree menu should support sub-titles
  • Loading branch information
jaapio committed Sep 25, 2024
1 parent e2b3fef commit 6e66886
Show file tree
Hide file tree
Showing 9 changed files with 108 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public function process(
$parserContext = $blockContext->getDocumentParserContext()->getParser()->getParserContext();
$options = $directive->getOptions();
$options['glob'] = new DirectiveOption('glob', true);
$options['titlesonly'] = new DirectiveOption('titlesonly', false);
$options['globExclude'] ??= new DirectiveOption('globExclude', 'index,Index');

$toctreeFiles = $this->toctreeBuilder->buildToctreeEntries(
Expand Down
166 changes: 101 additions & 65 deletions tests/Integration/tests/navigation/breadcrumb/expected/page1.html
Original file line number Diff line number Diff line change
@@ -1,100 +1,136 @@
<!-- content start -->
<div class="section" id="page-1">
<h1>Page 1</h1>
<nav aria-label="breadcrumb">
<a href="/index.html"
class="breadcrumb level-0">Document Title</a> &gt;
<span class="breadcrumb active level-1">Page 1</span>
</nav>
<div class="section" id="page-1">
<h1>Page 1</h1>
<nav aria-label="breadcrumb">
<a href="/index.html"
class="breadcrumb level-0">Document Title</a> &gt;
<span class="breadcrumb active level-1">Page 1</span>
</nav>

<p>Lorem Ipsum Dolor.</p>

<div class="menu">
<ul class="menu-level">
<li class="toc-item current active">
<a href="/page1.html#page-1">Page 1</a>
<div class="menu">
<ul class="menu-level">
<li class="toc-item current active">
<a href="/page1.html#page-1">Page 1</a>

<ul class="section-level-1">
<li class="toc-item">
<a href="/page1.html#page-1-level-2">Page 1 Level 2</a>

</li>
<li class="toc-item">
<a href="/page2.html#page-2">Page 2</a>
<ul class="section-level-2">
<li class="toc-item">
<a href="/page1.html#page-1-level-3">Page 1 Level 3</a>

<ul class="section-level-2">
<li class="toc-item">
<a href="/page1.html#page-1-level-4">Page 1 Level 4</a>

</li>
<li class="toc-item">
<a href="/level-1-1/index.html#level-1-1">Level 1-1</a>
<ul class="menu-level-1">

</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toc-item">
<a href="/level-1-1/subpage1.html#subpage-1-level-1-1">Subpage 1, Level 1-1</a>
<a href="/page2.html#page-2">Page 2</a>

<ul class="section-level-1">
<li class="toc-item">
<a href="/page2.html#page-2-level-2">Page 2 Level 2</a>

</li>
<li class="toc-item">
<a href="/level-1-1/subpage2.html#subpage-2-level-1-1">Subpage 2, Level 1-1</a>
<ul class="section-level-2">
<li class="toc-item">
<a href="/page2.html#page-2-level-3">Page 2 Level 3</a>

<ul class="section-level-2">
<li class="toc-item">
<a href="/page2.html#page-2-level-4">Page 2 Level 4</a>

</li>
<li class="toc-item">
<a href="/level-1-1/level-2-1/index.html#level-2-1">Level 2-1</a>
<ul class="menu-level-2">

</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
<li class="toc-item">
<a href="/level-1-1/level-2-1/subpage1.html#subpage-1-level-2-1">Subpage 1, Level 2-1</a>
<a href="/level-1-1/index.html#level-1-1">Level 1-1</a>
<ul class="menu-level-1">
<li class="toc-item">
<a href="/level-1-1/subpage1.html#subpage-1-level-1-1">Subpage 1, Level 1-1</a>


</li>
<li class="toc-item">
<a href="/level-1-1/level-2-1/subpage2.html#subpage-2-level-2-1">Subpage 2, Level 2-1</a>
</li>
<li class="toc-item">
<a href="/level-1-1/subpage2.html#subpage-2-level-1-1">Subpage 2, Level 1-1</a>


</li>
</ul>
</li>
<li class="toc-item">
<a href="/level-1-1/level-2-1/index.html#level-2-1">Level 2-1</a>
<ul class="menu-level-2">
<li class="toc-item">
<a href="/level-1-1/level-2-1/subpage1.html#subpage-1-level-2-1">Subpage 1, Level 2-1</a>

</li>
<li class="toc-item">
<a href="/level-1-1/level-2-2/index.html#level-2-2">Level 2-2</a>
<ul class="menu-level-2">
<li class="toc-item">
<a href="/level-1-1/level-2-2/subpage1.html#subpage-1-level-2-2">Subpage 1, Level 2-2</a>

</li>
<li class="toc-item">
<a href="/level-1-1/level-2-1/subpage2.html#subpage-2-level-2-1">Subpage 2, Level 2-1</a>

</li>
<li class="toc-item">
<a href="/level-1-1/level-2-2/subpage2.html#subpage-2-level-2-2">Subpage 2, Level 2-2</a>

</li>
</ul>

</li>
</ul>
</li>
<li class="toc-item">
<a href="/level-1-1/level-2-2/index.html#level-2-2">Level 2-2</a>
<ul class="menu-level-2">
<li class="toc-item">
<a href="/level-1-1/level-2-2/subpage1.html#subpage-1-level-2-2">Subpage 1, Level 2-2</a>

</li>
</ul>

</li>
<li class="toc-item">
<a href="/level-1-2/index.html#level-1-2">Level 1-2</a>
<ul class="menu-level-1">
<li class="toc-item">
<a href="/level-1-2/subpage1.html#subpage-1-level-1-2">Subpage 1, Level 1-2</a>
</li>
<li class="toc-item">
<a href="/level-1-1/level-2-2/subpage2.html#subpage-2-level-2-2">Subpage 2, Level 2-2</a>


</li>
</ul>

</li>
</li>
</ul>

</li>
<li class="toc-item">
<a href="/level-1-2/subpage2.html#subpage-2-level-1-2">Subpage 2, Level 1-2</a>
<a href="/level-1-2/index.html#level-1-2">Level 1-2</a>
<ul class="menu-level-1">
<li class="toc-item">
<a href="/level-1-2/subpage1.html#subpage-1-level-1-2">Subpage 1, Level 1-2</a>


</li>
</ul>
</li>
<li class="toc-item">
<a href="/level-1-2/subpage2.html#subpage-2-level-1-2">Subpage 2, Level 1-2</a>

</li>
</ul>
</div>
<div class="section" id="page-1-level-2">
<h2>Page 1 Level 2</h2>
<div class="section" id="page-1-level-3">

</li>
</ul>

</li>
</ul>
</div>
<div class="section" id="page-1-level-2">
<h2>Page 1 Level 2</h2>
<div class="section" id="page-1-level-3">
<h3>Page 1 Level 3</h3>
<div class="section" id="page-1-level-4">
<h4>Page 1 Level 4</h4>
</div>
</div>
</div>
<h4>Page 1 Level 4</h4>
</div>
</div>
</div>
</div>
<!-- content end -->
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Subpage 1, Level 2-2
Lorem Ipsum Dolor.

.. menu::
:titlesonly:

/*
/*/index
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ A Toctree with multiple whitespaces in the directive:


.. menu::
:titlesonly:
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Subpage 1, Level 1-2
Lorem Ipsum Dolor.

.. menu::
:titlesonly:

/*
/*/index
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Page 1
Lorem Ipsum Dolor.

.. menu::
:titlesonly:

/*
/*/index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Subpage 1, Level 2-2
Lorem Ipsum Dolor.

.. menu::
:titlesonly:

/*
/*/index
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Subpage 1, Level 1-2
Lorem Ipsum Dolor.

.. menu::
:titlesonly:

/*
/*/index
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Page 1
Lorem Ipsum Dolor.

.. menu::
:titlesonly:

/*
/*/index
Expand Down

0 comments on commit 6e66886

Please sign in to comment.