diff options
Diffstat (limited to 'sphinx/writers/websupport.py')
-rw-r--r-- | sphinx/writers/websupport.py | 15 |
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): |