diff --git a/src/doc/common/static/custom-furo.css b/src/doc/common/static/custom-furo.css index fc76a3f7c0f..ae75c2b6383 100644 --- a/src/doc/common/static/custom-furo.css +++ b/src/doc/common/static/custom-furo.css @@ -21,3 +21,17 @@ a.pdf:hover { text-decoration: none; } +/* Style for announcement banner */ + +.announcement { + background: orange; +} + +.announcement-content { + color: black; +} + +.announcement-content a { + color: white; + text-decoration: none; +} diff --git a/src/doc/en/a_tour_of_sage/conf.py b/src/doc/en/a_tour_of_sage/conf.py index a27957cb7f1..99940562965 100644 --- a/src/doc/en/a_tour_of_sage/conf.py +++ b/src/doc/en/a_tour_of_sage/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/en/a_tour_of_sage", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/en/a_tour_of_sage', '{filename}'), }) # General information about the project. diff --git a/src/doc/en/constructions/conf.py b/src/doc/en/constructions/conf.py index a24d272be63..2797a22c271 100644 --- a/src/doc/en/constructions/conf.py +++ b/src/doc/en/constructions/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/en/constructions", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/en/constructions', '{filename}'), }) # General information about the project. diff --git a/src/doc/en/developer/conf.py b/src/doc/en/developer/conf.py index e63fae87a99..9e5683fdb87 100644 --- a/src/doc/en/developer/conf.py +++ b/src/doc/en/developer/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/en/developer", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/en/developer', '{filename}'), }) # General information about the project. diff --git a/src/doc/en/faq/conf.py b/src/doc/en/faq/conf.py index f6b3919b957..f3cb66c873d 100644 --- a/src/doc/en/faq/conf.py +++ b/src/doc/en/faq/conf.py @@ -24,7 +24,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/en/faq", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/en/faq', '{filename}'), }) # General information about the project. diff --git a/src/doc/en/installation/conf.py b/src/doc/en/installation/conf.py index 269093f1185..8d2b7694182 100644 --- a/src/doc/en/installation/conf.py +++ b/src/doc/en/installation/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/en/installation", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/en/installation', '{filename}'), }) # General information about the project. diff --git a/src/doc/en/prep/conf.py b/src/doc/en/prep/conf.py index 22546f04af9..1540f1e4c21 100644 --- a/src/doc/en/prep/conf.py +++ b/src/doc/en/prep/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/en/prep", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/en/prep', '{filename}'), }) # General information about the project. diff --git a/src/doc/en/reference/conf.py b/src/doc/en/reference/conf.py index 86aa0b05a81..9f3a4ec0364 100644 --- a/src/doc/en/reference/conf.py +++ b/src/doc/en/reference/conf.py @@ -25,6 +25,11 @@ ref_src = os.path.join(SAGE_DOC_SRC, 'en', 'reference') ref_out = os.path.join(SAGE_DOC, 'html', 'en', 'reference') +# Add a small edit button. +html_theme_options.update({ + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/en/reference/index.rst'), +}) + # General information about the project. project = "Reference Manual" diff --git a/src/doc/en/reference/conf_sub.py b/src/doc/en/reference/conf_sub.py index b6f20311d68..cbfeba20397 100644 --- a/src/doc/en/reference/conf_sub.py +++ b/src/doc/en/reference/conf_sub.py @@ -42,6 +42,11 @@ title = name.capitalize() title = title.replace('`', '$') +# We use the directory's name to add a small edit button. +html_theme_options.update({ + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/en/reference/{name}/index.rst'), +}) + # General information about the project. project = title diff --git a/src/doc/en/thematic_tutorials/conf.py b/src/doc/en/thematic_tutorials/conf.py index 73910657b2b..fc8dbc2a2cb 100644 --- a/src/doc/en/thematic_tutorials/conf.py +++ b/src/doc/en/thematic_tutorials/conf.py @@ -24,7 +24,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/en/thematic_tutorials", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/en/thematic_tutorials', '{filename}'), }) # General information about the project. diff --git a/src/doc/en/tutorial/conf.py b/src/doc/en/tutorial/conf.py index 957b215193d..b7e596ee913 100644 --- a/src/doc/en/tutorial/conf.py +++ b/src/doc/en/tutorial/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/en/tutorial", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/en/tutorial', '{filename}'), }) # General information about the project. diff --git a/src/doc/es/a_tour_of_sage/conf.py b/src/doc/es/a_tour_of_sage/conf.py index dd690c41184..974418c7ec8 100644 --- a/src/doc/es/a_tour_of_sage/conf.py +++ b/src/doc/es/a_tour_of_sage/conf.py @@ -24,7 +24,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/es/a_tour_of_sage", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/es/a_tour_of_sage', '{filename}'), }) # General information about the project. diff --git a/src/doc/es/tutorial/conf.py b/src/doc/es/tutorial/conf.py index 8d82ca43b43..f82f9631e8d 100644 --- a/src/doc/es/tutorial/conf.py +++ b/src/doc/es/tutorial/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/es/tutorial", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/es/tutorial', '{filename}'), }) # General information about the project. diff --git a/src/doc/fr/a_tour_of_sage/conf.py b/src/doc/fr/a_tour_of_sage/conf.py index 7a9ea830793..db98a3cce69 100644 --- a/src/doc/fr/a_tour_of_sage/conf.py +++ b/src/doc/fr/a_tour_of_sage/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/fr/a_tour_of_sage", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/fr/a_tour_of_sage', '{filename}'), }) # General information about the project. diff --git a/src/doc/fr/tutorial/conf.py b/src/doc/fr/tutorial/conf.py index 9fc1e6d6ee6..41e190c8780 100644 --- a/src/doc/fr/tutorial/conf.py +++ b/src/doc/fr/tutorial/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/fr/tutorial", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/fr/tutorial', '{filename}'), }) # General information about the project. diff --git a/src/doc/hu/a_tour_of_sage/conf.py b/src/doc/hu/a_tour_of_sage/conf.py index 422420e4681..7000cbb6323 100644 --- a/src/doc/hu/a_tour_of_sage/conf.py +++ b/src/doc/hu/a_tour_of_sage/conf.py @@ -24,7 +24,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/hu/a_tour_of_sage", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/hu/a_tour_of_sage', '{filename}'), }) # General information about the project. diff --git a/src/doc/it/a_tour_of_sage/conf.py b/src/doc/it/a_tour_of_sage/conf.py index ed49ebed736..2fb3a25c144 100644 --- a/src/doc/it/a_tour_of_sage/conf.py +++ b/src/doc/it/a_tour_of_sage/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/it/a_tour_of_sage", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/it/a_tour_of_sage', '{filename}'), }) # General information about the project. diff --git a/src/doc/it/faq/conf.py b/src/doc/it/faq/conf.py index de033f0714d..c6c5827f9d9 100644 --- a/src/doc/it/faq/conf.py +++ b/src/doc/it/faq/conf.py @@ -24,7 +24,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/it/faq", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/it/faq', '{filename}'), }) # General information about the project. diff --git a/src/doc/it/tutorial/conf.py b/src/doc/it/tutorial/conf.py index c614e2011a9..8b94a0b51d6 100644 --- a/src/doc/it/tutorial/conf.py +++ b/src/doc/it/tutorial/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/it/tutorial", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/it/tutorial', '{filename}'), }) # General information about the project. diff --git a/src/doc/ja/a_tour_of_sage/conf.py b/src/doc/ja/a_tour_of_sage/conf.py index 8aea104cd8b..da418f5b2a2 100644 --- a/src/doc/ja/a_tour_of_sage/conf.py +++ b/src/doc/ja/a_tour_of_sage/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/ja/a_tour_of_sage", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/ja/a_tour_of_sage', '{filename}'), }) # General information about the project. diff --git a/src/doc/ja/tutorial/conf.py b/src/doc/ja/tutorial/conf.py index bbcbab2ff51..22418475be8 100644 --- a/src/doc/ja/tutorial/conf.py +++ b/src/doc/ja/tutorial/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/ja/tutorial", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/ja/tutorial', '{filename}'), }) # General information about the project. diff --git a/src/doc/pt/a_tour_of_sage/conf.py b/src/doc/pt/a_tour_of_sage/conf.py index e5e65ce56ae..80ed6430bb4 100644 --- a/src/doc/pt/a_tour_of_sage/conf.py +++ b/src/doc/pt/a_tour_of_sage/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/pt/a_tour_of_sage", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/pt/a_tour_of_sage', '{filename}'), }) # General information about the project. diff --git a/src/doc/pt/tutorial/conf.py b/src/doc/pt/tutorial/conf.py index 7a2e1a0434e..bf96e55eb51 100644 --- a/src/doc/pt/tutorial/conf.py +++ b/src/doc/pt/tutorial/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/pt/tutorial", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/pt/tutorial', '{filename}'), }) # General information about the project. diff --git a/src/doc/ru/tutorial/conf.py b/src/doc/ru/tutorial/conf.py index 0055c7daa87..7df7bf4b6ae 100644 --- a/src/doc/ru/tutorial/conf.py +++ b/src/doc/ru/tutorial/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/ru/tutorial", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/ru/tutorial', '{filename}'), }) # General information about the project. diff --git a/src/doc/tr/a_tour_of_sage/conf.py b/src/doc/tr/a_tour_of_sage/conf.py index 6b75c1f136f..afacc779fe9 100644 --- a/src/doc/tr/a_tour_of_sage/conf.py +++ b/src/doc/tr/a_tour_of_sage/conf.py @@ -22,7 +22,7 @@ # Add a small edit button. html_theme_options.update({ - "source_directory": "src/doc/tr/a_tour_of_sage", + 'source_edit_link': os.path.join(source_repository, f'blob/{version}/src/doc/tr/a_tour_of_sage', '{filename}'), }) # General information about the project. diff --git a/src/sage/misc/sageinspect.py b/src/sage/misc/sageinspect.py index aff47ef96bb..dbd3a29aa42 100644 --- a/src/sage/misc/sageinspect.py +++ b/src/sage/misc/sageinspect.py @@ -3,14 +3,6 @@ This module extends parts of Python's inspect module to Cython objects. -AUTHORS: - -- originally taken from Fernando Perez's IPython -- William Stein (extensive modifications) -- Nick Alexander (extensions) -- Nick Alexander (testing) -- Simon King (some extension for Cython, generalisation of SageArgSpecVisitor) - EXAMPLES:: sage: from sage.misc.sageinspect import * @@ -112,6 +104,22 @@ def foo(unsigned int x=1, a=')"', b={not (2+1==3):'bar'}, *args, **kwds): return sage: sage_getargspec(foo) FullArgSpec(args=['x', 'a', 'b'], varargs='args', varkw='kwds', defaults=(1, ')"', {False: 'bar'}), kwonlyargs=[], kwonlydefaults=None, annotations={}) +AUTHORS: + +- Originally taken from Fernando Perez's IPython +- William Stein: extensive modifications +- William Stein: ``_sage_getargspec_cython()``: a modified version of + ``inspect.getargspec`` from the Python Standard Library, which was taken from + IPython for use in Sage. +- Nick Alexander: extensions, testing +- Simon King: some extension for Cython, generalisation of SageArgSpecVisitor +- Simon King: ``sage_getsourcelines()``: if a class has no docstring then let the + class definition be found starting from the ``__init__`` method. +- Simon King: ``sage_getsourcelines()``: Get source lines for dynamic classes +- Simon King (2013-02): ``_sage_getargspec_cython()``: recognise varargs and + default values in cython code, and return an ``ArgSpec``. +- Simon King: ``_sage_getargspec_cython()``: Return an ``ArgSpec``, fix some bugs. +- Simon King (2011-09): :func:`_sage_getsourcelines_name_with_dot` """ import ast @@ -282,11 +290,6 @@ def _extract_embedded_position(docstring): ....: print(f.read()) cpdef test_funct(x,y): return - AUTHORS: - - - William Stein - - Extensions by Nick Alexander - - Extension for interactive Cython code by Simon King """ try: res = __embedded_position_re.search(docstring) @@ -334,10 +337,6 @@ def _extract_embedded_signature(docstring, name): INPUT: ``docstring`` (string) - AUTHORS: - - - Simon King - EXAMPLES:: sage: from sage.misc.sageinspect import _extract_embedded_signature @@ -712,10 +711,6 @@ def visit_BoolOp(self, node): - The result that ``node`` represents - AUTHOR: - - - Simon King - EXAMPLES:: sage: import ast, sage.misc.sageinspect as sms @@ -751,10 +746,6 @@ def visit_Compare(self, node): - The result that ``node`` represents - AUTHOR: - - - Simon King - EXAMPLES:: sage: import ast, sage.misc.sageinspect as sms @@ -803,10 +794,6 @@ def visit_BinOp(self, node): - The result that ``node`` represents - AUTHOR: - - - Simon King - EXAMPLES:: sage: import ast, sage.misc.sageinspect as sms @@ -873,10 +860,6 @@ def visit_UnaryOp(self, node): - The result that ``node`` represents - AUTHOR: - - - Simon King - EXAMPLES:: sage: import ast, sage.misc.sageinspect as sms @@ -1223,11 +1206,7 @@ def _sage_getargspec_cython(source): kwonlyargs=[], kwonlydefaults=None, annotations={}) - AUTHORS: - - Nick Alexander: original version - - Simon King (02-2013): recognise varargs and default values in - cython code, and return an ``ArgSpec``. """ defpos = source.find('def ') @@ -1394,10 +1373,6 @@ def sage_getfile(obj): sage: sage_getfile(range) '' - AUTHORS: - - - Nick Alexander - - Simon King """ # We try to extract from docstrings, but not using Python's inspect # because _sage_getdoc_unformatted is more robust. @@ -1667,12 +1642,6 @@ def foo(x, a='\')"', b={not (2+1==3):'bar'}): return sage: shell.run_cell('f??') ...the source code string... - AUTHORS: - - - William Stein: a modified version of inspect.getargspec from the - Python Standard Library, which was taken from IPython for use in Sage. - - Extensions by Nick Alexander - - Simon King: Return an ``ArgSpec``, fix some bugs. """ from sage.misc.lazy_attribute import lazy_attribute from sage.misc.abstract_method import AbstractMethod @@ -1913,11 +1882,6 @@ def sage_getdef(obj, obj_name=''): If an exception is generated, None is returned instead and the exception is suppressed. - - AUTHORS: - - - William Stein - - extensions by Nick Alexander """ try: spec = sage_getargspec(obj) @@ -1982,11 +1946,6 @@ def _sage_getdoc_unformatted(obj): Exception: no doc here sage: _sage_getdoc_unformatted(obj) '' - - AUTHORS: - - - William Stein - - extensions by Nick Alexander """ if obj is None: return '' @@ -2123,11 +2082,6 @@ def sage_getdoc(obj, obj_name='', embedded=False): 'original documentation\n' sage: sage_getdoc(f1) 'specialised documentation\n' - - AUTHORS: - - - William Stein - - extensions by Nick Alexander """ import sage.misc.sagedoc if obj is None: @@ -2168,11 +2122,6 @@ def sage_getsource(obj): 'identity_matrix(ring, n=0, sparse=False):' sage: sage_getsource(identity_matrix)[19:60] # needs sage.modules 'identity_matrix(ring, n=0, sparse=False):' - - AUTHORS: - - - William Stein - - extensions by Nick Alexander """ # First we should check if the object has a _sage_src_ # method. If it does, we just return the output from @@ -2234,10 +2183,6 @@ class ParentMethods: has a docstring. Otherwise, the code of ``B`` could not be found (Cython inserts embedding information into the docstring) and thus the code of ``B.A`` couldn't be found either. - - AUTHOR: - - - Simon King (2011-09) """ # First, split the name: if '.' in obj.__name__: @@ -2344,26 +2289,29 @@ def sage_getsourcelines(obj): EXAMPLES:: + sage: # needs sage.modules sage: from sage.misc.sageinspect import sage_getsourcelines - sage: sage_getsourcelines(matrix)[1] # needs sage.modules + sage: sage_getsourcelines(matrix)[1] 21 - sage: sage_getsourcelines(matrix)[0][0] # needs sage.modules + sage: sage_getsourcelines(matrix)[0][0] 'def matrix(*args, **kwds):\n' Some classes customize this using a ``_sage_src_lines_`` method, which gives the source lines of a class instance, but not the class itself. We demonstrate this for :class:`CachedFunction`:: - sage: cachedfib = cached_function(fibonacci) # needs sage.combinat - sage: sage_getsourcelines(cachedfib)[0][0] # needs sage.combinat + sage: # needs sage.combinat + sage: cachedfib = cached_function(fibonacci) + sage: sage_getsourcelines(cachedfib)[0][0] 'def fibonacci(n, algorithm="pari") -> Integer:\n' - sage: sage_getsourcelines(type(cachedfib))[0][0] # needs sage.combinat + sage: sage_getsourcelines(type(cachedfib))[0][0] 'cdef class CachedFunction():\n' TESTS:: - sage: cython('''cpdef test_funct(x,y): return''') # needs sage.misc.cython - sage: sage_getsourcelines(test_funct) # needs sage.misc.cython + sage: # needs sage.misc.cython + sage: cython('''cpdef test_funct(x,y): return''') + sage: sage_getsourcelines(test_funct) (['cpdef test_funct(x,y): return\n'], 1) The following tests that an instance of ``functools.partial`` is correctly @@ -2440,15 +2388,6 @@ class Element(): ' Ideal_generic):\n', ' def __init__(self, ring, gens, coerce=True):\n', ...) - - AUTHORS: - - - William Stein - - Extensions by Nick Alexander - - Extension to interactive Cython code by Simon King - - Simon King: If a class has no docstring then let the class - definition be found starting from the ``__init__`` method. - - Simon King: Get source lines for dynamic classes. """ # First try the method _sage_src_lines_(), which is meant to give # the source lines of an object (not of its type!). @@ -2488,11 +2427,7 @@ class Element(): pos = _extract_embedded_position(d) if pos is None: try: - # BEWARE HERE - # inspect gives str (=bytes) in python2 - # and str (=unicode) in python3 return inspect.getsourcelines(obj) - except (OSError, TypeError) as err: try: objinit = obj.__init__ diff --git a/src/sage_docbuild/conf.py b/src/sage_docbuild/conf.py index ccab5290b9a..b1b95eb40d5 100644 --- a/src/sage_docbuild/conf.py +++ b/src/sage_docbuild/conf.py @@ -21,14 +21,12 @@ import importlib import sys import os +import dateutil.parser import sphinx import sphinx.ext.intersphinx as intersphinx -import dateutil.parser - from sphinx import highlighting from sphinx.transforms import SphinxTransform 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 @@ -49,6 +47,7 @@ 'sphinx.ext.todo', 'sphinx.ext.extlinks', 'sphinx.ext.mathjax', + 'sphinx.ext.linkcode', 'sphinx_copybutton', 'sphinx_inline_tabs', 'IPython.sphinxext.ipython_directive', @@ -196,6 +195,9 @@ def sphinx_plot(graphics, **kwds): version = sage.version.version release = sage.version.version +source_repository = 'https://github.com/sagemath/sage/' +source_branch = 'develop' + # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # language = None @@ -253,6 +255,7 @@ def sphinx_plot(graphics, **kwds): # displaying all parents. toc_object_entries_show_parents = 'hide' +# ----------------------- # Extension configuration # ----------------------- @@ -311,6 +314,38 @@ def set_intersphinx_mappings(app, config): copybutton_exclude = '.linenos, .c1' # exclude single comments (in particular, # optional!) copybutton_only_copy_prompt_lines = True + +# 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 + if info['module']: + m = importlib.import_module(info['module']) + filename = quote(info['module'].replace('.', '/')) + if m.__file__.endswith('py'): + filename += '.py' + else: + filename += '.pyx' + if 'fullname' in info: + fullname = info['fullname'] + obj = m + try: + for attr in fullname.split('.'): + obj = getattr(obj, attr) + lineno = sage_getsourcelines(obj)[-1] + except: + return None + anchor = f'#L{lineno}' + else: + anchor = '' + return f"{source_repository}blob/{version}/src/{filename}{anchor}" + return None + + +# ----------------------- # Options for HTML output # ----------------------- @@ -341,15 +376,15 @@ def set_intersphinx_mappings(app, config): # Furo can add a small edit button to each document to allow visitors to # easily propose changes to that document using the repository’s source # control system. - "source_repository": "https://github.com/sagemath/sage/", - "source_branch": "develop", + "source_repository": source_repository, + "source_branch": source_branch, } -if not version.split('.')[-1].isnumeric(): +if not version.split('.')[-1].isnumeric(): # develop version html_theme_options.update({ - "announcement": f'This is documentation for Sage development version {version}. ' - 'The documentation of the latest stable version is available ' - 'here.', + "announcement": f'This is documentation for Sage development version {version}. ' + 'The documentation for the latest stable version is available ' + 'here.' }) # The name of the Pygments (syntax highlighting) style to use. This @@ -445,7 +480,7 @@ def set_intersphinx_mappings(app, config): # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. @@ -467,27 +502,29 @@ def set_intersphinx_mappings(app, config): modindex_common_prefix = ['sage.'] # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. html_split_index = True # If true, the reST sources are included in the HTML build as _sources/. -#html_copy_source = True +# html_copy_source = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = '' +# html_file_suffix = '' # Output file base name for HTML help builder. -#htmlhelp_basename = '' +# htmlhelp_basename = '' +# ------------------------ # Options for LaTeX output # ------------------------ + # See http://sphinx-doc.org/config.html#confval-latex_elements latex_elements = {} @@ -530,13 +567,14 @@ def set_intersphinx_mappings(app, config): """ # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_use_modindex = True +# latex_use_modindex = True -##################################################### +# ------------------------- # add LaTeX macros for Sage +# ------------------------- from sage.misc.latex_macros import sage_latex_macros @@ -551,8 +589,9 @@ def set_intersphinx_mappings(app, config): # used when building html version pngmath_latex_preamble += macro + '\n' -##################################################### +# ------------------------------------------ # add custom context variables for templates +# ------------------------------------------ def add_page_context(app, pagename, templatename, context, doctree): # # The template function @@ -738,7 +777,6 @@ def nitpick_patch_config(app): '__builtin__', ] - def check_nested_class_picklability(app, what, name, obj, skip, options): """ Print a warning if pickling is broken for nested classes.