Created
August 22, 2008 01:38
-
-
Save btbytes/6707 to your computer and use it in GitHub Desktop.
MoinMoin macro to insert Disqus.com powered comment thread into the wiki page
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: iso-8859-1 -*- | |
""" | |
DisqusThread - macro to insert Disqus.com powered comment thread into the wiki page | |
@copyright: 2008 Pradeep Kishore Gowda <[email protected]> | |
@license: GNU GPL, see COPYING for details. | |
2008-08-22 Pradeep Kishore Gowda | |
* Initial release v1.0.0 | |
""" | |
from MoinMoin.wikiutil import get_unicode, get_bool, get_int, get_float, escape | |
embed_code = '''<div id="disqus_thread"></div><script type="text/javascript" sr\ | |
c="http://disqus.com/forums/%(username)s/embed.js"></script><noscript><a href="\ | |
http://%(username)s.disqus.com/?url=ref">View the discussion thread.</a></noscr\ | |
ipt><a href="http://disqus.com" class="dsq-brlink">blog comments powered by <sp\ | |
an class="logo-disqus">Disqus</span></a>''' | |
def macro_DisqusThread(macro, username='testuser'): | |
username = get_unicode(macro.request, username) | |
username = strip_tags(username) | |
try: | |
return macro.formatter.rawHTML(embed_code % ({'username': username})) | |
except: | |
return macro.formatter.escapedText('Error inserting Disqus code') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment