Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
dlorch committed Dec 25, 2015
1 parent 8b0c1c4 commit 498cdd5
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
37 changes: 36 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,4 +289,39 @@
#texinfo_show_urls = 'footnote'

# If true, do not generate a @detailmenu in the "Top" node's menu.
#texinfo_no_detailmenu = False
#texinfo_no_detailmenu = False

class Disqus(Directive):
required_arguments = 2
optional_arguments = 0
option_spec = {
}

final_argument_whitespace = False
has_content = False

def run(self):
disqus_shortname = self.arguments[0].strip()
disqus_id = self.arguments[1].strip()

embed_html_code = """
<div id="disqus_thread"></div>
<script type="text/javascript">
/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
var disqus_shortname = '%s'; // required: replace example with your forum shortname
var disqus_identifier = '%s';
/* * * DON'T EDIT BELOW THIS LINE * * */
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>
""" % (disqus_shortname, disqus_id)

return [ nodes.raw('', embed_html_code, format='html') ]

def setup(app):
app.add_directive("disqus", Disqus)
6 changes: 5 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,8 @@ Indices and tables

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
* :ref:`search`

.. disqus:
:disqus_shortname: pycep
:disqus_id: index

0 comments on commit 498cdd5

Please sign in to comment.