diff --git a/src/doc/ca/intro/conf.py b/src/doc/ca/intro/conf.py index 877eba7eeb7..71d81dcdbf3 100644 --- a/src/doc/ca/intro/conf.py +++ b/src/doc/ca/intro/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/de/a_tour_of_sage/conf.py b/src/doc/de/a_tour_of_sage/conf.py index fb960f06ffd..71fc7ef9012 100644 --- a/src/doc/de/a_tour_of_sage/conf.py +++ b/src/doc/de/a_tour_of_sage/conf.py @@ -15,11 +15,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/de/thematische_anleitungen/conf.py b/src/doc/de/thematische_anleitungen/conf.py index b8ec2573f90..337f1a98c68 100644 --- a/src/doc/de/thematische_anleitungen/conf.py +++ b/src/doc/de/thematische_anleitungen/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/de/tutorial/conf.py b/src/doc/de/tutorial/conf.py index da1c19e0ffc..399a915e9f4 100644 --- a/src/doc/de/tutorial/conf.py +++ b/src/doc/de/tutorial/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/el/a_tour_of_sage/conf.py b/src/doc/el/a_tour_of_sage/conf.py index 5494e6c429c..0aa28370460 100644 --- a/src/doc/el/a_tour_of_sage/conf.py +++ b/src/doc/el/a_tour_of_sage/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/a_tour_of_sage/conf.py b/src/doc/en/a_tour_of_sage/conf.py index 440a70f5d5b..d86586e5527 100644 --- a/src/doc/en/a_tour_of_sage/conf.py +++ b/src/doc/en/a_tour_of_sage/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/constructions/conf.py b/src/doc/en/constructions/conf.py index a28d011781c..b6bbbbaab3b 100644 --- a/src/doc/en/constructions/conf.py +++ b/src/doc/en/constructions/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/developer/conf.py b/src/doc/en/developer/conf.py index 6e80447f4c7..e8877d61770 100644 --- a/src/doc/en/developer/conf.py +++ b/src/doc/en/developer/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/developer/packaging_sage_library.rst b/src/doc/en/developer/packaging_sage_library.rst index b3417b9ca28..9d30f1c3f5a 100644 --- a/src/doc/en/developer/packaging_sage_library.rst +++ b/src/doc/en/developer/packaging_sage_library.rst @@ -495,17 +495,6 @@ requiring all of Sage to be present. mechanism mentioned above can also be used for this. -Dependencies of the Sage documentation --------------------------------------- - -The documentation will not be modularized. - -However, some parts of the Sage reference manual may depend on functionality -provided by optional packages. These portions of the reference manual -should be conditionalized using the Sphinx directive ``.. ONLY::``, -as explained in :ref:`section-documentation-conditional`. - - Version constraints of dependencies ----------------------------------- diff --git a/src/doc/en/developer/sage_manuals.rst b/src/doc/en/developer/sage_manuals.rst index 13f6a3da94a..84cf0f4f3c3 100644 --- a/src/doc/en/developer/sage_manuals.rst +++ b/src/doc/en/developer/sage_manuals.rst @@ -299,32 +299,6 @@ procedure is different: * Add your file to the index contained in :sage_root:`src/doc/en/reference/combinat/module_list.rst`. -.. _section-documentation-conditional: - -Making portions of the reference manual conditional on optional features -======================================================================== - -For every dynamically detectable feature such as :class:`graphviz -<~sage.features.graphviz.Graphviz>` or :class:`sage.symbolic -` (see :mod:`sage.features`), -Sage defines a Sphinx tag that can be used with the `Sphinx -directive ".. ONLY::" -`_. -Because Sphinx tags have to use Python identifier syntax, Sage uses -the format ``feature_``, followed by the feature name where dots are -replaced by underscores. Hence, conditionalizing on the features of -the previous examples would look as follows: - -.. CODE-BLOCK:: rest - - .. ONLY:: feature_graphviz - -and: - -.. CODE-BLOCK:: rest - - .. ONLY:: feature_sage_symbolic - .. _section-building-manuals: Building the manuals diff --git a/src/doc/en/faq/conf.py b/src/doc/en/faq/conf.py index a175e9cf0ee..4c8a71bd9d1 100644 --- a/src/doc/en/faq/conf.py +++ b/src/doc/en/faq/conf.py @@ -15,11 +15,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/installation/conf.py b/src/doc/en/installation/conf.py index 7e6174b0d90..ea6956d2678 100644 --- a/src/doc/en/installation/conf.py +++ b/src/doc/en/installation/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/prep/conf.py b/src/doc/en/prep/conf.py index 03ff6ed7afc..645d451644d 100644 --- a/src/doc/en/prep/conf.py +++ b/src/doc/en/prep/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/reference/conf.py b/src/doc/en/reference/conf.py index 92b8a8d45b4..984c43363f2 100644 --- a/src/doc/en/reference/conf.py +++ b/src/doc/en/reference/conf.py @@ -15,11 +15,6 @@ from sage_docbuild.conf import release, latex_elements, exclude_patterns from sage_docbuild.conf import * - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/reference/conf_sub.py b/src/doc/en/reference/conf_sub.py index c7adc1da994..479e9c306d2 100644 --- a/src/doc/en/reference/conf_sub.py +++ b/src/doc/en/reference/conf_sub.py @@ -15,11 +15,6 @@ from sage_docbuild.conf import release, exclude_patterns from sage_docbuild.conf import * - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/reference/polynomial_rings/index.rst b/src/doc/en/reference/polynomial_rings/index.rst index a3b32b51ce7..0325ac79d62 100644 --- a/src/doc/en/reference/polynomial_rings/index.rst +++ b/src/doc/en/reference/polynomial_rings/index.rst @@ -75,11 +75,9 @@ Tropical Polynomials Boolean Polynomials ------------------- -.. ONLY:: feature_sage_rings_polynomial_pbori - - .. toctree:: - :maxdepth: 1 +.. toctree:: + :maxdepth: 1 - sage/rings/polynomial/pbori/pbori + sage/rings/polynomial/pbori/pbori .. include:: ../footer.txt diff --git a/src/doc/en/thematic_tutorials/conf.py b/src/doc/en/thematic_tutorials/conf.py index 581a8e89fc6..cb6d1662f47 100644 --- a/src/doc/en/thematic_tutorials/conf.py +++ b/src/doc/en/thematic_tutorials/conf.py @@ -15,11 +15,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/thematic_tutorials/explicit_methods_in_number_theory/conf.py b/src/doc/en/thematic_tutorials/explicit_methods_in_number_theory/conf.py index 9de7aa68adb..b8eef385e4f 100644 --- a/src/doc/en/thematic_tutorials/explicit_methods_in_number_theory/conf.py +++ b/src/doc/en/thematic_tutorials/explicit_methods_in_number_theory/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/thematic_tutorials/numerical_sage/conf.py b/src/doc/en/thematic_tutorials/numerical_sage/conf.py index c8e220f8f99..5772289f6fa 100644 --- a/src/doc/en/thematic_tutorials/numerical_sage/conf.py +++ b/src/doc/en/thematic_tutorials/numerical_sage/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/tutorial/conf.py b/src/doc/en/tutorial/conf.py index 52be3420ed1..b566ec19677 100644 --- a/src/doc/en/tutorial/conf.py +++ b/src/doc/en/tutorial/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/en/tutorial/latex.rst b/src/doc/en/tutorial/latex.rst index 73ef2df3a31..a173afd75c5 100644 --- a/src/doc/en/tutorial/latex.rst +++ b/src/doc/en/tutorial/latex.rst @@ -49,7 +49,7 @@ output of the entered commands automatically. You can start this automatic rendering by executing ``%display latex`` (and stop by executing ``%display plain``). -.. ONLY:: html and feature_jupyter_sphinx +.. ONLY:: html Thus, in the Jupyter notebook, you get diff --git a/src/doc/en/website/conf.py b/src/doc/en/website/conf.py index b238169bb3c..38f31e5d46f 100644 --- a/src/doc/en/website/conf.py +++ b/src/doc/en/website/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/es/a_tour_of_sage/conf.py b/src/doc/es/a_tour_of_sage/conf.py index 801f7cadb95..dee2afa4d66 100644 --- a/src/doc/es/a_tour_of_sage/conf.py +++ b/src/doc/es/a_tour_of_sage/conf.py @@ -15,11 +15,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/es/tutorial/conf.py b/src/doc/es/tutorial/conf.py index dcb44232ca0..43e23fdc568 100644 --- a/src/doc/es/tutorial/conf.py +++ b/src/doc/es/tutorial/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/fr/a_tour_of_sage/conf.py b/src/doc/fr/a_tour_of_sage/conf.py index 0fcc6f5cc4b..3394d376087 100644 --- a/src/doc/fr/a_tour_of_sage/conf.py +++ b/src/doc/fr/a_tour_of_sage/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release, latex_elements from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/fr/tutorial/conf.py b/src/doc/fr/tutorial/conf.py index ef795861bf9..1b4057b2508 100644 --- a/src/doc/fr/tutorial/conf.py +++ b/src/doc/fr/tutorial/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release, latex_elements from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/hu/a_tour_of_sage/conf.py b/src/doc/hu/a_tour_of_sage/conf.py index 2e5215fcf5d..b097f56dfe0 100644 --- a/src/doc/hu/a_tour_of_sage/conf.py +++ b/src/doc/hu/a_tour_of_sage/conf.py @@ -15,11 +15,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/it/a_tour_of_sage/conf.py b/src/doc/it/a_tour_of_sage/conf.py index 48a568cc4d1..d06280ece36 100644 --- a/src/doc/it/a_tour_of_sage/conf.py +++ b/src/doc/it/a_tour_of_sage/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release, latex_elements from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/it/faq/conf.py b/src/doc/it/faq/conf.py index 84a8ac93eab..e3898184a1f 100644 --- a/src/doc/it/faq/conf.py +++ b/src/doc/it/faq/conf.py @@ -15,11 +15,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/it/tutorial/conf.py b/src/doc/it/tutorial/conf.py index ea77f3199b0..15186edb4ba 100644 --- a/src/doc/it/tutorial/conf.py +++ b/src/doc/it/tutorial/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release, latex_elements from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/ja/a_tour_of_sage/conf.py b/src/doc/ja/a_tour_of_sage/conf.py index eef0eba83b3..e8ec7cca39b 100644 --- a/src/doc/ja/a_tour_of_sage/conf.py +++ b/src/doc/ja/a_tour_of_sage/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release, latex_elements from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/ja/tutorial/conf.py b/src/doc/ja/tutorial/conf.py index eaaa4558a34..9002593de99 100644 --- a/src/doc/ja/tutorial/conf.py +++ b/src/doc/ja/tutorial/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release, latex_elements from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/pt/a_tour_of_sage/conf.py b/src/doc/pt/a_tour_of_sage/conf.py index 806bc1b77c8..267d499ca64 100644 --- a/src/doc/pt/a_tour_of_sage/conf.py +++ b/src/doc/pt/a_tour_of_sage/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/pt/tutorial/conf.py b/src/doc/pt/tutorial/conf.py index 26368567ee4..a5cabc5b0d1 100644 --- a/src/doc/pt/tutorial/conf.py +++ b/src/doc/pt/tutorial/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/ru/tutorial/conf.py b/src/doc/ru/tutorial/conf.py index f2f44113045..5d39f7d2600 100644 --- a/src/doc/ru/tutorial/conf.py +++ b/src/doc/ru/tutorial/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/doc/tr/a_tour_of_sage/conf.py b/src/doc/tr/a_tour_of_sage/conf.py index 04d20c565a9..bb4dbc58365 100644 --- a/src/doc/tr/a_tour_of_sage/conf.py +++ b/src/doc/tr/a_tour_of_sage/conf.py @@ -13,11 +13,6 @@ from sage_docbuild.conf import release from sage_docbuild.conf import * # NOQA - -for tag in feature_tags(): - tags.add(tag) - - # Add any paths that contain custom static files (such as style sheets), # relative to this directory to html_static_path. They are copied after the # builtin static files, so a file named "default.css" will overwrite the diff --git a/src/sage_docbuild/builders.py b/src/sage_docbuild/builders.py index ab39d93c280..dc93754ec98 100644 --- a/src/sage_docbuild/builders.py +++ b/src/sage_docbuild/builders.py @@ -1035,8 +1035,6 @@ def get_modules(self, filename): Given a filename for a reST file, return an iterator for all of the autogenerated reST files that it includes. """ - from sage.features.all import all_features - # Create the regular expression used to detect an autogenerated file auto_re = re.compile(r'^\s*(..\/)*(sage(_docbuild)?\/[\w\/]*)\s*$') @@ -1044,24 +1042,7 @@ def get_modules(self, filename): with open(filename) as f: lines = f.readlines() - skip = False for line in lines: - if skip: - if not line.strip() or line.count(' ', 0) >= indent: - continue - skip = False - elif line.lstrip().lower().startswith('.. only::'): - try: - tag_name = line[line.index('feature_') + 8:].strip() - for feature in all_features(): - if tag_name == feature.name.replace('.', '_') and feature.is_present(): - break - else: - skip = True - indent = line.index('.. ') + 3 - continue - except ValueError: - pass match = auto_re.match(line) if match: yield match.group(2).replace(os.path.sep, '.') diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index 2b1cbd138ae..6a50b1daa40 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -15,26 +15,24 @@ # https://www.gnu.org/licenses/ # **************************************************************************** -# Load configuration shared with sage.misc.sphinxify -from sage.misc.sagedoc_conf import * - -import sys +import importlib import os import re -import importlib +import sys + import dateutil.parser -import sphinx -import sphinx.ext.intersphinx as intersphinx +from IPython.lib.lexers import IPyLexer, IPythonConsoleLexer from sphinx import highlighting +from sphinx.ext import intersphinx from sphinx.transforms import SphinxTransform from sphinx.util.docutils import SphinxDirective -from IPython.lib.lexers import IPythonConsoleLexer, IPyLexer -from sage.misc.sagedoc import extlinks -from sage.env import SAGE_DOC_SRC, SAGE_DOC, PPLPY_DOCS, MATHJAX_DIR -from sage.misc.latex_macros import sage_mathjax_macros -from sage.features.sphinx import JupyterSphinx -from sage.features.all import all_features + import sage.version +from sage.env import MATHJAX_DIR, PPLPY_DOCS, SAGE_DOC, SAGE_DOC_SRC +from sage.features.sphinx import JupyterSphinx +from sage.misc.latex_macros import sage_mathjax_macros +from sage.misc.sagedoc import extlinks as extlinks # noqa: PLC0414 +from sage.misc.sagedoc_conf import * # Load configuration shared with sage.misc.sphinxify # --------------------- # General configuration @@ -377,8 +375,8 @@ def set_intersphinx_mappings(app, config): # https://www.sphinx-doc.org/en/master/usage/extensions/linkcode.html def linkcode_resolve(domain, info): - import inspect from urllib.parse import quote + from sage.misc.sageinspect import sage_getsourcelines if domain != 'py': return None @@ -967,7 +965,10 @@ def apply(self): if self.app.builder.tags.has('html') or self.app.builder.tags.has('inventory'): for node in list(self.document.findall(nodes.literal_block)): if node.get('language') is None and node.astext().startswith('sage:'): - from docutils.nodes import container as Container, label as Label, literal_block as LiteralBlock, Text + from docutils.nodes import Text + from docutils.nodes import container as Container + from docutils.nodes import label as Label + from docutils.nodes import literal_block as LiteralBlock from sphinx_inline_tabs._impl import TabContainer parent = node.parent index = parent.index(node) @@ -1027,7 +1028,7 @@ def apply(self): prev_node['classes'].append('with-python-tab') if SAGE_LIVE_DOC == 'yes': # Tab for Jupyter-sphinx cell - from jupyter_sphinx.ast import JupyterCellNode, CellInputNode + from jupyter_sphinx.ast import CellInputNode, JupyterCellNode source = node.rawsource lines = [] for line in source.splitlines(): @@ -1104,13 +1105,3 @@ def setup(app): # app.connect('missing-reference', missing_reference) app.connect('missing-reference', find_sage_dangling_links) app.connect('html-page-context', add_page_context) - - -# Conditional content -# https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#tags -# https://www.sphinx-doc.org/en/master/usage/configuration.html#conf-tags -# https://github.com/readthedocs/readthedocs.org/issues/4603#issuecomment-1411594800 -def feature_tags(): - for feature in all_features(): - if feature.is_present(): - yield 'feature_' + feature.name.replace('.', '_')