Skip to main content

It is used to extract the specified tabs content from the RST (reStructuredText) document.

Project description

sphinx_tabs_selector

This plugin is created based on the sphinx_tabs plugin and supports all formats supported by sphinx_tabs v3.4.7.

Features

  1. Supports all formats supported by sphinx_tabs with v3.4.7.
  2. Supports showing tabs in switching mode or flat mode.
  3. Supports Unix glob pattern for tabs_include and tabs_exclude configuration. You can use Unix glob pattern to select multiple tabs. For example:
    • tabs_include = ["tab1_*", "tab2_*", "tab3_*"] will select all tabs that start with tab1_, tab2_, tab3_.
    • tabs_exclude = ["tab4_*", "tab5_*", "tab6_*"] to exclude all tabs that start with tab4_, tab5_, tab6_.
  4. When tabs_flat is set to True, and builder is latex, the tabs will be displayed in flat mode, and pdf will show the tab with blue,bold tab name and the tab contents will be surrounded by a box. The non-nested tabs are displayed very well. But the nested tabs are displayed not very well.
  5. Supports replace strings in tab contents by set tabs_replace_dict. This only effect on flat mode.

Installation

pip install sphinx-tabs-selector

Usage

Add the following configuration to conf.py:

extensions = [
    ...
    'sphinx_tabs_selector.selector',
    ...
]

# tabs_include is used to configure the tabs to be selected. Support Unix glob pattern.
# The configuration item is a list. Each element in the list is a string, which is the name of the tab to be selected. 
# If the tab is nested, you need to write down all the names of the tabs in the nesting path.
tabs_include = ["tab1_name", "tab2_name", "tab3_*"]

# tabs_exclude is used to configure the tabs to be skipped. Support Unix glob pattern.
# The configuration item is a list. Each element in the list is a string, which is the name of the tab to be skipped.
tabs_exclude = ["tab4_name", "tab5_name", "tab6_*"]

# default is False. If True, the tabs will be displayed in flat mode. Otherwise, the tabs will be displayed in switching mode.
tabs_flat = True

tabs_replace_dict = {
    "tab1":{
        "key1":"value1"
    }
}

For the way of writing tabs in RST files, you can refer to the documentation of the sphinx_tabs plugin. Thanks for the author of the sphinx_tabs plugin.

Notes

  1. If you want to use this plugin. You must add the tabs_include or tabs_exclude configuration to conf.py; Otherwise, the plugin will not take effect. Therefore, you can use the tabs_include or tabs_excludeconfiguration to control the activation of the plugin.
    • If any of the tabs_include or tabs_exclude configuration is added, the plugin will be activated.
    • If either of the tabs_include or tabs_exclude configuration is not added, the plugin will not be activated.
    • If only tabs_include is added, the plugin will only select the tabs in the tabs_include configuration.
    • If only tabs_exclude is added, the plugin will select all tabs except the tabs in the tabs_exclude configuration.
    • If both tabs_include and tabs_exclude are added, the plugin will select the tabs in the tabs_include configuration, and exclude the tabs in the tabs_exclude configuration. But excluding takes precedence over selecting.
  2. You need add the tabs_flat configuration to conf.py to control the display mode of the tabs.
    • If the tabs_flat configuration is not added, the tabs will be displayed in switching mode.
    • If the tabs_flat configuration is added and set to True, the tabs will be displayed in flat mode.
    • If the tabs_flat configuration is added and set to False, the tabs will be displayed in switching mode.
  3. If both the sphinx_tabs plugin and the sphinx_tabs_selector plugin are added to the extensions in conf.py, for the sphinx_tabs_selector plugin to work, it must be added after sphinx_tabs.
  4. The sphinx_tabs_selector plugin can be used independently even if the sphinx_tabs plugin is not added to conf.py.
  5. If only set the sphinx_tabs_selector plugin in conf.py and not set the sphinx_tabs plugin, and tabs_flat is set to False or not set, and not set the tabs_include or tabs_exclude configuration, the plugin will work as the sphinx_tabs plugin with v3.4.7.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_tabs_selector-1.0.11.tar.gz (11.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_tabs_selector-1.0.11-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_tabs_selector-1.0.11.tar.gz.

File metadata

  • Download URL: sphinx_tabs_selector-1.0.11.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sphinx_tabs_selector-1.0.11.tar.gz
Algorithm Hash digest
SHA256 15bf0f6b55613d9a79f0ab180090eefbb16fb99d812d8d350d42ccc09cd56478
MD5 725fd7bec4dfb252b407bd11f412f849
BLAKE2b-256 35da0b87823687da2aa92fa2efd3512a7937ec421dcd8512a75e250a2a083e4e

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_tabs_selector-1.0.11.tar.gz:

Publisher: python-publish.yml on TerraJuly/sphinx_tabs_selector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sphinx_tabs_selector-1.0.11-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_tabs_selector-1.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 9c4d091f91c0f86ccd5e69967ec1060c381deb66740f665b724390f4d8deb320
MD5 9be5bdb5c2756751b2e3219f6c26782a
BLAKE2b-256 57d21780c5cf78c3b0657d4aa5ef491b16357802b14d6569d8f3e40f6b47e9b3

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_tabs_selector-1.0.11-py3-none-any.whl:

Publisher: python-publish.yml on TerraJuly/sphinx_tabs_selector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page