From 6e6688611e76c1bb0206e581645be8d65fa60343 Mon Sep 17 00:00:00 2001 From: Jaapio Date: Wed, 25 Sep 2024 18:48:28 +0200 Subject: [PATCH] [FEATURE] enable subtitles on menus Just like toctree menu should support sub-titles --- .../Directives/MenuDirective.php | 1 - .../navigation/breadcrumb/expected/page1.html | 166 +++++++++++------- .../input/level-1-1/level-2-2/subpage1.rst | 1 + .../menu-level-3/input/level-1-2/index.rst | 1 + .../menu-level-3/input/level-1-2/subpage1.rst | 1 + .../navigation/menu-level-3/input/page1.rst | 1 + .../input/level-1-1/level-2-2/subpage1.rst | 1 + .../input/level-1-2/subpage1.rst | 1 + .../navigation/menu-relative/input/page1.rst | 1 + 9 files changed, 108 insertions(+), 66 deletions(-) diff --git a/packages/guides-restructured-text/src/RestructuredText/Directives/MenuDirective.php b/packages/guides-restructured-text/src/RestructuredText/Directives/MenuDirective.php index 6c5d77d94..66d164129 100644 --- a/packages/guides-restructured-text/src/RestructuredText/Directives/MenuDirective.php +++ b/packages/guides-restructured-text/src/RestructuredText/Directives/MenuDirective.php @@ -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( diff --git a/tests/Integration/tests/navigation/breadcrumb/expected/page1.html b/tests/Integration/tests/navigation/breadcrumb/expected/page1.html index dd4f6ad22..191274130 100644 --- a/tests/Integration/tests/navigation/breadcrumb/expected/page1.html +++ b/tests/Integration/tests/navigation/breadcrumb/expected/page1.html @@ -1,100 +1,136 @@ -
-

Page 1

- +
+

Page 1

+

Lorem Ipsum Dolor.

- +
+

Page 1 Level 2

+

Page 1 Level 3

-

Page 1 Level 4

-
-
-
+

Page 1 Level 4

+
+
+ diff --git a/tests/Integration/tests/navigation/menu-level-3/input/level-1-1/level-2-2/subpage1.rst b/tests/Integration/tests/navigation/menu-level-3/input/level-1-1/level-2-2/subpage1.rst index 1e04862aa..0461467ad 100644 --- a/tests/Integration/tests/navigation/menu-level-3/input/level-1-1/level-2-2/subpage1.rst +++ b/tests/Integration/tests/navigation/menu-level-3/input/level-1-1/level-2-2/subpage1.rst @@ -5,6 +5,7 @@ Subpage 1, Level 2-2 Lorem Ipsum Dolor. .. menu:: + :titlesonly: /* /*/index diff --git a/tests/Integration/tests/navigation/menu-level-3/input/level-1-2/index.rst b/tests/Integration/tests/navigation/menu-level-3/input/level-1-2/index.rst index 332aa9114..9ac8703f5 100644 --- a/tests/Integration/tests/navigation/menu-level-3/input/level-1-2/index.rst +++ b/tests/Integration/tests/navigation/menu-level-3/input/level-1-2/index.rst @@ -13,3 +13,4 @@ A Toctree with multiple whitespaces in the directive: .. menu:: + :titlesonly: diff --git a/tests/Integration/tests/navigation/menu-level-3/input/level-1-2/subpage1.rst b/tests/Integration/tests/navigation/menu-level-3/input/level-1-2/subpage1.rst index 5aa9fbb65..152471a47 100644 --- a/tests/Integration/tests/navigation/menu-level-3/input/level-1-2/subpage1.rst +++ b/tests/Integration/tests/navigation/menu-level-3/input/level-1-2/subpage1.rst @@ -5,6 +5,7 @@ Subpage 1, Level 1-2 Lorem Ipsum Dolor. .. menu:: + :titlesonly: /* /*/index diff --git a/tests/Integration/tests/navigation/menu-level-3/input/page1.rst b/tests/Integration/tests/navigation/menu-level-3/input/page1.rst index 7a97db280..2d09ce7fd 100644 --- a/tests/Integration/tests/navigation/menu-level-3/input/page1.rst +++ b/tests/Integration/tests/navigation/menu-level-3/input/page1.rst @@ -5,6 +5,7 @@ Page 1 Lorem Ipsum Dolor. .. menu:: + :titlesonly: /* /*/index diff --git a/tests/Integration/tests/navigation/menu-relative/input/level-1-1/level-2-2/subpage1.rst b/tests/Integration/tests/navigation/menu-relative/input/level-1-1/level-2-2/subpage1.rst index 1e04862aa..0461467ad 100644 --- a/tests/Integration/tests/navigation/menu-relative/input/level-1-1/level-2-2/subpage1.rst +++ b/tests/Integration/tests/navigation/menu-relative/input/level-1-1/level-2-2/subpage1.rst @@ -5,6 +5,7 @@ Subpage 1, Level 2-2 Lorem Ipsum Dolor. .. menu:: + :titlesonly: /* /*/index diff --git a/tests/Integration/tests/navigation/menu-relative/input/level-1-2/subpage1.rst b/tests/Integration/tests/navigation/menu-relative/input/level-1-2/subpage1.rst index 5aa9fbb65..152471a47 100644 --- a/tests/Integration/tests/navigation/menu-relative/input/level-1-2/subpage1.rst +++ b/tests/Integration/tests/navigation/menu-relative/input/level-1-2/subpage1.rst @@ -5,6 +5,7 @@ Subpage 1, Level 1-2 Lorem Ipsum Dolor. .. menu:: + :titlesonly: /* /*/index diff --git a/tests/Integration/tests/navigation/menu-relative/input/page1.rst b/tests/Integration/tests/navigation/menu-relative/input/page1.rst index 7a97db280..2d09ce7fd 100644 --- a/tests/Integration/tests/navigation/menu-relative/input/page1.rst +++ b/tests/Integration/tests/navigation/menu-relative/input/page1.rst @@ -5,6 +5,7 @@ Page 1 Lorem Ipsum Dolor. .. menu:: + :titlesonly: /* /*/index