There was an error while loading. Please reload this page.
1 parent 55b3991 commit 1374e34Copy full SHA for 1374e34
1 file changed
doc/conf.py
@@ -11,6 +11,7 @@
11
# All configuration values have a default value; values that are commented out
12
# serve to show the default value.
13
14
+import logging
15
import os
16
from pathlib import Path
17
import shutil
@@ -201,6 +202,25 @@ def matplotlib_reduced_latex_scraper(block, block_vars, gallery_conf,
201
202
'within_subsection_order': gallery_order.subsectionorder,
203
}
204
205
+if 'plot_gallery=0' in sys.argv:
206
+ # Gallery images are not created. Suppress warnings triggered where other
207
+ # parts of the documentation link to these images.
208
+
209
+ def gallery_image_warning_filter(record):
210
+ msg = record.msg
211
+ for gallery_dir in sphinx_gallery_conf['gallery_dirs']:
212
+ if msg.startswith(f'image file not readable: {gallery_dir}'):
213
+ return False
214
215
+ if msg == 'Could not obtain image size. :scale: option is ignored.':
216
217
218
+ return True
219
220
+ logger = logging.getLogger('sphinx')
221
+ logger.addFilter(gallery_image_warning_filter)
222
223
224
mathmpl_fontsize = 11.0
225
mathmpl_srcset = ['2x']
226
0 commit comments