From 501612ee116d813754f3f8b6ea72c728e3d2b1e7 Mon Sep 17 00:00:00 2001 From: djungelorm Date: Fri, 29 Sep 2017 17:40:26 +0100 Subject: [PATCH] Add sphinx_tabs_nowarn option --- CHANGES.txt | 3 +++ sphinx_tabs/tabs.py | 10 +++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGES.txt b/CHANGES.txt index f45e05a..7691675 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1,3 +1,6 @@ +v1.1.5 + * Add sphinx_tabs_nowarn option to disable warning about incompatible builder. Useful when running sphinx-build with the -W flag + v1.1.4 * Fix broken javascript file inclusion diff --git a/sphinx_tabs/tabs.py b/sphinx_tabs/tabs.py index 013b3dc..87e0bb5 100644 --- a/sphinx_tabs/tabs.py +++ b/sphinx_tabs/tabs.py @@ -255,11 +255,14 @@ def copy_assets(app, exception): builders = ('html', 'readthedocs', 'readthedocssinglehtmllocalmedia', 'singlehtml', 'dirhtml') if app.builder.name not in builders: - app.warn('Not copying tabs assets! Not compatible with %s builder' % - app.builder.name) + if not app.config['sphinx_tabs_nowarn']: + app.warn( + 'Not copying tabs assets! Not compatible with %s builder' % + app.builder.name) return if exception: - app.warn('Not copying tabs assets! Error occurred previously') + if not app.config['sphinx_tabs_nowarn']: + app.warn('Not copying tabs assets! Error occurred previously') return app.info('Copying tabs assets... ', nonl=True) @@ -279,6 +282,7 @@ def copy_assets(app, exception): def setup(app): """ Set up the plugin """ + app.add_config_value('sphinx_tabs_nowarn', False, '') app.add_directive('tabs', TabsDirective) app.add_directive('tab', TabDirective) app.add_directive('group-tab', GroupTabDirective)