Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sphinx_tabs/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def visit(translator, node):
attrs.pop("ids")
attrs.pop("names")
attrs.pop("dupnames")
attrs.pop("backrefs")
attrs.pop("backrefs", None)
text = translator.starttag(node, node.tagname, **attrs)
translator.body.append(text.strip())

Expand Down
4 changes: 4 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pytest
from pathlib import Path
from bs4 import BeautifulSoup
import docutils
import sphinx

from sphinx_tabs.tabs import JS_FILES, CSS_FILES
Expand Down Expand Up @@ -128,6 +129,9 @@ def read(app, docname="index", resolve=False, regress=False, replace=None):
'<document source="index.rst">',
"<document source=\"index.rst\" translation_progress=\"{'total': 0, 'translated': 0}\">",
)
if docutils.__version_info__ < (0, 22):
text = text.replace('="False"', '="0"')
text = text.replace('linenos="True"', 'linenos="1"')
file_regression.check(text, extension=extension)

return doctree
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<compound classes="toctree-wrapper">
<toctree caption="True" entries="(None,\ 'no_tabs1') (None,\ 'no_tabs2')" glob="False" hidden="False" includefiles="no_tabs1 no_tabs2" includehidden="False" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="False">
<toctree caption="True" entries="(None,\ 'no_tabs1') (None,\ 'no_tabs2')" glob="0" hidden="0" includefiles="no_tabs1 no_tabs2" includehidden="0" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="0">
<section ids="fruits" names="fruits">
<title>
Fruits
Expand Down Expand Up @@ -54,22 +54,22 @@
<button aria-controls="panel-2-Rm9ydHJhbg==" aria-selected="false" classes="sphinx-tabs-tab code-tab group-tab" ids="tab-2-Rm9ydHJhbg==" name="Rm9ydHJhbg==" role="tab" tabindex="-1">
Fortran
<div aria-labelledby="tab-2-Qw==" classes="sphinx-tabs-panel code-tab group-tab" ids="panel-2-Qw==" name="Qw==" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="c" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="c" xml:space="preserve">
C Main Function
<div aria-labelledby="tab-2-Qysr" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-2-Qysr" name="Qysr" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="c++" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="c++" xml:space="preserve">
C++ Main Function
<div aria-labelledby="tab-2-UHl0aG9u" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-2-UHl0aG9u" name="UHl0aG9u" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="py" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="py" xml:space="preserve">
Python Main Function
<div aria-labelledby="tab-2-SmF2YQ==" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-2-SmF2YQ==" name="SmF2YQ==" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="java" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="java" xml:space="preserve">
Java Main Function
<div aria-labelledby="tab-2-SnVsaWE=" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-2-SnVsaWE=" name="SnVsaWE=" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="julia" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="julia" xml:space="preserve">
Julia Main Function
<div aria-labelledby="tab-2-Rm9ydHJhbg==" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-2-Rm9ydHJhbg==" name="Rm9ydHJhbg==" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="fortran" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="fortran" xml:space="preserve">
Fortran Main Function
<container classes="sphinx-tabs" type="tab-element">
<div aria-label="Tabbed content" classes="closeable" role="tablist">
Expand All @@ -86,31 +86,31 @@
<button aria-controls="panel-3-Rm9ydHJhbg==" aria-selected="false" classes="sphinx-tabs-tab code-tab group-tab" ids="tab-3-Rm9ydHJhbg==" name="Rm9ydHJhbg==" role="tab" tabindex="-1">
Fortran
<div aria-labelledby="tab-3-Qw==" classes="sphinx-tabs-panel code-tab group-tab" ids="panel-3-Qw==" name="Qw==" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="c" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="c" xml:space="preserve">
int main(const int argc, const char **argv) {
return 0;
}
<div aria-labelledby="tab-3-Qysr" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-3-Qysr" name="Qysr" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="c++" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="c++" xml:space="preserve">
int main(const int argc, const char **argv) {
return 0;
}
<div aria-labelledby="tab-3-UHl0aG9u" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-3-UHl0aG9u" name="UHl0aG9u" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="py" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="py" xml:space="preserve">
def main():
return
<div aria-labelledby="tab-3-SmF2YQ==" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-3-SmF2YQ==" name="SmF2YQ==" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="java" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="java" xml:space="preserve">
class Main {
public static void main(String[] args) {
}
}
<div aria-labelledby="tab-3-SnVsaWE=" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-3-SnVsaWE=" name="SnVsaWE=" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="julia" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="julia" xml:space="preserve">
function main()
end
<div aria-labelledby="tab-3-Rm9ydHJhbg==" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-3-Rm9ydHJhbg==" name="Rm9ydHJhbg==" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="fortran" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="fortran" xml:space="preserve">
PROGRAM main
END PROGRAM main
<section ids="group-tabs" names="group\ tabs">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<document source="index.rst" translation_progress="{'total': 0, 'translated': 0}">
<compound classes="toctree-wrapper">
<toctree caption="True" entries="(None,\ 'no_tabs1') (None,\ 'no_tabs2')" glob="False" hidden="False" includefiles="no_tabs1 no_tabs2" includehidden="False" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="False">
<toctree caption="True" entries="(None,\ 'no_tabs1') (None,\ 'no_tabs2')" glob="0" hidden="0" includefiles="no_tabs1 no_tabs2" includehidden="0" maxdepth="-1" numbered="0" parent="index" rawentries="" titlesonly="0">
<section ids="fruits" names="fruits">
<title>
Fruits
Expand Down Expand Up @@ -54,22 +54,22 @@
<button aria-controls="panel-2-Rm9ydHJhbg==" aria-selected="false" classes="sphinx-tabs-tab code-tab group-tab" ids="tab-2-Rm9ydHJhbg==" name="Rm9ydHJhbg==" role="tab" tabindex="-1">
Fortran
<div aria-labelledby="tab-2-Qw==" classes="sphinx-tabs-panel code-tab group-tab" ids="panel-2-Qw==" name="Qw==" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="c" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="c" xml:space="preserve">
C Main Function
<div aria-labelledby="tab-2-Qysr" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-2-Qysr" name="Qysr" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="c++" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="c++" xml:space="preserve">
C++ Main Function
<div aria-labelledby="tab-2-UHl0aG9u" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-2-UHl0aG9u" name="UHl0aG9u" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="py" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="py" xml:space="preserve">
Python Main Function
<div aria-labelledby="tab-2-SmF2YQ==" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-2-SmF2YQ==" name="SmF2YQ==" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="java" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="java" xml:space="preserve">
Java Main Function
<div aria-labelledby="tab-2-SnVsaWE=" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-2-SnVsaWE=" name="SnVsaWE=" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="julia" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="julia" xml:space="preserve">
Julia Main Function
<div aria-labelledby="tab-2-Rm9ydHJhbg==" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-2-Rm9ydHJhbg==" name="Rm9ydHJhbg==" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="fortran" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="fortran" xml:space="preserve">
Fortran Main Function
<container classes="sphinx-tabs" type="tab-element">
<div aria-label="Tabbed content" classes="closeable" role="tablist">
Expand All @@ -86,31 +86,31 @@
<button aria-controls="panel-3-Rm9ydHJhbg==" aria-selected="false" classes="sphinx-tabs-tab code-tab group-tab" ids="tab-3-Rm9ydHJhbg==" name="Rm9ydHJhbg==" role="tab" tabindex="-1">
Fortran
<div aria-labelledby="tab-3-Qw==" classes="sphinx-tabs-panel code-tab group-tab" ids="panel-3-Qw==" name="Qw==" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="c" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="c" xml:space="preserve">
int main(const int argc, const char **argv) {
return 0;
}
<div aria-labelledby="tab-3-Qysr" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-3-Qysr" name="Qysr" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="c++" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="c++" xml:space="preserve">
int main(const int argc, const char **argv) {
return 0;
}
<div aria-labelledby="tab-3-UHl0aG9u" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-3-UHl0aG9u" name="UHl0aG9u" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="py" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="py" xml:space="preserve">
def main():
return
<div aria-labelledby="tab-3-SmF2YQ==" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-3-SmF2YQ==" name="SmF2YQ==" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="java" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="java" xml:space="preserve">
class Main {
public static void main(String[] args) {
}
}
<div aria-labelledby="tab-3-SnVsaWE=" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-3-SnVsaWE=" name="SnVsaWE=" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="julia" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="julia" xml:space="preserve">
function main()
end
<div aria-labelledby="tab-3-Rm9ydHJhbg==" classes="sphinx-tabs-panel code-tab group-tab" hidden="true" ids="panel-3-Rm9ydHJhbg==" name="Rm9ydHJhbg==" role="tabpanel" tabindex="0">
<literal_block force="False" highlight_args="{}" language="fortran" xml:space="preserve">
<literal_block force="0" highlight_args="{}" language="fortran" xml:space="preserve">
PROGRAM main
END PROGRAM main
<section ids="group-tabs" names="group\ tabs">
Expand Down
Loading
Loading