Backport PR #30858 on branch v3.10.8-doc (DOC: reinstate "codex" search term) by meeseeksmachine · Pull Request #30861 · matplotlib/matplotlib · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 1 addition & 28 deletions doc/conf.py
32 changes: 32 additions & 0 deletions doc/sphinxext/util.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import sys

from sphinx_gallery import gen_rst


def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
**kwargs):
Expand All @@ -19,3 +21,33 @@ def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
# Clear basic_units module to re-register with unit registry on import.
def clear_basic_units(gallery_conf, fname):
return sys.modules.pop('basic_units', None)


# Monkey-patching gallery header to include search keywords
EXAMPLE_HEADER = """
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "{0}"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

.. meta::
:keywords: codex

.. note::
:class: sphx-glr-download-link-note

:ref:`Go to the end <sphx_glr_download_{1}>`
to download the full example code{2}

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_{1}:

"""


def patch_header(gallery_conf, fname):
gen_rst.EXAMPLE_HEADER = EXAMPLE_HEADER
2 changes: 1 addition & 1 deletion lib/matplotlib/tests/test_doc.py
Loading