Implement Sphinx-Gallery's `make html-noplot` by rcomer · Pull Request #23870 · 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
5 changes: 5 additions & 0 deletions doc/Makefile
21 changes: 21 additions & 0 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# All configuration values have a default value; values that are commented out
# serve to show the default value.

import logging
import os
from pathlib import Path
import shutil
Expand Down Expand Up @@ -188,6 +189,7 @@ def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
'junit': '../test-results/sphinx-gallery/junit.xml' if CIRCLECI else '',
'matplotlib_animations': True,
'min_reported_time': 1,
'plot_gallery': 'True', # sphinx-gallery/913
'reference_url': {'matplotlib': None},
'remove_config_comments': True,
'reset_modules': (
Expand All @@ -200,6 +202,25 @@ def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
'within_subsection_order': gallery_order.subsectionorder,
}

if 'plot_gallery=0' in sys.argv:
# Gallery images are not created. Suppress warnings triggered where other
# parts of the documentation link to these images.

def gallery_image_warning_filter(record):
msg = record.msg
for gallery_dir in sphinx_gallery_conf['gallery_dirs']:
if msg.startswith(f'image file not readable: {gallery_dir}'):
return False

if msg == 'Could not obtain image size. :scale: option is ignored.':
return False

return True

logger = logging.getLogger('sphinx')
logger.addFilter(gallery_image_warning_filter)


mathmpl_fontsize = 11.0
mathmpl_srcset = ['2x']

Expand Down
5 changes: 4 additions & 1 deletion doc/devel/documenting_mpl.rst