diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index 581d40e..b76189b 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -12,25 +12,14 @@ on:
jobs:
- pre-commit:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
- - name: Set up Python 3.8
- uses: actions/setup-python@v1
- with:
- python-version: 3.8
- - uses: pre-commit/action@v2.0.0
-
py-tests:
runs-on: ubuntu-latest
strategy:
matrix:
- python-version: [3.6, 3.7, 3.8]
- sphinx: [">=2,<3", ">=3,<4", "==4.0.0b1"]
+ python-version: ["3.7", "3.8", "3.9", "3.10"]
+ sphinx: [">=3,<4", ">=5,<6"]
+ pygments: ["==2.8.0", "==2.9.0", "==2.12.0",]
steps:
- uses: actions/checkout@v2
@@ -42,6 +31,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install "sphinx${{ matrix.sphinx }}"
+ pip install "pygments${{ matrix.pygments }}"
pip install .[testing]
- name: Run pytest
run: |
@@ -65,14 +55,14 @@ jobs:
with:
node-version: '15'
- name: Install jest
- run: npm install jest
+ run: npm install jest@26.6.3
- name: Run JS tests
run: npm test
publish:
name: Publish to PyPi
- needs: [pre-commit, py-tests, js-tests]
+ needs: [py-tests, js-tests]
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 98a36ca..d21ed03 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,7 +1,7 @@
repos:
- - repo: git://github.com/pre-commit/pre-commit-hooks
- rev: v2.2.3
+ - repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v4.3.0
hooks:
- id: check-json
- id: check-yaml
@@ -11,17 +11,17 @@ repos:
".xml"
- repo: https://github.com/mgedmin/check-manifest
- rev: "0.39"
+ rev: "0.48"
hooks:
- id: check-manifest
- repo: https://github.com/psf/black
- rev: stable
+ rev: 22.3.0
hooks:
- id: black
- repo: https://github.com/PyCQA/pylint
- rev: pylint-2.4.2
+ rev: v2.14.3
hooks:
- id: pylint
args:
diff --git a/.readthedocs.yml b/.readthedocs.yml
index f727eca..1bfa2df 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -9,3 +9,6 @@ python:
sphinx:
builder: html
fail_on_warning: true
+
+formats:
+ - pdf
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 600b6e5..8b6e67f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,63 @@
# Change Log
+## 3.4.0 - 2022-06-26
+
+### Added
+
+* Testing for sphinx 5
+* Tesing for python 3.10
+
+### Fixed
+
+* Fixed parsing of MyST content, where first line was being stripped
+* Typos in documentation
+* Failing regression tests
+
+
+### Changed
+
+* Testing to use an up-to-date pytest version
+
+### Removed
+
+* Testing for python 3.6 and sphinx versions 2 and 4 (see [#164](https://github.com/executablebooks/sphinx-tabs/pull/164)). Note that the package will likely continue to work fine with these, but this won't be assured by tests
+
+
+## 3.3.1 - 2022-03-17
+
+### Fixed
+
+* Inserting CSS at the start of the static path list, so that it can be overwritten
+* Assume light theme is the default, even when browser setting prefers dark. Necessary when most sphinx themes don't set `data-theme`.
+
+## 3.3.0 - 2022-03-09
+
+### Added
+
+* Testing for Python 3.9 and a few pygments versions
+* Dark theme selectors
+
+### Changed
+
+* Bumped docutils dependency to 0.17
+* Remaining string formatting to use f-strings
+
+## 3.2.0 - 2021-06-11
+
+### Fixed
+
+* 🐛 Added default value for `exports` in JavaScript. Removes error that `exports` is not defined on page
+
+### Added
+
+* 👌 Use of [`sphinx` HTML assets policy](https://github.com/sphinx-doc/sphinx/issues/9115) to decide whether include assets
+
+## 3.1.0 - 2021-06-11
+
+### Added
+
+* 👌 Added new sphinx config `sphinx_tabs_disable_css_loading` option to disable css from loading
+
## 3.0.0 - 2021-05-10
### Fixed
@@ -30,7 +88,7 @@
## 2.0.0 - 2021-01-24
-♻️ Refactor to reduce JS/CSS payload size and improve accesibility:
+♻️ Refactor to reduce JS/CSS payload size and improve accessibility:
* Removed semantic-ui assets
* Removed unused 'sphinx_tabs_nowarn' sphinx option
@@ -38,7 +96,7 @@
* Changed tab HTML to use tab roles
* Changed tab label colour, to increase contrast with background
* Added ARIA labels for tabs and panels
-* Added tabindex atributes to allow users to focus and switch tabs using a keyboard
+* Added tabindex attributes to allow users to focus and switch tabs using a keyboard
* Added a margin below images inside tab content
✨ New features:
diff --git a/docs/index.rst b/docs/index.rst
index bff194c..42a4a56 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -42,6 +42,12 @@ Custom lexers that have been loaded in the sphinx `conf.py` can be used with `co
def setup(app):
app.add_lexer('alias', MyCustomLexer())
+By default, the extension loads predefined CSS styles for tabs. To disable the CSS from loading, add the following to your `conf.py`:
+
+.. code-block:: python
+
+ sphinx_tabs_disable_css_loading = True
+
Basic Tabs
===========
diff --git a/setup.py b/setup.py
index a254a2a..81267ed 100755
--- a/setup.py
+++ b/setup.py
@@ -24,12 +24,12 @@ def get_version():
include_package_data=True,
url="https://github.com/executablebooks/sphinx-tabs",
license="MIT",
- python_requires="~=3.6",
- install_requires=["sphinx>=2,<5", "pygments", "docutils~=0.16.0"],
+ python_requires="~=3.7",
+ install_requires=["sphinx>=2,<6", "pygments", "docutils~=0.17.0", "jinja2<3.1.0"],
extras_require={
"testing": [
"coverage",
- "pytest>=3.6,<4",
+ "pytest>=7.1,<8",
"pytest-cov",
"pytest-regressions",
"pygments",
@@ -37,7 +37,7 @@ def get_version():
"bs4",
"rinohtype",
],
- "code_style": ["pre-commit==2.6"],
+ "code_style": ["pre-commit==2.13.0"],
},
classifiers=[
"Development Status :: 5 - Production/Stable",
@@ -48,9 +48,10 @@ def get_version():
"License :: OSI Approved :: MIT License",
"Natural Language :: English",
"Operating System :: OS Independent",
- "Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
"Programming Language :: Python",
"Topic :: Documentation :: Sphinx",
"Topic :: Documentation",
diff --git a/sphinx_tabs/__init__.py b/sphinx_tabs/__init__.py
index ecd1987..90cd713 100644
--- a/sphinx_tabs/__init__.py
+++ b/sphinx_tabs/__init__.py
@@ -1,3 +1,3 @@
-__version__ = "3.0.0"
+__version__ = "3.4.0"
__import__("pkg_resources").declare_namespace(__name__)
diff --git a/sphinx_tabs/static/tabs.css b/sphinx_tabs/static/tabs.css
index c74e895..957ba60 100644
--- a/sphinx_tabs/static/tabs.css
+++ b/sphinx_tabs/static/tabs.css
@@ -51,3 +51,39 @@
.sphinx-tab img {
margin-bottom: 24 px;
}
+
+/* Dark theme preference styling */
+
+@media (prefers-color-scheme: dark) {
+ body[data-theme="auto"] .sphinx-tabs-panel {
+ color: white;
+ background-color: rgb(50, 50, 50);
+ }
+
+ body[data-theme="auto"] .sphinx-tabs-tab {
+ color: white;
+ background-color: rgba(255, 255, 255, 0.05);
+ }
+
+ body[data-theme="auto"] .sphinx-tabs-tab[aria-selected="true"] {
+ border-bottom: 1px solid rgb(50, 50, 50);
+ background-color: rgb(50, 50, 50);
+ }
+}
+
+/* Explicit dark theme styling */
+
+body[data-theme="dark"] .sphinx-tabs-panel {
+ color: white;
+ background-color: rgb(50, 50, 50);
+}
+
+body[data-theme="dark"] .sphinx-tabs-tab {
+ color: white;
+ background-color: rgba(255, 255, 255, 0.05);
+}
+
+body[data-theme="dark"] .sphinx-tabs-tab[aria-selected="true"] {
+ border-bottom: 2px solid rgb(50, 50, 50);
+ background-color: rgb(50, 50, 50);
+}
diff --git a/sphinx_tabs/static/tabs.js b/sphinx_tabs/static/tabs.js
index 508470c..48dc303 100644
--- a/sphinx_tabs/static/tabs.js
+++ b/sphinx_tabs/static/tabs.js
@@ -134,6 +134,10 @@ function selectNamedTabs(name, clickedId=null) {
})
}
+if (typeof exports === 'undefined') {
+ exports = {};
+}
+
exports.keyTabs = keyTabs;
exports.changeTabs = changeTabs;
exports.selectTab = selectTab;
diff --git a/sphinx_tabs/tabs.py b/sphinx_tabs/tabs.py
index ca8627d..d2be1ad 100644
--- a/sphinx_tabs/tabs.py
+++ b/sphinx_tabs/tabs.py
@@ -3,6 +3,8 @@
import base64
from pathlib import Path
from functools import partial
+import sphinx
+
from docutils import nodes
from docutils.parsers.rst import directives
@@ -89,7 +91,7 @@ def run(self):
self.env.temp_data["tabs_stack"] = []
tabs_id = self.env.temp_data["next_tabs_id"]
- tabs_key = "tabs_%d" % tabs_id
+ tabs_key = f"tabs_{tabs_id}"
self.env.temp_data["next_tabs_id"] += 1
self.env.temp_data["tabs_stack"].append(tabs_id)
@@ -139,7 +141,7 @@ def run(self):
self.assert_has_content()
tabs_id = self.env.temp_data["tabs_stack"][-1]
- tabs_key = "tabs_%d" % tabs_id
+ tabs_key = f"tabs_{tabs_id}"
include_tabs_id_in_data_tab = False
if self.tab_id is None:
@@ -158,13 +160,13 @@ def run(self):
i = 1
while tab_id in self.env.temp_data[tabs_key]["tab_ids"]:
- tab_id = "%s-%d" % (tab_id, i)
+ tab_id = f"{tab_id}-{i}"
i += 1
self.env.temp_data[tabs_key]["tab_ids"].append(tab_id)
data_tab = str(tab_id)
if include_tabs_id_in_data_tab:
- data_tab = "%d-%s" % (tabs_id, data_tab)
+ data_tab = f"{tabs_id}-{data_tab}"
self.env.temp_data[tabs_key]["tab_titles"].append((data_tab, tab_name))
@@ -182,7 +184,7 @@ def run(self):
else:
panel["hidden"] = "true"
- self.state.nested_parse(self.content[2:], self.content_offset, panel)
+ self.state.nested_parse(self.content[1:], self.content_offset, panel)
if self.env.app.builder.name not in get_compatible_builders(self.env.app):
# Use base docutils classes
@@ -192,7 +194,7 @@ def run(self):
panel = nodes.container()
self.state.nested_parse(self.content[0:1], 0, tab_name)
- self.state.nested_parse(self.content[2:], self.content_offset, panel)
+ self.state.nested_parse(self.content[1:], self.content_offset, panel)
tab += tab_name
outer_node += tab
@@ -250,8 +252,10 @@ def run(self):
else:
try:
tab_name = LEXER_MAP[self.arguments[0]]
- except:
- raise ValueError("Lexer not implemented: {}".format(self.arguments[0]))
+ except KeyError as invalid_lexer_error:
+ raise ValueError(
+ f"Lexer not implemented: {self.arguments[0]}"
+ ) from invalid_lexer_error
self.tab_classes.add("code-tab")
@@ -291,6 +295,21 @@ def found_tabs_directive(self):
return self._found
+def update_config(app, config):
+ """Adds sphinx-tabs CSS and JS asset files"""
+ for path in [Path(path) for path in FILES]:
+ if not config.sphinx_tabs_disable_css_loading and path.suffix == ".css":
+ if "add_css_file" in dir(app):
+ app.add_css_file(path.as_posix())
+ else:
+ app.add_stylesheet(path.as_posix())
+ if path.suffix == ".js":
+ if "add_script_file" in dir(app):
+ app.add_script_file(path.as_posix())
+ else:
+ app.add_js_file(path.as_posix())
+
+
# pylint: disable=unused-argument
def update_context(app, pagename, templatename, context, doctree):
"""Remove sphinx-tabs CSS and JS asset files if not used in a page"""
@@ -298,7 +317,12 @@ def update_context(app, pagename, templatename, context, doctree):
return
visitor = _FindTabsDirectiveVisitor(doctree)
doctree.walk(visitor)
- if not visitor.found_tabs_directive:
+
+ include_assets_in_all_pages = False
+ if sphinx.version_info >= (4, 1, 0):
+ include_assets_in_all_pages = app.registry.html_assets_policy == "always"
+
+ if not visitor.found_tabs_directive and not include_assets_in_all_pages:
paths = [Path("_static") / f for f in FILES]
if "css_files" in context:
context["css_files"] = context["css_files"][:]
@@ -318,6 +342,7 @@ def update_context(app, pagename, templatename, context, doctree):
def setup(app):
"""Set up the plugin"""
app.add_config_value("sphinx_tabs_valid_builders", [], "")
+ app.add_config_value("sphinx_tabs_disable_css_loading", False, "html", [bool])
app.add_config_value("sphinx_tabs_disable_tab_closing", False, "html", [bool])
app.add_node(SphinxTabsContainer, html=(visit, depart))
app.add_node(SphinxTabsPanel, html=(visit, depart))
@@ -330,19 +355,9 @@ def setup(app):
static_dir = Path(__file__).parent / "static"
app.connect(
"builder-inited",
- (lambda app: app.config.html_static_path.append(static_dir.as_posix())),
+ (lambda app: app.config.html_static_path.insert(0, static_dir.as_posix())),
)
- for path in [Path(path) for path in FILES]:
- if path.suffix == ".css":
- if "add_css_file" in dir(app):
- app.add_css_file(path.as_posix())
- else:
- app.add_stylesheet(path.as_posix())
- if path.suffix == ".js":
- if "add_script_file" in dir(app):
- app.add_script_file(path.as_posix())
- else:
- app.add_js_file(path.as_posix())
+ app.connect("config-inited", update_config)
app.connect("html-page-context", update_context)
return {
diff --git a/tests/conftest.py b/tests/conftest.py
index 63ee54a..b1f0728 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -9,6 +9,12 @@
pytest_plugins = "sphinx.testing.fixtures"
+def pytest_configure(config):
+ config.addinivalue_line(
+ "markers", "noautobuild: mark test to prevent autouse fixtures from running"
+ )
+
+
@pytest.fixture(scope="session")
def rootdir():
"""Pytest uses this to find test documents."""
@@ -75,17 +81,19 @@ def regress_sphinx_app_output(file_regression, get_sphinx_app_output):
non-deterministic).
"""
- def read(
- app, buildername="html", filename="index.html", encoding="utf-8", replace=None
- ):
+ def read(app, buildername="html", filename="index.html", encoding="utf-8"):
content = get_sphinx_app_output(app, buildername, filename, encoding)
if buildername == "html":
soup = BeautifulSoup(content, "html.parser")
+
+ # Remove output from ``pygments``, so that test only compares HTML of surrounding tabs
+ for div in soup.find_all("div", {"class": "highlight"}):
+ div.decompose()
+
doc_div = soup.findAll("div", {"class": "documentwrapper"})[0]
doc = doc_div.prettify()
- for find, rep in (replace or {}).items():
- doc = text.replace(find, rep)
+
else:
doc = content
file_regression.check(
@@ -130,7 +138,12 @@ def check_asset_links(get_sphinx_app_output):
"""
def check(
- app, buildername="html", filename="index.html", encoding="utf-8", present=True
+ app,
+ buildername="html",
+ filename="index.html",
+ encoding="utf-8",
+ cssPresent=True,
+ jsPresent=True,
):
content = get_sphinx_app_output(app, buildername, filename, encoding)
@@ -146,13 +159,16 @@ def check(
all_refs = css_refs + js_refs
- if present:
+ if cssPresent:
css_present = all(any(a in ref for ref in all_refs) for a in css_assets)
- js_present = all(any(a in ref for ref in js_refs) for a in js_assets)
assert css_present
+ else:
+ assert not "sphinx_tabs" in css_refs
+ if jsPresent:
+ js_present = all(any(a in ref for ref in js_refs) for a in js_assets)
assert js_present
else:
- assert not "sphinx_tabs" in css_refs + js_refs
+ assert not "sphinx_tabs" in js_refs
return check
diff --git a/tests/roots/test-conditionalassets-policy/conf.py b/tests/roots/test-conditionalassets-policy/conf.py
new file mode 100644
index 0000000..1fc6dcb
--- /dev/null
+++ b/tests/roots/test-conditionalassets-policy/conf.py
@@ -0,0 +1,5 @@
+project = "sphinx-tabs test"
+master_doc = "index"
+source_suffix = ".rst"
+extensions = ["sphinx_tabs.tabs"]
+pygments_style = "sphinx"
diff --git a/tests/roots/test-conditionalassets-policy/index.rst b/tests/roots/test-conditionalassets-policy/index.rst
new file mode 100644
index 0000000..1d1ec6e
--- /dev/null
+++ b/tests/roots/test-conditionalassets-policy/index.rst
@@ -0,0 +1,130 @@
+.. toctree::
+
+ no_tabs1
+ no_tabs2
+
+Fruits
+========================================
+
+.. tabs::
+
+ .. tab:: Apples
+
+ Apples are green, or sometimes red.
+
+ .. tab:: Pears
+
+ Pears are green.
+
+ .. tab:: Oranges
+
+ Oranges are orange.
+
+Luminaries
+========================================
+
+.. tabs::
+
+ .. tab:: Sun
+
+ The sun is a star.
+
+ .. tab:: Moon
+
+ The moon is not a star.
+
+Code Tabs
+========================================
+
+.. tabs::
+
+ .. code-tab:: c
+
+ C Main Function
+
+ .. code-tab:: c++
+
+ C++ Main Function
+
+ .. code-tab:: py
+
+ Python Main Function
+
+ .. code-tab:: java
+
+ Java Main Function
+
+ .. code-tab:: julia
+
+ Julia Main Function
+
+ .. code-tab:: fortran
+
+ Fortran Main Function
+
+.. tabs::
+
+ .. code-tab:: c
+
+ int main(const int argc, const char **argv) {
+ return 0;
+ }
+
+ .. code-tab:: c++
+
+ int main(const int argc, const char **argv) {
+ return 0;
+ }
+
+ .. code-tab:: py
+
+ def main():
+ return
+
+ .. code-tab:: java
+
+ class Main {
+ public static void main(String[] args) {
+ }
+ }
+
+ .. code-tab:: julia
+
+ function main()
+ end
+
+ .. code-tab:: fortran
+
+ PROGRAM main
+ END PROGRAM main
+
+Group Tabs
+========================================
+
+.. tabs::
+
+ .. group-tab:: Linux
+
+ Linux Line 1
+
+ .. group-tab:: Mac OSX
+
+ Mac OSX Line 1
+
+ .. group-tab:: Windows
+
+ Windows Line 1
+
+.. tabs::
+
+ .. group-tab:: Linux
+
+ Linux Line 2
+
+ .. group-tab:: Mac OSX
+
+ Mac OSX Line 2
+
+ .. group-tab:: Windows
+
+ Windows Line 2
diff --git a/tests/roots/test-conditionalassets-policy/no_tabs1.rst b/tests/roots/test-conditionalassets-policy/no_tabs1.rst
new file mode 100644
index 0000000..291ccfa
--- /dev/null
+++ b/tests/roots/test-conditionalassets-policy/no_tabs1.rst
@@ -0,0 +1,4 @@
+Another page without tabs
+========================================
+
+No tabs to see here
diff --git a/tests/roots/test-conditionalassets-policy/no_tabs2.rst b/tests/roots/test-conditionalassets-policy/no_tabs2.rst
new file mode 100644
index 0000000..99ef57d
--- /dev/null
+++ b/tests/roots/test-conditionalassets-policy/no_tabs2.rst
@@ -0,0 +1,4 @@
+And another page without tabs
+========================================
+
+No tabs to see here either
diff --git a/tests/roots/test-disable-css-loading/conf.py b/tests/roots/test-disable-css-loading/conf.py
new file mode 100644
index 0000000..3612f44
--- /dev/null
+++ b/tests/roots/test-disable-css-loading/conf.py
@@ -0,0 +1,7 @@
+project = "sphinx-tabs test"
+master_doc = "index"
+source_suffix = ".rst"
+extensions = ["sphinx_tabs.tabs"]
+pygments_style = "sphinx"
+
+sphinx_tabs_disable_css_loading = True
diff --git a/tests/roots/test-disable-css-loading/index.rst b/tests/roots/test-disable-css-loading/index.rst
new file mode 100644
index 0000000..d1e8c41
--- /dev/null
+++ b/tests/roots/test-disable-css-loading/index.rst
@@ -0,0 +1,17 @@
+.. tabs::
+
+ .. tab:: Apples
+
+ Apples are green, or sometimes red.
+
+ .. tab:: Pears
+
+ Pears are green.
+
+ .. tab:: Oranges
+
+ Oranges are orange.
+
+ .. tab:: 404
+
+ A number in the name.
diff --git a/tests/test_build.py b/tests/test_build.py
index 23e6624..2e32014 100644
--- a/tests/test_build.py
+++ b/tests/test_build.py
@@ -1,3 +1,4 @@
+import sys
import pytest
import sphinx
from sphinx.application import Sphinx
@@ -10,7 +11,7 @@ def test_basic():
@pytest.mark.sphinx(testroot="notabs")
def test_no_tabs(app, check_asset_links):
- check_asset_links(app, present=False)
+ check_asset_links(app, cssPresent=False, jsPresent=False)
@pytest.mark.parametrize("docname", ["index", "no_tabs1", "no_tabs2"])
@@ -19,7 +20,39 @@ def test_conditional_assets(app, docname, check_asset_links):
if docname == "index":
check_asset_links(app)
else:
- check_asset_links(app, filename=docname + ".html", present=False)
+ check_asset_links(
+ app, filename=docname + ".html", cssPresent=False, jsPresent=False
+ )
+
+
+@pytest.mark.noautobuild
+@pytest.mark.parametrize("docname", ["index", "no_tabs1", "no_tabs2"])
+@pytest.mark.sphinx(testroot="conditionalassets-policy")
+@pytest.mark.skipif(
+ sphinx.version_info[:2] < (4, 1),
+ reason="Test uses option that was introduced in Sphinx 4.1 ",
+)
+def test_conditional_assets_html_assets_policy(
+ app,
+ docname,
+ status,
+ warning,
+ check_build_success,
+ get_sphinx_app_doctree,
+ regress_sphinx_app_output,
+ check_asset_links,
+):
+ app.set_html_assets_policy("always")
+
+ # Following lines are copied from ``auto_build_and_check`` since we need to
+ # set a config in the build object before auto build. Because of this, we
+ # need to use ``noautobuild``.
+ app.build()
+ check_build_success(status, warning)
+ get_sphinx_app_doctree(app, regress=True)
+ regress_sphinx_app_output(app)
+
+ check_asset_links(app, filename=docname + ".html")
@pytest.mark.sphinx(testroot="linenos")
@@ -32,9 +65,9 @@ def test_other_with_assets(app, check_asset_links):
@pytest.mark.sphinx(testroot="linenos")
@pytest.mark.skipif(
- sphinx.version_info[:2] <= (4, 0), reason="Test uses Sphinx 4 code blocks"
+ sphinx.version_info[:2] < (4, 0), reason="Test uses Sphinx 4 code blocks"
)
-def test_other_With_assets_new_style(app, check_asset_links):
+def test_other_with_assets_new_style(app, check_asset_links):
check_asset_links(app)
@@ -50,15 +83,23 @@ def test_custom_lexer(app, check_asset_links):
@pytest.mark.noautobuild
@pytest.mark.sphinx("rinoh", testroot="rinohtype-pdf")
+@pytest.mark.skipif(
+ sys.version_info < (3, 8), reason="Unknown dependency conflict in lower versions"
+)
def test_rinohtype_pdf(
app, status, warning, check_build_success, get_sphinx_app_doctree
):
app.build()
check_build_success(status, warning)
get_sphinx_app_doctree(app, regress=True)
- # Doesn't currently regression pdf test output
+ # Doesn't currently regression test pdf output
@pytest.mark.sphinx(testroot="disable-closing")
def test_disable_closing(app, check_asset_links):
check_asset_links(app)
+
+
+@pytest.mark.sphinx(testroot="disable-css-loading")
+def test_disable_css_loading(app, check_asset_links):
+ check_asset_links(app, cssPresent=False)
diff --git a/tests/test_build/test_conditional_assets_html_assets_policy_index_.html b/tests/test_build/test_conditional_assets_html_assets_policy_index_.html
new file mode 100644
index 0000000..66f00b1
--- /dev/null
+++ b/tests/test_build/test_conditional_assets_html_assets_policy_index_.html
@@ -0,0 +1,248 @@
+
+
+
+
+
+
+ Fruits
+
+
+
+
+
+
+
+
+
+
+ Apples are green, or sometimes red.
+
+
+
+
+
+ Oranges are orange.
+
+
+
+
+
+
+ Luminaries
+
+
+
+
+
+
+
+
+
+ The sun is a star.
+
+
+
+
+ The moon is not a star.
+
+
+
+
+
+
+ Code Tabs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Group Tabs
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/test_build/test_conditional_assets_html_assets_policy_index_.xml b/tests/test_build/test_conditional_assets_html_assets_policy_index_.xml
new file mode 100644
index 0000000..7fe4f8f
--- /dev/null
+++ b/tests/test_build/test_conditional_assets_html_assets_policy_index_.xml
@@ -0,0 +1,152 @@
+
+
+
+
+
+ Fruits
+
+
+