pax_global_header00006660000000000000000000000064144537535320014525gustar00rootroot0000000000000052 comment=f1200f84be8cc823ae383d3f2389690a0ef45054 sphinx-code-tabs-0.5.5/000077500000000000000000000000001445375353200147045ustar00rootroot00000000000000sphinx-code-tabs-0.5.5/.github/000077500000000000000000000000001445375353200162445ustar00rootroot00000000000000sphinx-code-tabs-0.5.5/.github/dependabot.yml000066400000000000000000000001661445375353200210770ustar00rootroot00000000000000version: 2 updates: - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" sphinx-code-tabs-0.5.5/.github/workflows/000077500000000000000000000000001445375353200203015ustar00rootroot00000000000000sphinx-code-tabs-0.5.5/.github/workflows/main.yml000066400000000000000000000016321445375353200217520ustar00rootroot00000000000000on: push: pull_request: jobs: build: name: build runs-on: ubuntu-latest strategy: matrix: python: - "3.7" - "3.8" - "3.9" - "3.10" - "3.11" steps: - uses: actions/checkout@v3 - uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} - run: python -m pip install -U pip - run: python -m pip install setuptools wheel - run: python -m pip install flake8 twine - run: python setup.py sdist bdist_wheel - run: python -m pip install dist/*.whl - run: twine check dist/* - run: flake8 - name: Publish PyPI package if: startsWith(github.ref, 'refs/tags/v') && matrix.python == '3.11' env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} run: twine upload dist/*.whl dist/*.tar.gz sphinx-code-tabs-0.5.5/.gitignore000066400000000000000000000004721445375353200166770ustar00rootroot00000000000000# Temporary files .*~ .*.swp _build # Python binaries *.py[cod] # C extensions *.so *.c # Packages *.egg *.egg-info dist /build eggs parts bin var sdist develop-eggs .installed.cfg lib lib64 __pycache__ MANIFEST # Installer logs pip-log.txt # Unit test / coverage reports .coverage .tox nosetests.xml htmlcov sphinx-code-tabs-0.5.5/CHANGES.rst000066400000000000000000000033021445375353200165040ustar00rootroot00000000000000CHANGES ------- v0.5.4 ~~~~~~ Date: 13.07.2023 - no changes, release needed to trigger a new build v0.5.4 ~~~~~~ Date: 28.06.2023 - declare extension as safe for parallel reads (#6) v0.5.3 ~~~~~~ Date: 28.11.2021 - fix CHANGES to appear in long description v0.5.2 ~~~~~~ Date: 28.11.2021 - fix ImportError triggered on readthedocs due to ancient sphinx version (v1.8) v0.5.1 ~~~~~~ Date: 28.11.2021 - update description for landing page v0.5.0 ~~~~~~ Date: 28.11.2021 - add ``tab`` directive for arbitrary (non-code) content - add ``tabs`` directive and make ``code-tabs`` a backward-compatibility alias of ``tabs``, to account for the new more general tab containers - make the ``:title:`` option no longer required (wasn't enforced anyway by sphinx) - add grouped tabs - make non-code tabs look better in latex output by boxing them like listings v0.4.0 ~~~~~~ Date: 27.11.2021 - fix bug that selects all tab buttons on click (introduced in prerender commit) v0.3.0 ~~~~~~ Date: 27.11.2021 - fix AssertionError if :title: option is missing (see #3) - increase css specificity to fix big margins that have appeared due to some CSS change in sphinx or rtd - fix exception when building pdf documents (#1, #4) - prerender tab hidden/selected state to avoid content reflow on page (re-)load v0.2.0 ~~~~~~ Date: 21.06.2021 - update css for sphinx 4 v0.1.0 ~~~~~~ Date: 10.10.2020 - fix missing assets when using the extension on readthedocs - add documentation along with visual example on readthedocs v0.0.1 ~~~~~~ Date: 10.10.2020 Initial version with basic functionality: - all rendering is done by JS, no prerendering - so far no "notebook-groups" that switch the language simultaneously sphinx-code-tabs-0.5.5/MANIFEST.in000066400000000000000000000001211445375353200164340ustar00rootroot00000000000000include README.rst UNLICENSE recursive-include sphinx_code_tabs *.css *.js *.sty sphinx-code-tabs-0.5.5/README.rst000066400000000000000000000074261445375353200164040ustar00rootroot00000000000000sphinx code tabs ================ |Version| |License| |Documentation| This is a Sphinx extension that adds a ``tabs`` directive for creating a tabbed widget, allowing the user to switch between them. The individual tabs can be code blocks or general content. This can be used to e.g. show a snippet in multiple languages, display instructions for alternative platforms, or switch between code and output. |Screenshot| Installation ------------ .. code-block:: bash pip install sphinx_code_tabs To enable the extension in sphinx, simply add the package name in your ``conf.py`` to the list of ``extensions``: .. code-block:: python extensions = [ ... 'sphinx_code_tabs', ] Usage ----- By enabling the extension you get access to the ``tabs`` directive that declares a notebook of code block alternatives. The individual tabs are created with the ``tab`` or ``code-tab`` directives. A ``tab`` can contain arbitrary restructuredText, while a ``code-tab`` acts like a ``code-block`` and accepts all corresponding arguments. Both types of tabs can appear in the same notebook. The ``:selected:`` option allows to switch to a specified tab at start. By default, the first tab is used. For example, this is the source of above example: .. code-block:: rst .. tabs:: .. code-tab:: bash echo "Hello, *World*!" .. code-tab:: c :caption: C/C++ :emphasize-lines: 2 #include int main() { printf("Hello, *World*!\n"); } .. code-tab:: python print("Hello, *World*!") .. tab:: Output :selected: Hello, *World*! Grouped tabs ~~~~~~~~~~~~ The ``tabs`` directive takes an optional argument that identifies its *tab group*. Within a given tab group, all notebooks will automatically be switched to the same tab number if the tab is switched in one member of the group. It is your responsibility to make sure that each member of the group has the same number and ordering of tabs. Example: |Tabgroup| Source: .. code-block:: rst .. tabs:: lang .. code-tab:: bash echo "Hello, group!" .. code-tab:: python print("Hello, group!") .. tabs:: lang .. code-tab:: bash echo "Goodbye, group!" .. code-tab:: python print("Goodbye, group!") Alternatives ------------ After creating this package, I found other packages which are functionally similar or equivalent. You may want to check them out if sphinx-code-tabs doesn't fit your needs: - sphinx_tabs_ - sphinx_inline_tabs_ .. _sphinx_tabs: https://pypi.org/project/sphinx-tabs/ .. _sphinx_inline_tabs: https://pypi.org/project/sphinx-inline-tabs/ .. |Documentation| image:: https://readthedocs.org/projects/sphinx-code-tabs/badge/?version=latest :target: https://sphinx-code-tabs.readthedocs.io/en/latest/ :alt: Documentation .. |License| image:: https://img.shields.io/pypi/l/sphinx-code-tabs.svg :target: https://github.com/coldfix/sphinx-code-tabs/blob/main/UNLICENSE :alt: License: Unlicense .. |Version| image:: https://img.shields.io/pypi/v/sphinx-code-tabs.svg :target: https://pypi.org/project/sphinx-code-tabs :alt: Latest Version .. |Screenshot| image:: https://raw.githubusercontent.com/coldfix/sphinx-code-tabs/main/screenshot1.webp :target: https://sphinx-code-tabs.readthedocs.io/en/latest/#usage :alt: Code tabs screenshot .. |Tabgroup| image:: https://raw.githubusercontent.com/coldfix/sphinx-code-tabs/main/screenshot2.webp :target: https://sphinx-code-tabs.readthedocs.io/en/latest/#grouped-tabs :alt: Grouped tabs screenshot sphinx-code-tabs-0.5.5/UNLICENSE000066400000000000000000000022731445375353200161600ustar00rootroot00000000000000This is free and unencumbered software released into the public domain. Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means. In jurisdictions that recognize copyright laws, the author or authors of this software dedicate any and all copyright interest in the software to the public domain. We make this dedication for the benefit of the public at large and to the detriment of our heirs and successors. We intend this dedication to be an overt act of relinquishment in perpetuity of all present and future rights to this software under copyright law. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information, please refer to sphinx-code-tabs-0.5.5/doc/000077500000000000000000000000001445375353200154515ustar00rootroot00000000000000sphinx-code-tabs-0.5.5/doc/Makefile000066400000000000000000000011721445375353200171120ustar00rootroot00000000000000# Minimal makefile for Sphinx documentation # # You can set these variables from the command line, and also # from the environment for the first two. SPHINXOPTS ?= SPHINXBUILD ?= sphinx-build SOURCEDIR = . BUILDDIR = _build # Put it first so that "make" without argument is like "make help". help: @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) .PHONY: help Makefile # Catch-all target: route all unknown targets to Sphinx using the new # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). %: Makefile @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) sphinx-code-tabs-0.5.5/doc/conf.py000066400000000000000000000016671445375353200167620ustar00rootroot00000000000000# Configuration file for the Sphinx documentation builder. # # For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html import os import sys sys.path.insert(0, os.path.abspath('..')) import sphinx_rtd_theme import sphinx_code_tabs # -- Project information ----------------------------------------------------- project = 'sphinx_code_tabs' copyright = '2020, Thomas Gläßle' author = 'Thomas Gläßle' release = sphinx_code_tabs.__version__ # -- General configuration --------------------------------------------------- extensions = [ 'sphinx_code_tabs', ] master_doc = 'index' source_suffix = '.rst' templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # -- Options for HTML output ------------------------------------------------- html_theme = 'sphinx_rtd_theme' html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] html_static_path = ['_static'] sphinx-code-tabs-0.5.5/doc/examples/000077500000000000000000000000001445375353200172675ustar00rootroot00000000000000sphinx-code-tabs-0.5.5/doc/examples/codetabs.rst000066400000000000000000000005301445375353200216030ustar00rootroot00000000000000.. tabs:: .. code-tab:: bash echo "Hello, *World*!" .. code-tab:: c :caption: C/C++ :emphasize-lines: 2 #include int main() { printf("Hello, *World*!\n"); } .. code-tab:: python print("Hello, *World*!") .. tab:: Output :selected: Hello, *World*! sphinx-code-tabs-0.5.5/doc/examples/tabgroup.rst000066400000000000000000000004041445375353200216420ustar00rootroot00000000000000.. tabs:: lang .. code-tab:: bash echo "Hello, group!" .. code-tab:: python print("Hello, group!") .. tabs:: lang .. code-tab:: bash echo "Goodbye, group!" .. code-tab:: python print("Goodbye, group!") sphinx-code-tabs-0.5.5/doc/index.rst000066400000000000000000000047341445375353200173220ustar00rootroot00000000000000sphinx_code_tabs ================ |Version| |License| |Documentation| This is a Sphinx extension that adds a ``tabs`` directive for creating a tabbed widget, allowing the user to switch between them. The individual tabs can be code blocks or general content. This can be used to e.g. show a snippet in multiple languages, display instructions for alternative platforms, or switch between code and output. .. toctree:: :maxdepth: 2 :caption: Contents: Installation ============ .. code-block:: bash pip install sphinx_code_tabs To enable the extension in sphinx, simply add the package name in your ``conf.py`` to the list of ``extensions``: .. code-block:: python extensions = [ ... 'sphinx_code_tabs', ] Usage ===== By enabling the extension you get access to the ``tabs`` directive that declares a notebook of alternative tabs which looks as follows: .. include:: examples/codetabs.rst The individual tabs are created with the ``tab`` or ``code-tab`` directives. A ``tab`` can contain arbitrary restructuredText, while a ``code-tab`` acts like a ``code-block`` and accepts all corresponding arguments. Both types of tabs can appear in the same notebook. The ``:selected:`` option allows to switch to a specified tab at start. By default, the first tab is used. For example, this is the source of above example: .. literalinclude:: examples/codetabs.rst :language: rst Grouped tabs ~~~~~~~~~~~~ The ``tabs`` directive takes an optional argument that identifies its *tab group*. Within a given tab group, all notebooks will automatically be switched to the same tab number if the tab is switched in one member of the group. It is your responsibility to make sure that each member of the group has the same number and ordering of tabs. Example: .. include:: examples/tabgroup.rst Source: .. literalinclude:: examples/tabgroup.rst :language: rst .. |Documentation| image:: https://readthedocs.org/projects/sphinx-code-tabs/badge/?version=latest :target: https://sphinx-code-tabs.readthedocs.io/en/latest/ :alt: Documentation .. |License| image:: https://img.shields.io/pypi/l/sphinx-code-tabs.svg :target: https://github.com/coldfix/sphinx-code-tabs/blob/master/UNLICENSE :alt: License: Unlicense .. |Version| image:: https://img.shields.io/pypi/v/sphinx-code-tabs.svg :target: https://pypi.org/project/sphinx-code-tabs :alt: Latest Version sphinx-code-tabs-0.5.5/doc/make.bat000066400000000000000000000014331445375353200170570ustar00rootroot00000000000000@ECHO OFF pushd %~dp0 REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set SOURCEDIR=. set BUILDDIR=_build if "%1" == "" goto help %SPHINXBUILD% >NUL 2>NUL if errorlevel 9009 ( echo. echo.The 'sphinx-build' command was not found. Make sure you have Sphinx echo.installed, then set the SPHINXBUILD environment variable to point echo.to the full path of the 'sphinx-build' executable. Alternatively you echo.may add the Sphinx directory to PATH. echo. echo.If you don't have Sphinx installed, grab it from echo.http://sphinx-doc.org/ exit /b 1 ) %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% goto end :help %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% :end popd sphinx-code-tabs-0.5.5/screenshot1.webp000066400000000000000000000316161445375353200200300ustar00rootroot00000000000000RIFF3WEBPVP8X  ANIMANMF VP8 0L* >HJ! gnsnFn: @>O/^T>S{}뿝>/wߏ @y~u_Ro {1_>ZHb8(~ȎK7h Qh!ZiILa c%գM <6/wq$~4TʄmqՓ%s/:dsy;9ʩІ ֪IK!\olBUF4IBQwѳl C`C1֛;IPJ<#O)W^`Y{JV*TFP(e5RnE^(׎}L/:$5g8޶8'lkW 4{.:DB!n2_?k bynx לiUf3(Alԍ׹j|dAK1ab*a3S+_,Գ{Yƶܲwy†A`b}Ϛĉ e)#5^'Q?+rD (:N\ܢoV=1(B1c*#5A)JR;GO \mMtR+z:8X_&WL){]ߟ<KI^*YmO){4q8>=݃kBgYgl¾}B@B$YAw/IsO,PlowgO;7jl "! uz?,]$ 됷sOz­3X̠Vxrm)*nx NDK2-~mh^`[~rkc_Chf2aOՒne!/'U~Ģ8 ڜaia_p 5]"7 eƫ] cD;4-Rȭ%ٱV!B0a[m2w綢Z^e-SJ OG=xQk_tŠTTG+0y6!I6r`%Qo'0:$#Vz1*݊cNerI; 1CxJ܋$dNWf;yD쬻nWA[ǤG3ZJ ^ChkYPF*Lz@Drk d(KazFJ,3w]qo)ci M_9&hv;@{k-Kے{Ȇi? r:w{|PD}+>uyAaq#sia VmɜL[vgz)(yVYmq1#WY\2o/|.i ؍h,N`xG%LqMzQ{2[ X[,0nmux-L Ƥ鄨e {]fA?PO[$+9 lc Qddaê3T4s~grX䨖۩P@f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=Jؽ=- Iإry1![ws*H~ז= p"ՠ3  ]xt/O˱U(=AAHUapD]jaou`]->j3q\We )+paZT25Dw& 9'N1.Zimu5$foBOEGK㼻<|f(OGt%ggdDl5S)rVhUL߷R˖FtgY&9"zyEtEO,܋ETd-CieLq>o4xo&`H ukk=tH1s)Ch;i~y:۫ Yr6:D[_L8D|. f1a/Obi"xޯOlݥ]zrAUGX8~qkK kbRl%Xvwt7Sb20lܯ i$suHih6By'-.- ՘x3<V$KGM:b5&[KT՛(,ߜ_#pAJ5M[乛1}E+0,sphinx-code-tabs-0.5.5/setup.cfg000066400000000000000000000026121445375353200165260ustar00rootroot00000000000000[options] packages = sphinx_code_tabs python_requires = >=3.5 install_requires = sphinx>=3 importlib_resources; python_version < '3.7' include_package_data = true zip_safe = false [options.extras_require] doc = sphinx_rtd_theme [metadata] name = sphinx_code_tabs description = Sphinx extension for adding alternative code-blocks as selectable tabs keywords = sphinx extension alternative code-block tab notebook platforms = any url = https://github.com/coldfix/sphinx-code-tabs download_url = https://pypi.org/project/sphinx_code_tabs long_description = file: README.rst, CHANGES.rst author = Thomas Gläßle author_email = thomas@coldfix.de license = Unlicense license_file = UNLICENSE project_urls = Source Code = https://github.com/coldfix/sphinx-code-tabs Bug Tracker = https://github.com/coldfix/sphinx-code-tabs/issues Documentation = https://sphinx-code-tabs.readthedocs.io classifiers = Development Status :: 4 - Beta Environment :: Plugins Intended Audience :: Developers License :: OSI Approved :: The Unlicense (Unlicense) Operating System :: OS Independent Programming Language :: Python :: 3 Topic :: Documentation :: Sphinx long_description_content_type = text/x-rst [flake8] ignore = E221,E241,E251,E402,E701,W504 exclude = docs,.git,build,__pycache__,dist,.eggs sphinx-code-tabs-0.5.5/setup.py000066400000000000000000000005331445375353200164170ustar00rootroot00000000000000from setuptools import setup meta = {} with open('sphinx_code_tabs/__init__.py', 'rb') as f: try: exec(f.read(), meta, meta) except ImportError: # ignore missing dependencies at setup time pass # and return dunder-globals anyway! setup( name='sphinx_code_tabs', version=meta['__version__'], ) sphinx-code-tabs-0.5.5/sphinx_code_tabs/000077500000000000000000000000001445375353200202205ustar00rootroot00000000000000sphinx-code-tabs-0.5.5/sphinx_code_tabs/__init__.py000066400000000000000000000140521445375353200223330ustar00rootroot00000000000000__version__ = '0.5.5' from docutils.parsers.rst import directives from docutils import nodes from sphinx.directives.code import CodeBlock from sphinx.util.docutils import SphinxDirective from sphinx.util.fileutil import copy_asset_file import os try: from sphinx.util.texescape import escape as latex_escape except ImportError: # ancient sphinx: from sphinx.util.texescape import tex_escape_map def latex_escape(s, latex_engine): return s.translate(tex_escape_map) CSS_FILE = "code-tabs.css" JS_FILE = "code-tabs.js" STY_FILE = "tabenv.sty" _html_builders = [ "html", "singlehtml", "dirhtml", "readthedocs", "readthedocsdirhtml", "readthedocssinglehtml", "readthedocssinglehtmllocalmedia", "spelling", ] _latex_builders = [ "latex", ] class TabsNode(nodes.container): pass class TabNode(nodes.container): pass class TabBarNode(nodes.Part, nodes.Element): pass class TabButtonNode(nodes.Part, nodes.Element): pass class TabsDirective(SphinxDirective): """ This directive is used to contain a group of code blocks which can be selected as tabs of a single notebook. """ final_argument_whitespace = True required_arguments = 0 optional_arguments = 1 has_content = True def run(self): self.assert_has_content() node = TabsNode() node["classes"].append("tabs") node["tabgroup"] = self.arguments[0] if self.arguments else None self.add_name(node) self.state.nested_parse(self.content, self.content_offset, node) # Generate navbar: if self.env.app.builder.name in _html_builders: tabbar = TabBarNode() tabbar["classes"].append("tabbar") selected = 0 for i, tab in enumerate(node.children): button = TabButtonNode() button['classes'].append('tabbutton') button['tabid'] = i button.append(nodes.Text(tab["tabname"])) tabbar.append(button) if tab.get('selected'): selected = i tabbar.children[selected]['classes'].append('selected') node.children[selected]['classes'].append('selected') node.insert(0, tabbar) return [node] class TabDirective(SphinxDirective): option_spec = { 'selected': directives.flag, } final_argument_whitespace = True required_arguments = 1 optional_arguments = 0 has_content = True def run(self): index = len(self.state.parent.children) title = self.options.get('title') if not title: title = self.options.get('caption') if not title and self.arguments: title = self.arguments[0] if not title: title = "Tab {}".format(index + 1) node = TabNode() node['tabid'] = index node['tabname'] = title node['selected'] = 'selected' in self.options node['classes'].append('tab') node += self.make_page(node) return [node] def make_page(self, node): node['classes'].append("texttab") page = nodes.container() self.state.nested_parse(self.content, self.content_offset, page) return page class CodeTabDirective(CodeBlock): """Single code-block tab inside .. code-tabs.""" option_spec = CodeBlock.option_spec.copy() option_spec.update({ 'title': directives.unchanged, 'selected': directives.flag, }) run = TabDirective.run def make_page(self, node): node['classes'].append("codetab") if self.env.app.builder.name in _html_builders: self.options.pop('caption', None) else: self.options.setdefault('caption', node['tabname']) return super().run() def visit_tabgroup_html(self, node): self.body.append(self.starttag(node, 'div', **{ 'data-tabgroup': node['tabgroup'] or '', 'class': 'docutils container', })) def depart_tabgroup_html(self, node): self.body.append('') def visit_tabbar_html(self, node): self.body.append(self.starttag(node, 'ul')) def depart_tabbar_html(self, node): self.body.append('') def visit_tabbutton_html(self, node): self.body.append(self.starttag(node, 'li', **{ 'data-id': node['tabid'], 'onclick': "sphinx_code_tabs_onclick(this)", })) def depart_tabbutton_html(self, node): self.body.append('') def visit_tab_html(self, node): self.body.append(self.starttag(node, 'div', **{ 'data-id': node['tabid'], })) def depart_tab_html(self, node): self.body.append('') def visit_tab_latex(self, node): if 'texttab' in node['classes']: self.body.append(r'\sphinxSetupCaptionForVerbatim{{{}}}'.format( latex_escape(node['tabname'], self.config.latex_engine), )) self.body.append(r'\begin{tab}') def depart_tab_latex(self, node): if 'texttab' in node['classes']: self.body.append(r'\end{tab}') def add_assets(app): package_dir = os.path.dirname(__file__) app.config.html_static_path.append(package_dir) app.add_css_file(CSS_FILE) app.add_js_file(JS_FILE) if app.builder.name in _latex_builders: copy_asset_file( os.path.join(package_dir, STY_FILE), app.builder.outdir) app.add_latex_package('tabenv') def setup(app): app.add_node(TabsNode, html=(visit_tabgroup_html, depart_tabgroup_html)) app.add_node(TabBarNode, html=(visit_tabbar_html, depart_tabbar_html)) app.add_node( TabButtonNode, html=(visit_tabbutton_html, depart_tabbutton_html)) app.add_node( TabNode, html=(visit_tab_html, depart_tab_html), latex=(visit_tab_latex, depart_tab_latex)) app.add_directive("tabs", TabsDirective) app.add_directive("tab", TabDirective) app.add_directive("code-tabs", TabsDirective) app.add_directive("code-tab", CodeTabDirective) app.connect("builder-inited", add_assets) return { "version": __version__, "parallel_read_safe": True, } sphinx-code-tabs-0.5.5/sphinx_code_tabs/code-tabs.css000066400000000000000000000022531445375353200225750ustar00rootroot00000000000000div.tabs > ul.tabbar { margin: 0; padding: 0; display: block; list-style-type: none; overflow: hidden; border: none; font-size: smaller; color: #ffffff; } div.tabs > ul.tabbar > li.tabbutton { margin: 0 5px 0 0; padding: 0px 10px; display: block; cursor: pointer; font-weight: bold; border-top-left-radius: 8px; border-top-right-radius: 8px; border: 1px solid #e1e4e5; border-bottom: none; background-color: #888; float: left; outline: none; transition: 0.3s; } div.tabs > ul.tabbar > li.tabbutton:first-of-type { margin-left: 2px; } div.tabs > ul.tabbar > li.tabbutton:last-of-type { margin-right: 0; } div.tabs > ul.tabbar li.tabbutton:hover { background-color: #606060; } div.tabs > ul.tabbar > li.tabbutton.selected { background-color: #303030; border-color: #4070a0; border-size: 2px; } div.tabs > ul.tabbar > li.tabbutton.selected:hover { background-color: #606060; } div.tabs > div.codetab > div { margin-top: 0; margin-bottom: 24px; border: 1px solid #e1e4e5; } div.tabs > div.texttab > div { padding: 12px; } div.tabs > div.texttab > div > :last-child { margin-bottom: 0; } div.tabs > div.tab:not(.selected) { display: none; } sphinx-code-tabs-0.5.5/sphinx_code_tabs/code-tabs.js000066400000000000000000000014041445375353200224160ustar00rootroot00000000000000const sphinx_code_tabs_onclick = function(clicked) { const tabid = clicked.dataset.id; const tabgroup = clicked.parentNode.parentNode.dataset.tabgroup; const books = []; if (tabgroup) { for (const book of document.querySelectorAll("div.tabs")) { if (book.dataset.tabgroup == tabgroup) { books.push(book); } } } else { books.push(clicked.parentNode.parentNode); } for (const book of books) { const select = book.children[0]; for (const button of select.children) { button.classList.toggle('selected', button.dataset.id == tabid); } for (const page of book.children) { if (page.hasAttribute('data-id')) { page.classList.toggle('selected', page.dataset.id == tabid); } } } }; sphinx-code-tabs-0.5.5/sphinx_code_tabs/tabenv.sty000066400000000000000000000024361445375353200222450ustar00rootroot00000000000000% This provides a dumbed down version of the sphinxVerbatim environment for % normal (non-verbatim) latex content. When (not if) this breaks in a future % sphinx release, see the original file for reference: % % sphinx/texinputs/sphinxlatexliteralliterals.sty % % I have removed most option handling etc, in order to hopefully keep it % compatible for a longer time. \ProvidesFile{tabenv.sty}[2021/11/28 tab boxes] \RequirePackage{sphinxlatexliterals} \usepackage{lipsum} \newenvironment{tab}{% \parskip\z@skip \vskip\spx@abovecaptionskip % % Write caption (used by sphinxVerbatim@FrameCommand): \def\sphinxVerbatim@Before {\sphinxVerbatim@Title\nointerlineskip \kern\dimexpr-\dp\strutbox+\sphinxbelowcaptionspace \relax}% % % Setup Caption \def\@captype{literalblock}% \capstart \setbox\sphinxVerbatim@TitleBox \hbox{\begin{minipage}{\linewidth}\sphinxVerbatimTitle\end{minipage}} \global\let\sphinxVerbatimTitle\empty \fboxsep\sphinxverbatimsep \fboxrule\sphinxverbatimborder % \let\FrameCommand \sphinxVerbatim@FrameCommand \let\FirstFrameCommand\sphinxVerbatim@FirstFrameCommand \let\MidFrameCommand \sphinxVerbatim@MidFrameCommand \let\LastFrameCommand \sphinxVerbatim@LastFrameCommand % \MakeFramed {\FrameRestore}}% {\endMakeFramed}