Generate plots for examples where this requires the --plot option

This commit is contained in:
Ray Speth 2023-09-22 23:47:50 -04:00 committed by Ray Speth
parent faadf015ee
commit 899b354572

View File

@ -118,6 +118,27 @@ header_prefix = """
sphinx_gallery.gen_rst.EXAMPLE_HEADER = header_prefix + sphinx_gallery.gen_rst.EXAMPLE_HEADER sphinx_gallery.gen_rst.EXAMPLE_HEADER = header_prefix + sphinx_gallery.gen_rst.EXAMPLE_HEADER
# Provide options to examples that only generate plots if an option is specified
class ResetArgv:
wants_plot = {
"adiabatic.py",
"premixed_counterflow_twin_flame.py",
"piston.py",
"reactor1.py",
"reactor2.py",
"sensitivity1.py",
}
def __repr__(self):
return 'ResetArgv'
def __call__(self, sphinx_gallery_conf, script_vars):
if Path(script_vars['src_file']).name in self.wants_plot:
return ['--plot']
else:
return []
sphinx_gallery_conf["reset_argv"] = ResetArgv()
# Options for sphinx_tags extension # Options for sphinx_tags extension
tags_create_tags = True tags_create_tags = True
tags_create_badges = True tags_create_badges = True