From 899b354572523351690cc1ea1a9177d59b15b296 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 22 Sep 2023 23:47:50 -0400 Subject: [PATCH] Generate plots for examples where this requires the --plot option --- doc/sphinx/conf.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/sphinx/conf.py b/doc/sphinx/conf.py index c639652b2..263755162 100644 --- a/doc/sphinx/conf.py +++ b/doc/sphinx/conf.py @@ -118,6 +118,27 @@ header_prefix = """ 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 tags_create_tags = True tags_create_badges = True