Skip to content

Commit

Permalink
Converted single-method class to function.
Browse files Browse the repository at this point in the history
Doesn't need to be a class.

Fixes #2
  • Loading branch information
Robpol86 committed Aug 3, 2016
1 parent 857be87 commit e148452
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ Added

Fixed
* easy_install: https://bitbucket.org/birkenfeld/sphinx-contrib/issues/155/
* https://github.com/Robpol86/sphinxcontrib-disqus/issues/2

1.0.0 - 2015-07-31
------------------
Expand Down
23 changes: 10 additions & 13 deletions sphinxcontrib/disqus.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,17 @@ def run(self):
return [DisqusNode(disqus_shortname, disqus_identifier)]


class EventHandlers(object):
"""Hold Sphinx event handlers as static methods."""
def event_builder_inited(app):
"""Update the Sphinx builder.
@staticmethod
def insert_javascript(app):
"""Insert Disqus read-only javascript into the document body during the builder-inited event.
http://sphinx-doc.org/extdev/appapi.html#event-builder-inited
From: https://github.com/sphinx-doc/sphinx/blob/master/sphinx/ext/mathjax.py
http://sphinx-doc.org/extdev/appapi.html#event-builder-inited
From: https://github.com/sphinx-doc/sphinx/blob/master/sphinx/ext/mathjax.py
:param app: Sphinx application object.
"""
app.config.html_static_path.append(os.path.relpath(STATIC_DIR, app.confdir))
app.add_javascript('disqus.js')
:param app: Sphinx application object.
"""
# Insert Disqus read-only javascript into the document body during the builder-inited event.
app.config.html_static_path.append(os.path.relpath(STATIC_DIR, app.confdir))
app.add_javascript('disqus.js')


def setup(app):
Expand All @@ -127,5 +124,5 @@ def setup(app):
app.add_config_value('disqus_shortname', None, True)
app.add_node(DisqusNode, html=(DisqusNode.visit, DisqusNode.depart))
app.add_directive('disqus', DisqusDirective)
app.connect('builder-inited', EventHandlers.insert_javascript)
app.connect('builder-inited', event_builder_inited)
return dict(version=__version__)

0 comments on commit e148452

Please sign in to comment.