feat(lib): add options for skipping Sphinx directive (#423)

This commit is contained in:
Jérome Eertmans
2024-04-27 09:54:59 +02:00
committed by GitHub
parent 73490298b3
commit f17e855323
2 changed files with 21 additions and 1 deletions

View File

@ -10,6 +10,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
(unreleased)=
## [Unreleased](https://github.com/jeertmans/manim-slides/compare/v5.1.5...HEAD)
(unreleased-added)=
### Added
- Added options to skip the Manim Slides Sphinx directive.
[#423](https://github.com/jeertmans/manim-slides/pull/423)
(unreleased-chore)=
### Chore
@ -35,7 +41,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed broken `--show-config` command.
[#419](https://github.com/jeertmans/manim-slides/pull/419)
(v5.1.4)=
## [v5.1.4](https://github.com/jeertmans/manim-slides/compare/v5.1.3...v5.1.4)

View File

@ -86,6 +86,19 @@ A third application is to render scenes from another specific file::
you should probably not include examples that rely on external files, since
relative paths risk to be broken.
.. note::
If you want to skip rendering the slides (e.g., for testing)
you can either set the ``SKIP_MANIM_SLIDES`` environ
variable (to any value) or pass the ``skip-manim-slides``
tag to ``sphinx``:
.. code-block:: bash
sphinx-build -t skip-manim-slides <OTHER_SPHINX_OPTIONS>
# or if you use a Makefile
make html O=-tskip-manim-slides
Options
-------
@ -181,6 +194,7 @@ from __future__ import annotations
import csv
import itertools as it
import os
import re
import shlex
import sys
@ -272,6 +286,7 @@ class ManimSlidesDirective(Directive):
"skip-manim-slides"
in self.state.document.settings.env.app.builder.tags.tags
or self.state.document.settings.env.app.builder.name == "gettext"
or "SKIP_MANIM_SLIDES" in os.environ
)
if should_skip:
node = SkipManimNode()