From e91caf18ff954787a49cef0365eed8eea6f955a6 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 12 Aug 2022 20:48:01 -0400 Subject: [PATCH 1/3] DOC: Fix broken links and cross-references --- doc/conf.py | 2 +- doc/devel/MEP/MEP14.rst | 4 +- doc/devel/MEP/MEP29.rst | 2 +- doc/devel/dependencies.rst | 4 +- doc/devel/style_guide.rst | 91 ++++++++++--------- doc/devel/triage.rst | 2 +- doc/users/faq/troubleshooting_faq.rst | 3 +- doc/users/prev_whats_new/changelog.rst | 3 +- .../shading_example.py | 2 +- .../web_application_server_sgskip.py | 2 +- lib/matplotlib/backends/backend_ps.py | 2 +- lib/matplotlib/patheffects.py | 1 - lib/matplotlib/tests/test_quiver.py | 2 +- 13 files changed, 61 insertions(+), 59 deletions(-) diff --git a/doc/conf.py b/doc/conf.py index b8ee4fe2265d..f961dfc379df 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -153,7 +153,7 @@ def _check_dependencies(): 'python': ('https://docs.python.org/3/', None), 'scipy': ('https://docs.scipy.org/doc/scipy/', None), 'tornado': ('https://www.tornadoweb.org/en/stable/', None), - 'xarray': ('https://xarray.pydata.org/en/stable/', None), + 'xarray': ('https://docs.xarray.dev/en/stable/', None), } diff --git a/doc/devel/MEP/MEP14.rst b/doc/devel/MEP/MEP14.rst index 2c680017b515..574c733e10bf 100644 --- a/doc/devel/MEP/MEP14.rst +++ b/doc/devel/MEP/MEP14.rst @@ -78,8 +78,8 @@ number of other projects: - `Microsoft DirectWrite`_ - `Apple Core Text`_ -.. _pango: https://www.pango.org/ -.. _harfbuzz: https://www.freedesktop.org/wiki/Software/HarfBuzz/ +.. _pango: https://pango.gnome.org +.. _harfbuzz: https://github.com/harfbuzz/harfbuzz .. _QtTextLayout: https://doc.qt.io/archives/qt-4.8/qtextlayout.html .. _Microsoft DirectWrite: https://docs.microsoft.com/en-ca/windows/win32/directwrite/introducing-directwrite .. _Apple Core Text: https://developer.apple.com/library/archive/documentation/StringsTextFonts/Conceptual/CoreText_Programming/Overview/Overview.html diff --git a/doc/devel/MEP/MEP29.rst b/doc/devel/MEP/MEP29.rst index 0a42e7d1eff7..d937889d55de 100644 --- a/doc/devel/MEP/MEP29.rst +++ b/doc/devel/MEP/MEP29.rst @@ -34,7 +34,7 @@ one has to look at the gallery where one such example is provided: This example takes a list of strings as well as a list of colors which makes it cumbersome to use. An alternative would be to use a restricted set of pango_-like markup and to interpret this markup. -.. _pango: https://developer.gnome.org/pygtk/stable/pango-markup-language.html +.. _pango: https://docs.gtk.org/Pango/pango_markup.html#pango-markup Some markup examples:: diff --git a/doc/devel/dependencies.rst b/doc/devel/dependencies.rst index 91c88f6604cd..6cf895896d59 100644 --- a/doc/devel/dependencies.rst +++ b/doc/devel/dependencies.rst @@ -85,7 +85,7 @@ Font handling and rendering * `LaTeX `_ (with `cm-super `__ and `underscore `__ ) and `GhostScript (>=9.0) - `_ : for rendering text with LaTeX. + `_ : for rendering text with LaTeX. * `fontconfig `_ (>= 2.7): for detection of system fonts on Linux. @@ -260,7 +260,7 @@ will be skipped by pytest. Inkscape to system PATH”, either for all users or current user, or the tests will not find it. -.. _Ghostscript: https://www.ghostscript.com/ +.. _Ghostscript: https://ghostscript.com/ .. _Inkscape: https://inkscape.org .. _flake8: https://pypi.org/project/flake8/ .. _nbconvert: https://pypi.org/project/nbconvert/ diff --git a/doc/devel/style_guide.rst b/doc/devel/style_guide.rst index 342875674602..9dab7a6d99d2 100644 --- a/doc/devel/style_guide.rst +++ b/doc/devel/style_guide.rst @@ -29,7 +29,7 @@ reliability and consistency in documentation. They are not interchangeable. +------------------+--------------------------+--------------+--------------+ | Term | Description | Correct | Incorrect | +==================+==========================+==============+==============+ - | Figure_ | Matplotlib working space | - *For | - "The figure| + | |Figure| | Matplotlib working space | - *For | - "The figure| | | for programming. | Matplotlib | is the | | | | objects*: | working | | | | Figure, | space for | @@ -39,11 +39,11 @@ reliability and consistency in documentation. They are not interchangeable. | | | space for | provide the| | | | the visual.| visuals." | | | | - *Referring | - "The | - | | | to class*: | Figure_ | - | | | Figure_ , | Four | + | | | to class*: | |Figure| | + | | | |Figure|, | Four | | | | "Methods | leglock is | | | | within the | a wrestling| - | | | Figure_ | move." | + | | | |Figure| | move." | | | | provide the| | | | | visuals." | | | | | - *General | | @@ -55,28 +55,29 @@ reliability and consistency in documentation. They are not interchangeable. | | | figure | | | | | skater." | | +------------------+--------------------------+--------------+--------------+ - | Axes_ | Subplots within Figure. | - *For | - "The axes | + | |Axes| | Subplots within Figure. | - *For | - "The axes | | | Contains plot elements | Matplotlib | methods | | | and is responsible for | objects*: | transform | | | plotting and configuring | Axes, "An | the data." | - | | additional details. | Axes is a | - "Each Axes_| - | | | subplot | is specific| - | | | within the | to a | - | | | Figure." | Figure." | + | | additional details. | Axes is a | - "Each | + | | | subplot | |Axes| is | + | | | within the | specific to| + | | | Figure." | a Figure." | | | | - *Referring | - "The | | | | to class*: | musicians | - | | | Axes_ , | on stage | - | | | "Each Axes_| call their | - | | | is specific| guitars | - | | | to one | Axes." | - | | | Figure." | - "The point | - | | | - *General | where the | - | | | language*: | Axes meet | - | | | axes, "Both| is the | - | | | loggers and| origin of | - | | | lumberjacks| the | - | | | use axes to| coordinate | - | | | chop wood."| system." | + | | | |Axes|, | on stage | + | | | "Each | call their | + | | | |Axes| is | guitars | + | | | specific to| Axes." | + | | | one | - "The point | + | | | Figure." | where the | + | | | - *General | Axes meet | + | | | language*: | is the | + | | | axes, "Both| origin of | + | | | loggers and| the | + | | | lumberjacks| coordinate | + | | | use axes to| system." | + | | | chop wood."| | | | | OR "There | | | | | are no | | | | | standard | | @@ -89,24 +90,25 @@ reliability and consistency in documentation. They are not interchangeable. | | | (Plural of | | | | | axis) | | +------------------+--------------------------+--------------+--------------+ - | Artist_ | Broad variety of | - *For | - "Configure | + | |Artist| | Broad variety of | - *For | - "Configure | | | Matplotlib objects that | Matplotlib | the legend | | | display visuals. | objects*: | artist with| | | | Artist, | its | | | | "Artists | respective | | | | display | method." | | | | visuals and| - "There is | - | | | are the | an Artist_ | - | | | visible | for that | - | | | elements | visual in | - | | | when the | the graph."| - | | | rendering | - "Some | - | | | a Figure." | Artists | - | | | - *Referring | became | - | | | to class*: | famous only| - | | | Artist_ , | by | - | | | "Each | accident." | - | | | Artist_ has| | + | | | are the | an | + | | | visible | |Artist| | + | | | elements | for that | + | | | when | visual in | + | | | rendering a| the graph."| + | | | Figure." | - "Some | + | | | - *Referring | Artists | + | | | to class*: | became | + | | | |Artist| , | famous only| + | | | "Each | by | + | | | |Artist| | accident." | + | | | has | | | | | respective | | | | | methods and| | | | | functions."| | @@ -119,7 +121,7 @@ reliability and consistency in documentation. They are not interchangeable. | | | is from | | | | | France." | | +------------------+--------------------------+--------------+--------------+ - | Axis_ | Human-readable single | - *For | - "Plot the | + | |Axis| | Human-readable single | - *For | - "Plot the | | | dimensional object | Matplotlib | graph onto | | | of reference marks | objects*: | the axis." | | | containing ticks, tick | Axis, "The | - "Each Axis | @@ -133,12 +135,13 @@ reliability and consistency in documentation. They are not interchangeable. | | | objects) | - "In some | | | | - *Referring | computer | | | | to class*: | graphics | - | | | Axis_ , | contexts, | - | | | "The Axis_ | the | - | | | contains | ordinate | - | | | respective | Axis_ may | - | | | XAxis and | be oriented| - | | | YAxis | downwards."| + | | | |Axis|, | contexts, | + | | | "The | the | + | | | |Axis| | ordinate | + | | | contains | |Axis| may | + | | | respective | be oriented| + | | | XAxis and | downwards."| + | | | YAxis | | | | | objects." | | | | | - *General | | | | | language*: | | @@ -162,10 +165,10 @@ reliability and consistency in documentation. They are not interchangeable. | | | | interface | +------------------+--------------------------+--------------+--------------+ -.. _Figure: :class:`~matplotlib.figure.Figure` -.. _Axes: :class:`~matplotlib.axes.Axes` -.. _Artist: :class:`~matplotlib.artist.Artist` -.. _Axis: :class:`matplotlib.axis.Axis` +.. |Figure| replace:: :class:`~matplotlib.figure.Figure` +.. |Axes| replace:: :class:`~matplotlib.axes.Axes` +.. |Artist| replace:: :class:`~matplotlib.artist.Artist` +.. |Axis| replace:: :class:`~matplotlib.axis.Axis` Grammar diff --git a/doc/devel/triage.rst b/doc/devel/triage.rst index 5f274f482f13..7b09da2488f7 100755 --- a/doc/devel/triage.rst +++ b/doc/devel/triage.rst @@ -208,7 +208,7 @@ The following workflow [1]_ is a good way to approach issue triaging: .. [1] Adapted from the pandas project `maintainers guide - `_ and + `_ and `the scikit-learn project `_ . diff --git a/doc/users/faq/troubleshooting_faq.rst b/doc/users/faq/troubleshooting_faq.rst index aedd108f5430..db1c39319933 100644 --- a/doc/users/faq/troubleshooting_faq.rst +++ b/doc/users/faq/troubleshooting_faq.rst @@ -84,7 +84,8 @@ Getting help There are a number of good resources for getting help with Matplotlib. There is a good chance your question has already been asked: -- The `mailing list archive `_. +- The `mailing list archive + `_. - `GitHub issues `_. diff --git a/doc/users/prev_whats_new/changelog.rst b/doc/users/prev_whats_new/changelog.rst index a3a22ea868ac..f1f3cca3225e 100644 --- a/doc/users/prev_whats_new/changelog.rst +++ b/doc/users/prev_whats_new/changelog.rst @@ -4,8 +4,7 @@ List of changes to Matplotlib prior to 2015 =========================================== This is a list of the changes made to Matplotlib from 2003 to 2015. For more -recent changes, please refer to the `what's new <../whats_new.html>`_ or -the `API changes <../../api/api_changes.html>`_. +recent changes, please refer to the :doc:`/users/release_notes`. 2015-11-16 Levels passed to contour(f) and tricontour(f) must be in increasing order. diff --git a/examples/images_contours_and_fields/shading_example.py b/examples/images_contours_and_fields/shading_example.py index 63858a8fb19e..c3b969dcff8b 100644 --- a/examples/images_contours_and_fields/shading_example.py +++ b/examples/images_contours_and_fields/shading_example.py @@ -7,7 +7,7 @@ `Generic Mapping Tools`_. .. _Mathematica: http://reference.wolfram.com/mathematica/ref/ReliefPlot.html -.. _Generic Mapping Tools: https://gmt.soest.hawaii.edu/ +.. _Generic Mapping Tools: https://www.generic-mapping-tools.org/ """ import numpy as np diff --git a/examples/user_interfaces/web_application_server_sgskip.py b/examples/user_interfaces/web_application_server_sgskip.py index ff16277cc752..c430c24b70ed 100644 --- a/examples/user_interfaces/web_application_server_sgskip.py +++ b/examples/user_interfaces/web_application_server_sgskip.py @@ -44,7 +44,7 @@ def hello(): ############################################################################# # # Since the above code is a Flask application, it should be run using the -# `flask command-line tool `_ +# `flask command-line tool `_ # Assuming that the working directory contains this script: # # Unix-like systems diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py index c30267fd18a9..71da1ccccc3f 100644 --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -1215,7 +1215,7 @@ def xpdf_distill(tmpfile, eps=False, ptype='letter', bbox=None, rotated=False): tmppdf = pathlib.Path(tmpdir, "tmp.pdf") tmpps = pathlib.Path(tmpdir, "tmp.ps") # Pass options as `-foo#bar` instead of `-foo=bar` to keep Windows - # happy (https://www.ghostscript.com/doc/9.22/Use.htm#MS_Windows). + # happy (https://ghostscript.com/doc/9.56.1/Use.htm#MS_Windows). cbook._check_and_log_subprocess( ["ps2pdf", "-dAutoFilterColorImages#false", diff --git a/lib/matplotlib/patheffects.py b/lib/matplotlib/patheffects.py index 416a26d3f651..191f62b8d2be 100644 --- a/lib/matplotlib/patheffects.py +++ b/lib/matplotlib/patheffects.py @@ -232,7 +232,6 @@ def __init__(self, offset=(2, -2), The shadow color. alpha : float, default: 0.3 The alpha transparency of the created shadow patch. - http://matplotlib.1069221.n5.nabble.com/path-effects-question-td27630.html rho : float, default: 0.3 A scale factor to apply to the rgbFace color if *shadow_rgbFace* is not specified. diff --git a/lib/matplotlib/tests/test_quiver.py b/lib/matplotlib/tests/test_quiver.py index 4c794ace91bc..f13450ed1b83 100644 --- a/lib/matplotlib/tests/test_quiver.py +++ b/lib/matplotlib/tests/test_quiver.py @@ -91,7 +91,7 @@ def test_no_warnings(): def test_zero_headlength(): # Based on report by Doug McNeil: - # http://matplotlib.1069221.n5.nabble.com/quiver-warnings-td28107.html + # https://discourse.matplotlib.org/t/quiver-warnings/16722 fig, ax = plt.subplots() X, Y = np.meshgrid(np.arange(10), np.arange(10)) U, V = np.cos(X), np.sin(Y) From a36e5a804a37e06c9ccb5a5f11d5fa96f22e3072 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Fri, 12 Aug 2022 20:49:20 -0400 Subject: [PATCH 2/3] DOC: Add HTML5 doctype to redirect pages Though these are not intended to be seen, this silences validators. --- doc/sphinxext/redirect_from.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/sphinxext/redirect_from.py b/doc/sphinxext/redirect_from.py index aaea3a157d06..09e3af4493de 100644 --- a/doc/sphinxext/redirect_from.py +++ b/doc/sphinxext/redirect_from.py @@ -15,6 +15,7 @@ This creates in the build directory a file ``build/html/topic/old-page.html`` that contains a relative refresh:: + @@ -39,7 +40,7 @@ logger = logging.getLogger(__name__) -HTML_TEMPLATE = """\ +HTML_TEMPLATE = """ From e5df3dec1613b2338b70b08197eff9c766f4b4f5 Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Tue, 16 Aug 2022 17:00:49 -0400 Subject: [PATCH 3/3] Fix links to rcParams sample matplotlibrc The anchor ID was changed, but as this was entered manually, it did not break the build. Instead, insert a pending cross-reference so that Sphinx will resolve it and warn if it breaks. The output changes minimally from `external` to `internal` class, and also gains `std std-ref` classes due to it being a standard reference. --- doc/sphinxext/custom_roles.py | 67 ++++++++++++++++++++++++++++------- 1 file changed, 55 insertions(+), 12 deletions(-) diff --git a/doc/sphinxext/custom_roles.py b/doc/sphinxext/custom_roles.py index 0734f2b15ac3..38d5bf9b8b71 100644 --- a/doc/sphinxext/custom_roles.py +++ b/doc/sphinxext/custom_roles.py @@ -1,21 +1,57 @@ +from urllib.parse import urlsplit, urlunsplit + from docutils import nodes -from os.path import sep + from matplotlib import rcParamsDefault -def rcparam_role(name, rawtext, text, lineno, inliner, options={}, content=[]): - rendered = nodes.Text(f'rcParams["{text}"]') +class QueryReference(nodes.Inline, nodes.TextElement): + """ + Wraps a reference or pending reference to add a query string. + + The query string is generated from the attributes added to this node. + + Also equivalent to a `~docutils.nodes.literal` node. + """ + + def to_query_string(self): + """Generate query string from node attributes.""" + return '&'.join(f'{name}={value}' for name, value in self.attlist()) + + +def visit_query_reference_node(self, node): + """ + Resolve *node* into query strings on its ``reference`` children. - source = inliner.document.attributes['source'].replace(sep, '/') - rel_source = source.split('/doc/', 1)[1] + Then act as if this is a `~docutils.nodes.literal`. + """ + query = node.to_query_string() + for refnode in node.findall(nodes.reference): + uri = urlsplit(refnode['refuri'])._replace(query=query) + refnode['refuri'] = urlunsplit(uri) - levels = rel_source.count('/') - refuri = ('../' * levels + - 'tutorials/introductory/customizing.html' + - f"?highlight={text}#a-sample-matplotlibrc-file") + self.visit_literal(node) + + +def depart_query_reference_node(self, node): + """ + Act as if this is a `~docutils.nodes.literal`. + """ + self.depart_literal(node) + + +def rcparam_role(name, rawtext, text, lineno, inliner, options={}, content=[]): + # Generate a pending cross-reference so that Sphinx will ensure this link + # isn't broken at some point in the future. + title = f'rcParam["{text}"]' + target = 'matplotlibrc-sample' + ref_nodes, messages = inliner.interpreted(title, f'{title} <{target}>', + 'ref', lineno) + + qr = QueryReference(rawtext, highlight=text) + qr += ref_nodes + node_list = [qr] - ref = nodes.reference(rawtext, rendered, refuri=refuri) - node_list = [nodes.literal('', '', ref)] # The default backend would be printed as "agg", but that's not correct (as # the default is actually determined by fallback). if text in rcParamsDefault and text != "backend": @@ -24,9 +60,16 @@ def rcparam_role(name, rawtext, text, lineno, inliner, options={}, content=[]): nodes.literal('', repr(rcParamsDefault[text])), nodes.Text(')'), ]) - return node_list, [] + + return node_list, messages def setup(app): app.add_role("rc", rcparam_role) + app.add_node( + QueryReference, + html=(visit_query_reference_node, depart_query_reference_node), + latex=(visit_query_reference_node, depart_query_reference_node), + text=(visit_query_reference_node, depart_query_reference_node), + ) return {"parallel_read_safe": True, "parallel_write_safe": True} pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy