summaryrefslogtreecommitdiff
path: root/sphinx/writers/websupport.py
diff options
context:
space:
mode:
authorjacob <jacob@panda>2010-06-15 22:15:10 -0500
committerjacob <jacob@panda>2010-06-15 22:15:10 -0500
commitcd227483ea2f162ea0e62e42563400a7bab808c3 (patch)
treef75ec0263de8164d46159a3ce003111f60ee2303 /sphinx/writers/websupport.py
parented7c1ad43dd15c112c919e96a8474d9660ee90ae (diff)
downloadsphinx-git-cd227483ea2f162ea0e62e42563400a7bab808c3.tar.gz
Don't add attributes to node.
Diffstat (limited to 'sphinx/writers/websupport.py')
-rw-r--r--sphinx/writers/websupport.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/sphinx/writers/websupport.py b/sphinx/writers/websupport.py
index d99d7dc91..4afc3ecbd 100644
--- a/sphinx/writers/websupport.py
+++ b/sphinx/writers/websupport.py
@@ -19,6 +19,7 @@ class WebSupportTranslator(HTMLTranslator):
def __init__(self, builder, *args, **kwargs):
HTMLTranslator.__init__(self, builder, *args, **kwargs)
+ self.comment_class = 'spxcmt'
self.init_support()
def init_support(self):
@@ -38,23 +39,21 @@ class WebSupportTranslator(HTMLTranslator):
def handle_visit_commentable(self, node):
# If this node is nested inside another commentable node this
# node will not be commented.
- if self.in_commentable:
- node.commented = False
- else:
- node.commented = self.in_commentable = True
- node.id = self.create_id(node)
+ if not self.in_commentable:
+ self.in_commentable = True
+ id = self.create_id(node)
# We will place the node in the HTML id attribute. If the node
# already has another id (for indexing purposes) put an empty
# span with the existing id directly before this node's HTML.
if node.attributes['ids']:
self.body.append('<span id="%s"></span>'
% node.attributes['ids'][0])
- node.attributes['ids'] = [node.id]
- node.attributes['classes'].append('spxcmt')
+ node.attributes['ids'] = [id]
+ node.attributes['classes'].append(self.comment_class)
def handle_depart_commentable(self, node):
assert(self.in_commentable)
- if node.commented:
+ if self.comment_class in node.attributes['classes']:
self.in_commentable = False
def create_id(self, node):