Commits

jacobmason committed 1d6aab0

update get_document to add comment options to js

  • Participants
  • Parent commits 520545e

Comments (0)

Files changed (1)

sphinx/websupport/__init__.py

                 'The document "%s" could not be found' % docname)
 
         document = pickle.load(f)
-        document['COMMENT_OPTIONS'] = self._make_comment_options(username,
-                                                                 moderator)
+        comment_opts = self._make_comment_options(username, moderator)
+        document['js'] = comment_opts + '\n' + document['js']
         return document
 
     def _make_comment_options(self, username, moderator):
-        parts = ['var COMMENT_OPTIONS = {']
+        parts = ['<script type="text/javascript">', 
+                 'var COMMENT_OPTIONS = {']
         if self.docroot is not '':
             parts.append('addCommentURL: "/%s/%s",' % (self.docroot, 
                                                        'add_comment'))
             parts.append('username: "%s",' % username)
         parts.append('moderator: %s' % str(moderator).lower())
         parts.append('};')
+        parts.append('</script>')
         return '\n'.join(parts)            
 
     def get_search_results(self, q):