Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix tab-item label with nested syntax #135

Merged
merged 10 commits into from
May 20, 2024
2 changes: 1 addition & 1 deletion docs/snippets/myst/tab-options.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
::::{tab-set}
:class: class-set

:::{tab-item} Label
:::{tab-item} **Label**
:name: target
:selected:
:class-container: class-container
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/rst/tab-options.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.. tab-set::
:class: class-set

.. tab-item:: Label
.. tab-item:: **Label**
:name: target
:selected:
:class-container: class-container
Expand Down
2 changes: 2 additions & 0 deletions sphinx_design/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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", [])],
)
Expand Down Expand Up @@ -255,6 +256,7 @@ def run(self) -> None:

# create: <label for="id">...</label>
label_node = sd_tab_label(
"",
"",
*tab_label.children,
input_id=tab_item_identity,
Expand Down
3 changes: 2 additions & 1 deletion tests/test_snippets/snippet_post_tab-options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<container classes="sd-tab-set class-set" design_component="tab-set" is_div="True">
<sd_tab_input checked="True" id="sd-tab-item-0" set_id="sd-tab-set-0" type="radio">
<sd_tab_label classes="sd-tab-label class-label" ids="target" input_id="sd-tab-item-0">
Label
<strong>
Label
<container classes="sd-tab-content class-content" design_component="tab-content" is_div="True">
<paragraph>
Content
Expand Down
3 changes: 2 additions & 1 deletion tests/test_snippets/snippet_pre_tab-options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
<container classes="sd-tab-set class-set" design_component="tab-set" is_div="True">
<container classes="sd-tab-item class-container" design_component="tab-item" is_div="True" selected="True">
<rubric classes="sd-tab-label class-label" ids="target" names="target">
Label
<strong>
Label
<container classes="sd-tab-content class-content" design_component="tab-content" is_div="True">
<paragraph>
Content
Expand Down
Loading