Skip to content

Commit

Permalink
Add sphinx_tabs_nowarn option
Browse files Browse the repository at this point in the history
  • Loading branch information
djungelorm committed Sep 29, 2017
1 parent 4826fc5 commit 501612e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
@@ -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

Expand Down
10 changes: 7 additions & 3 deletions sphinx_tabs/tabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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)
Expand Down

0 comments on commit 501612e

Please sign in to comment.