diff --git a/src/doc/en/thematic_tutorials/structures_in_coding_theory.rst b/src/doc/en/thematic_tutorials/structures_in_coding_theory.rst index 13f1a83..4726bce 100644 --- a/src/doc/en/thematic_tutorials/structures_in_coding_theory.rst +++ b/src/doc/en/thematic_tutorials/structures_in_coding_theory.rst @@ -721,8 +721,6 @@ derive from the one that follows. .. CODE-BLOCK:: python - :class:`sage.coding.repetition_code.BinaryRepetitionCode ` - #the line above creates a link to the class in the html documentation of coding theory library from sage.coding.repetition_code import BinaryRepetitionCode ``encoders_catalog.py`` (continued): diff --git a/src/sage/categories/semigroups.py b/src/sage/categories/semigroups.py index 3f9939a..a24d8c8 100644 --- a/src/sage/categories/semigroups.py +++ b/src/sage/categories/semigroups.py @@ -543,7 +543,7 @@ class Semigroups(CategoryWithAxiom): .. SEEALSO:: - - :wikipedia:`Green's_relations` + - :wikipedia:`Green%27s_relations` - :class:`Semigroups.SubcategoryMethods.RTrivial` - :class:`Semigroups.SubcategoryMethods.JTrivial` - :class:`Semigroups.SubcategoryMethods.HTrivial` @@ -588,7 +588,7 @@ class Semigroups(CategoryWithAxiom): .. SEEALSO:: - - :wikipedia:`Green's_relations` + - :wikipedia:`Green%27s_relations` - :class:`Semigroups.SubcategoryMethods.LTrivial` - :class:`Semigroups.SubcategoryMethods.JTrivial` - :class:`Semigroups.SubcategoryMethods.HTrivial` @@ -644,7 +644,7 @@ class Semigroups(CategoryWithAxiom): .. SEEALSO:: - - :wikipedia:`Green's_relations` + - :wikipedia:`Green%27s_relations` - :class:`Semigroups.SubcategoryMethods.LTrivial` - :class:`Semigroups.SubcategoryMethods.RTrivial` - :class:`Semigroups.SubcategoryMethods.HTrivial` @@ -680,7 +680,7 @@ class Semigroups(CategoryWithAxiom): .. SEEALSO:: - - :wikipedia:`Green's_relations` + - :wikipedia:`Green%27s_relations` - :class:`Semigroups.SubcategoryMethods.RTrivial` - :class:`Semigroups.SubcategoryMethods.LTrivial` - :class:`Semigroups.SubcategoryMethods.JTrivial` diff --git a/src/sage/combinat/partition.py b/src/sage/combinat/partition.py index 9727c06..36cdd13 100644 --- a/src/sage/combinat/partition.py +++ b/src/sage/combinat/partition.py @@ -1241,7 +1241,7 @@ class Partition(CombinatorialElement): REFERENCES: - - :wikipedia:`Zolotarev's_lemma` + - :wikipedia:`Zolotarev%27s_lemma` """ return (-1)**(self.size()-self.length()) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index aa0c56b..bcefcbc 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -412,9 +412,6 @@ class Permutation(CombinatorialElement): [] sage: Permutation( [[], []] ) [] - - .. automethod:: Permutation.left_action_product - .. automethod:: Permutation.right_action_product """ @staticmethod def __classcall_private__(cls, l, check_input = True): diff --git a/src/sage/combinat/posets/posets.py b/src/sage/combinat/posets/posets.py index 2795700..00608af 100644 --- a/src/sage/combinat/posets/posets.py +++ b/src/sage/combinat/posets/posets.py @@ -4221,7 +4221,7 @@ class FinitePoset(UniqueRepresentation, Parent): Return the width of the poset (the size of its longest antichain). It is computed through a matching in a bipartite graph; see - :wikipedia:`Dilworth's_theorem` for more information. The width is + :wikipedia:`Dilworth%27s_theorem` for more information. The width is also called Dilworth number. INPUT: @@ -4273,7 +4273,7 @@ class FinitePoset(UniqueRepresentation, Parent): partitioned into `\alpha` chains, where `\alpha` is the cardinality of its largest antichain. This method returns such a partition. - See :wikipedia:`Dilworth's_theorem`. + See :wikipedia:`Dilworth%27s_theorem`. ALGORITHM: diff --git a/src/sage/combinat/root_system/plot.py b/src/sage/combinat/root_system/plot.py index 5d1cfe9..f2bc78e 100644 --- a/src/sage/combinat/root_system/plot.py +++ b/src/sage/combinat/root_system/plot.py @@ -141,7 +141,7 @@ coordinates in the root lattice:: One can also customize the projection by specifying a function. Here, we display all the roots for type `E_8` using the projection from its eight dimensional ambient space onto 3D described on -:wikipedia:`Wikipedia's E8 3D picture `:: +:wikipedia:`Wikipedia%27s E8 3D picture `:: sage: M = matrix([[0., -0.556793440452, 0.19694925177, -0.19694925177, 0.0805477263944, -0.385290876171, 0., 0.385290876171], ....: [0.180913155536, 0., 0.160212955043, 0.160212955043, 0., 0.0990170516545, 0.766360424875, 0.0990170516545], diff --git a/src/sage/docs/conf.py b/src/sage/docs/conf.py index a5c8d96..968737e 100644 --- a/src/sage/docs/conf.py +++ b/src/sage/docs/conf.py @@ -7,6 +7,7 @@ from docutils import nodes from docutils.transforms import Transform from sphinx.ext.doctest import blankline_re from sphinx import highlighting +import sphinx.ext.intersphinx as intersphinx from IPython.lib.lexers import IPythonConsoleLexer, IPyLexer # If your extensions are in another directory, add it here. @@ -172,13 +173,8 @@ todo_include_todos = True # Cross-links to other project's online documentation. python_version = sys.version_info.major -intersphinx_mapping = { - 'python': ('https://docs.python.org/', - os.path.join(SAGE_DOC_SRC, "common", - "python{}.inv".format(python_version))), - 'pplpy': (PPLPY_DOCS, None)} -def set_intersphinx_mappings(app): +def set_intersphinx_mappings(app, config): """ Add precompiled inventory (the objects.inv) """ @@ -189,7 +185,11 @@ def set_intersphinx_mappings(app): app.config.intersphinx_mapping = {} return - app.config.intersphinx_mapping = intersphinx_mapping + app.config.intersphinx_mapping = { + 'python': ('https://docs.python.org/', + os.path.join(SAGE_DOC_SRC, "common", + "python{}.inv".format(python_version))), + 'pplpy': (PPLPY_DOCS, None)} # Add master intersphinx mapping dst = os.path.join(invpath, 'objects.inv') @@ -204,6 +204,7 @@ def set_intersphinx_mappings(app): dst = os.path.join(invpath, directory, 'objects.inv') app.config.intersphinx_mapping[src] = dst + intersphinx.normalize_intersphinx_mapping(app, config) # By default document are not master. multidocs_is_master = True @@ -667,11 +668,11 @@ def call_intersphinx(app, env, node, contnode): sage: for line in open(thematic_index).readlines(): # optional - dochtml ....: if "padics" in line: ....: _ = sys.stdout.write(line) -
  • Introduction to the p-adics
  • +
  • Introduction to the p-adics

  • """ debug_inf(app, "???? Trying intersphinx for %s" % node['reftarget']) builder = app.builder - res = sphinx.ext.intersphinx.missing_reference( + res = intersphinx.missing_reference( app, env, node, contnode) if res: # Replace absolute links to $SAGE_DOC by relative links: this @@ -854,11 +855,10 @@ def setup(app): if app.srcdir.startswith(SAGE_DOC_SRC): app.add_config_value('intersphinx_mapping', {}, False) app.add_config_value('intersphinx_cache_limit', 5, False) + app.connect('config-inited', set_intersphinx_mappings) + app.connect('builder-inited', intersphinx.load_mappings) # We do *not* fully initialize intersphinx since we call it by hand # in find_sage_dangling_links. # app.connect('missing-reference', missing_reference) app.connect('missing-reference', find_sage_dangling_links) - import sphinx.ext.intersphinx - app.connect('builder-inited', set_intersphinx_mappings) - app.connect('builder-inited', sphinx.ext.intersphinx.load_mappings) app.connect('builder-inited', nitpick_patch_config) diff --git a/src/sage/functions/jacobi.py b/src/sage/functions/jacobi.py index 21fbec8..b61892d 100644 --- a/src/sage/functions/jacobi.py +++ b/src/sage/functions/jacobi.py @@ -125,7 +125,7 @@ equations: REFERENCES: -- :wikipedia:`Jacobi's_elliptic_functions` +- :wikipedia:`Jacobi%27s_elliptic_functions` - [KS2002]_ diff --git a/src/sage/geometry/riemannian_manifolds/surface3d_generators.py b/src/sage/geometry/riemannian_manifolds/surface3d_generators.py index 8bfbba1..078af43 100644 --- a/src/sage/geometry/riemannian_manifolds/surface3d_generators.py +++ b/src/sage/geometry/riemannian_manifolds/surface3d_generators.py @@ -114,7 +114,7 @@ class SurfaceGenerators(): - ``name`` -- string. Name of the surface. - For more information, see :wikipedia:`Dini's_surface`. + For more information, see :wikipedia:`Dini%27s_surface`. EXAMPLES:: diff --git a/src/sage/graphs/base/static_sparse_graph.pyx b/src/sage/graphs/base/static_sparse_graph.pyx index 79a32ea..93c534f 100644 --- a/src/sage/graphs/base/static_sparse_graph.pyx +++ b/src/sage/graphs/base/static_sparse_graph.pyx @@ -682,7 +682,7 @@ def tarjan_strongly_connected_components(G): the lowlink of `v`, that whole subtree is a new SCC. For more information, see the - :wikipedia:`Tarjan's_strongly_connected_components_algorithm`. + :wikipedia:`Tarjan%27s_strongly_connected_components_algorithm`. EXAMPLES:: diff --git a/src/sage/graphs/bipartite_graph.py b/src/sage/graphs/bipartite_graph.py index 28cf287..520c4e4 100644 --- a/src/sage/graphs/bipartite_graph.py +++ b/src/sage/graphs/bipartite_graph.py @@ -1631,7 +1631,7 @@ class BipartiteGraph(Graph): among: - ``"Konig"`` will compute a minimum vertex cover using Konig's - algorithm (:wikipedia:`Kőnig's_theorem_(graph_theory)`) + algorithm (:wikipedia:`Kőnig%27s_theorem_(graph_theory)`) - ``"Cliquer"`` will compute a minimum vertex cover using the Cliquer package diff --git a/src/sage/graphs/generators/smallgraphs.py b/src/sage/graphs/generators/smallgraphs.py index 891aea2..88e6fd9 100644 --- a/src/sage/graphs/generators/smallgraphs.py +++ b/src/sage/graphs/generators/smallgraphs.py @@ -4325,7 +4325,7 @@ def TietzeGraph(): Return the Tietze Graph. For more information on the Tietze Graph, see the - :wikipedia:`Tietze's_graph`. + :wikipedia:`Tietze%27s_graph`. EXAMPLES:: diff --git a/src/sage/graphs/path_enumeration.pyx b/src/sage/graphs/path_enumeration.pyx index 5b252b0..1cd0f17 100644 --- a/src/sage/graphs/path_enumeration.pyx +++ b/src/sage/graphs/path_enumeration.pyx @@ -617,7 +617,7 @@ def yen_k_shortest_simple_paths(self, source, target, weight_function=None, and `m` is the number of edges and `k` is the number of shortest paths needed to find. - See [Yen1970]_ and the :wikipedia:`Yen's_algorithm` for more details on the + See [Yen1970]_ and the :wikipedia:`Yen%27s_algorithm` for more details on the algorithm. EXAMPLES:: diff --git a/src/sage/graphs/spanning_tree.pyx b/src/sage/graphs/spanning_tree.pyx index 1572f35..7c8b259 100644 --- a/src/sage/graphs/spanning_tree.pyx +++ b/src/sage/graphs/spanning_tree.pyx @@ -401,7 +401,7 @@ def filter_kruskal(G, threshold=10000, weight_function=None, bint check=False): .. SEEALSO:: - :meth:`sage.graphs.generic_graph.GenericGraph.min_spanning_tree` - - :wikipedia:`Kruskal's_algorithm` + - :wikipedia:`Kruskal%27s_algorithm` - :func:`kruskal` - :func:`filter_kruskal_iterator` @@ -429,7 +429,7 @@ def filter_kruskal_iterator(G, threshold=10000, weight_function=None, bint check .. SEEALSO:: - :meth:`sage.graphs.generic_graph.GenericGraph.min_spanning_tree` - - :wikipedia:`Kruskal's_algorithm` + - :wikipedia:`Kruskal%27s_algorithm` - :func:`kruskal` - :func:`filter_kruskal` diff --git a/src/sage/groups/matrix_gps/finitely_generated.py b/src/sage/groups/matrix_gps/finitely_generated.py index d356c9c..fec4510 100644 --- a/src/sage/groups/matrix_gps/finitely_generated.py +++ b/src/sage/groups/matrix_gps/finitely_generated.py @@ -48,7 +48,7 @@ AUTHORS: - Volker Braun (2013-1) port to new Parent, libGAP. - Sebastian Oehms (2018-07): Added _permutation_group_element_ (Trac #25706) -- Sebastian Oehms (2019-01): Revision of :trac:`25706` (:trac:`26903`and :trac:`27143`). +- Sebastian Oehms (2019-01): Revision of :trac:`25706` (:trac:`26903` and :trac:`27143`). """ ############################################################################## diff --git a/src/sage/matroids/linear_matroid.pyx b/src/sage/matroids/linear_matroid.pyx index e72f774..bf354d8 100644 --- a/src/sage/matroids/linear_matroid.pyx +++ b/src/sage/matroids/linear_matroid.pyx @@ -5870,7 +5870,7 @@ cdef class RegularMatroid(LinearMatroid): ALGORITHM: Since the matroid is regular, we use Kirchhoff's Matrix-Tree Theorem. - See also :wikipedia:`Kirchhoff's_theorem`. + See also :wikipedia:`Kirchhoff%27s_theorem`. """ if self._bases_count is None: R = self._basic_representation()._matrix_() diff --git a/src/sage/misc/sagedoc.py b/src/sage/misc/sagedoc.py index 61d7a4c..025819d 100644 --- a/src/sage/misc/sagedoc.py +++ b/src/sage/misc/sagedoc.py @@ -24,7 +24,7 @@ see :trac:`12849`:: ....: for line in fobj: ....: if "#sage.symbolic.expression.Expression.numerical_approx" in line: ....: print(line) - numerical_approx(prec=None, digits=None, algorithm=None)... + numerical_approx(prec=None, digits=None, algorithm=None)... Check that sphinx is not imported at Sage start-up:: diff --git a/src/sage/modules/free_module_element.pyx b/src/sage/modules/free_module_element.pyx index c0d39da..e60ae43 100644 --- a/src/sage/modules/free_module_element.pyx +++ b/src/sage/modules/free_module_element.pyx @@ -2698,15 +2698,14 @@ cdef class FreeModuleElement(Vector): # abstract base class Return the matrix which describes a cross product between ``self`` and some other vector. - This operation is sometimes written using the `hat operator`_. + This operation is sometimes written using the hat operator: + see :wikipedia:`Hat_operator#Cross_product`. It is only defined for vectors of length 3 or 7. For a vector `v` the cross product matrix `\hat{v}` is a matrix which satisfies `\hat{v} \cdot w = v \times w` and also `w \cdot \hat{v} = w \times v` for all vectors `w`. The basis vectors are assumed to be orthonormal. - .. _hat operator: :wikipedia:`Hat_operator#Cross_product` - OUTPUT: The cross product matrix of this vector. diff --git a/src/sage/plot/plot3d/parametric_plot3d.py b/src/sage/plot/plot3d/parametric_plot3d.py index da98407..ee1a959 100644 --- a/src/sage/plot/plot3d/parametric_plot3d.py +++ b/src/sage/plot/plot3d/parametric_plot3d.py @@ -416,7 +416,7 @@ def parametric_plot3d(f, urange, vrange=None, plot_points="automatic", f_z = cos(u) / (1 + sqrt(2)) sphinx_plot(parametric_plot3d([f_x, f_y, f_z], (u,-pi,pi), (v,-pi,pi), frame=False, color="green")) - Boy's surface (:wikipedia:`Boy's_surface` and https://mathcurve.com/surfaces/boy/boy.shtml):: + Boy's surface (:wikipedia:`Boy%27s_surface` and https://mathcurve.com/surfaces/boy/boy.shtml):: sage: u, v = var('u,v') sage: K = cos(u) / (sqrt(2) - cos(2*u)*sin(3*v)) diff --git a/src/sage_setup/docbuild/__init__.py b/src/sage_setup/docbuild/__init__.py index fd15151..aee7d60 100644 --- a/src/sage_setup/docbuild/__init__.py +++ b/src/sage_setup/docbuild/__init__.py @@ -816,9 +816,13 @@ class ReferenceSubBuilder(DocBuilder): env_pickle = os.path.join(self._doctrees_dir(), 'environment.pickle') try: - env = BuildEnvironment.frompickle(env_pickle, FakeApp(self.dir)) - logger.debug("Opened Sphinx environment: %s", env_pickle) - return env + with open(env_pickle, 'rb') as f: + import pickle + env = pickle.load(f) + env.app = FakeApp(self.dir) + env.config.values = env.app.config.values + logger.debug("Opened Sphinx environment: %s", env_pickle) + return env except IOError as err: logger.debug("Failed to open Sphinx environment: %s", err) diff --git a/src/sage_setup/docbuild/ext/multidocs.py b/src/sage_setup/docbuild/ext/multidocs.py index ff7b828..37eddae 100644 --- a/src/sage_setup/docbuild/ext/multidocs.py +++ b/src/sage_setup/docbuild/ext/multidocs.py @@ -50,27 +50,29 @@ def merge_environment(app, env): docenv = get_env(app, curdoc) if docenv is not None: fixpath = lambda path: os.path.join(curdoc, path) + todos = docenv.domaindata['todo'].get('todos', dict()) + citations = docenv.domaindata['citation'].get('citations', dict()) + indexentries = docenv.domaindata['index'].get('entries', dict()) logger.info(" %s todos, %s index, %s citations"%( - len(docenv.todo_all_todos), - len(docenv.indexentries), - len(docenv.domaindata["std"]["citations"]) + sum(len(t) for t in todos.values()), + len(indexentries), + len(citations) ), nonl=1) # merge titles for t in docenv.titles: env.titles[fixpath(t)] = docenv.titles[t] # merge the todo links - for dct in docenv.todo_all_todos: - dct['docname'] = fixpath(dct['docname']) - env.todo_all_todos += docenv.todo_all_todos + for dct in todos: + env.domaindata['todo']['todos'][fixpath(dct)] = todos[dct] # merge the html index links newindex = {} - for ind in docenv.indexentries: + for ind in indexentries: if ind.startswith('sage/'): - newindex[fixpath(ind)] = docenv.indexentries[ind] + newindex[fixpath(ind)] = indexentries[ind] else: - newindex[ind] = docenv.indexentries[ind] - env.indexentries.update(newindex) + newindex[ind] = indexentries[ind] + env.domaindata['index']['entries'].update(newindex) # merge the all_docs links, needed by the js index newalldoc = {} for ind in docenv.all_docs: @@ -84,24 +86,23 @@ def merge_environment(app, env): env.metadata[ind] = md # merge the citations newcite = {} - citations = docenv.domaindata["std"]["citations"] - for ind, (path, tag, lineno) in docenv.domaindata["std"]["citations"].items(): + for ind, (path, tag, lineno) in citations.items(): # TODO: Warn on conflicts newcite[ind] = (fixpath(path), tag, lineno) - env.domaindata["std"]["citations"].update(newcite) + env.domaindata['citation']['citations'].update(newcite) # merge the py:module indexes newmodules = {} - for ind,(modpath,v1,v2,v3) in ( + for ind,(modpath,v1,v2,v3,v4) in ( docenv.domaindata['py']['modules'].items()): - newmodules[ind] = (fixpath(modpath),v1,v2,v3) + newmodules[ind] = (fixpath(modpath),v1,v2,v3,v4) env.domaindata['py']['modules'].update(newmodules) logger.info(", %s modules"%(len(newmodules))) logger.info('... done (%s todos, %s index, %s citations, %s modules)'%( - len(env.todo_all_todos), - len(env.indexentries), - len(env.domaindata["std"]["citations"]), + sum(len(t) for t in env.domaindata['todo']['todos'].values()), + len(env.domaindata['index']['entries']), + len(env.domaindata['citation']['citations']), len(env.domaindata['py']['modules']))) - write_citations(app, env.domaindata["std"]["citations"]) + write_citations(app, env.domaindata['citation']['citations']) def get_env(app, curdoc): @@ -251,7 +252,7 @@ def fetch_citation(app, env): with open(filename, 'rb') as f: cache = pickle.load(f) logger.info("done (%s citations)."%len(cache)) - cite = env.domaindata["std"]["citations"] + cite = env.domaindata['citation'].get('citations', dict()) for ind, (path, tag, lineno) in cache.items(): if ind not in cite: # don't override local citation cite[ind] = (os.path.join("..", path), tag, lineno) diff --git a/src/sage_setup/docbuild/ext/sage_autodoc.py b/src/sage_setup/docbuild/ext/sage_autodoc.py index 727ce30..032365d 100644 --- a/src/sage_setup/docbuild/ext/sage_autodoc.py +++ b/src/sage_setup/docbuild/ext/sage_autodoc.py @@ -35,14 +35,15 @@ import sys from docutils.statemachine import ViewList import sphinx -from sphinx.ext.autodoc.importer import mock, import_object, get_object_members +from sphinx.ext.autodoc import mock +from sphinx.ext.autodoc.importer import import_object, get_object_members, get_module_members from sphinx.locale import _, __ from sphinx.pycode import ModuleAnalyzer from sphinx.errors import PycodeError from sphinx.util import logging from sphinx.util import rpartition, force_decode from sphinx.util.docstrings import prepare_docstring -from sphinx.util.inspect import isdescriptor, safe_getmembers, \ +from sphinx.util.inspect import isdescriptor, \ safe_getattr, object_description, is_builtin_class_method, \ isenumattribute, isclassmethod, isstaticmethod, getdoc @@ -536,7 +537,7 @@ class Documenter(object): # add content from docstrings if not no_docstring: - encoding = self.analyzer and self.analyzer.encoding + encoding = self.analyzer and self.analyzer._encoding docstrings = self.get_doc(encoding) if not docstrings: # append at least a dummy docstring, so that the event @@ -882,7 +883,7 @@ class ModuleDocumenter(Documenter): if not hasattr(self.object, '__all__'): # for implicit module members, check __module__ to avoid # documenting imported objects - return True, safe_getmembers(self.object) + return True, get_module_members(self.object) else: memberlist = self.object.__all__ # Sometimes __all__ is broken... @@ -893,7 +894,7 @@ class ModuleDocumenter(Documenter): '(in module %s) -- ignoring __all__' % (memberlist, self.fullname)) # fall back to all members - return True, safe_getmembers(self.object) + return True, get_module_members(self.object) else: memberlist = self.options.members or [] ret = []