From be1b85d9f59cddcc7c7aaf2093362d940a6d4789 Mon Sep 17 00:00:00 2001 From: Praecordi <109810912+Praecordi@users.noreply.github.com> Date: Tue, 21 May 2024 01:20:51 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20tab-item=20label=20with=20?= =?UTF-8?q?nested=20syntax=20(#135)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Chris Sewell --- docs/snippets/myst/tab-options.txt | 2 +- docs/snippets/rst/tab-options.txt | 2 +- sphinx_design/tabs.py | 2 ++ tests/test_snippets/snippet_post_tab-options.xml | 3 ++- tests/test_snippets/snippet_pre_tab-options.xml | 3 ++- 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/snippets/myst/tab-options.txt b/docs/snippets/myst/tab-options.txt index 2917fbb..c406bfe 100644 --- a/docs/snippets/myst/tab-options.txt +++ b/docs/snippets/myst/tab-options.txt @@ -1,7 +1,7 @@ ::::{tab-set} :class: class-set -:::{tab-item} Label +:::{tab-item} **Label** :name: target :selected: :class-container: class-container diff --git a/docs/snippets/rst/tab-options.txt b/docs/snippets/rst/tab-options.txt index 5b9fdfb..6c76f99 100644 --- a/docs/snippets/rst/tab-options.txt +++ b/docs/snippets/rst/tab-options.txt @@ -1,7 +1,7 @@ .. tab-set:: :class: class-set - .. tab-item:: Label + .. tab-item:: **Label** :name: target :selected: :class-container: class-container diff --git a/sphinx_design/tabs.py b/sphinx_design/tabs.py index 5fa915a..0bcca27 100644 --- a/sphinx_design/tabs.py +++ b/sphinx_design/tabs.py @@ -99,6 +99,7 @@ def run(self) -> list[nodes.Node]: textnodes, _ = self.state.inline_text(self.arguments[0], self.lineno) tab_label = nodes.rubric( self.arguments[0], + "", *textnodes, classes=["sd-tab-label", *self.options.get("class-label", [])], ) @@ -255,6 +256,7 @@ def run(self) -> None: # create: label_node = sd_tab_label( + "", "", *tab_label.children, input_id=tab_item_identity, diff --git a/tests/test_snippets/snippet_post_tab-options.xml b/tests/test_snippets/snippet_post_tab-options.xml index a1aad2c..ff5d699 100644 --- a/tests/test_snippets/snippet_post_tab-options.xml +++ b/tests/test_snippets/snippet_post_tab-options.xml @@ -5,7 +5,8 @@ - Label + + Label Content diff --git a/tests/test_snippets/snippet_pre_tab-options.xml b/tests/test_snippets/snippet_pre_tab-options.xml index 878afe7..57f6dd3 100644 --- a/tests/test_snippets/snippet_pre_tab-options.xml +++ b/tests/test_snippets/snippet_pre_tab-options.xml @@ -5,7 +5,8 @@ - Label + + Label Content