summaryrefslogtreecommitdiff
path: root/sphinx/writers/websupport.py
diff options
context:
space:
mode:
authorJacob Mason <jacoblmason@gmail.com>2010-08-14 18:33:07 -0500
committerJacob Mason <jacoblmason@gmail.com>2010-08-14 18:33:07 -0500
commit34379fedb7a579ebfc1a1888bef60e882e3885ba (patch)
tree8a08acc16ea8e75f11194e1e793b19541ff3d73d /sphinx/writers/websupport.py
parenta52fd809bf0eecefc1b5aba3c05d6d56a1f66538 (diff)
downloadsphinx-git-34379fedb7a579ebfc1a1888bef60e882e3885ba.tar.gz
only add node if it doesn't already exist
Diffstat (limited to 'sphinx/writers/websupport.py')
-rw-r--r--sphinx/writers/websupport.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/sphinx/writers/websupport.py b/sphinx/writers/websupport.py
index 6beb4b987..30e8c4dc8 100644
--- a/sphinx/writers/websupport.py
+++ b/sphinx/writers/websupport.py
@@ -27,19 +27,19 @@ class WebSupportTranslator(HTMLTranslator):
HTMLTranslator.dispatch_visit(self, node)
def handle_visit_commentable(self, node):
- db_node = self.add_db_node(node)
# We will place the node in the HTML id attribute. If the node
# already has an id (for indexing purposes) put an empty
# span with the existing id directly before this node's HTML.
+ self.add_db_node(node)
if node.attributes['ids']:
self.body.append('<span id="%s"></span>'
% node.attributes['ids'][0])
- node.attributes['ids'] = ['s%s' % db_node.id]
+ node.attributes['ids'] = ['s%s' % node.uid]
node.attributes['classes'].append(self.comment_class)
def add_db_node(self, node):
storage = self.builder.app.storage
- db_node_id = storage.add_node(id=node.uid,
- document=self.builder.cur_docname,
- source=node.rawsource or node.astext())
- return db_node_id
+ if not storage.has_node(node.uid):
+ storage.add_node(id=node.uid,
+ document=self.builder.cur_docname,
+ source=node.rawsource or node.astext())