diff options
author | jacob <jacob@panda> | 2010-05-31 16:07:47 -0500 |
---|---|---|
committer | jacob <jacob@panda> | 2010-05-31 16:07:47 -0500 |
commit | 777386ef566a88246f6c4cadeba88fc79cc71d56 (patch) | |
tree | f8aea7bb749a96e0f7615e7aec6a4bbb6f47b9b8 /sphinx/writers/websupport.py | |
parent | 0e26a6d46c1a61378b57d042968500032ba41a48 (diff) | |
download | sphinx-git-777386ef566a88246f6c4cadeba88fc79cc71d56.tar.gz |
Switched to creating a list of html slices
Diffstat (limited to 'sphinx/writers/websupport.py')
-rw-r--r-- | sphinx/writers/websupport.py | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/sphinx/writers/websupport.py b/sphinx/writers/websupport.py index 3b2507558..e712b1339 100644 --- a/sphinx/writers/websupport.py +++ b/sphinx/writers/websupport.py @@ -18,12 +18,27 @@ class WebSupportTranslator(HTMLTranslator): """ def __init__(self, builder, *args, **kwargs): HTMLTranslator.__init__(self, builder, *args, **kwargs) + self.init_support() + + def init_support(self): self.support_document = Document() self.current_id = 0 + + def handle_visit_commentable(self, node): + self.support_document.add_slice(''.join(self.body)) + self.body = [] + + def handle_depart_commentable(self, node): + slice_id = '%s-%s' % (self.builder.docname, self.current_id) + self.support_document.add_slice(''.join(self.body), + slice_id, commentable=True) + self.body = [] + self.current_id += 1 + + def visit_paragraph(self, node): + HTMLTranslator.visit_paragraph(self, node) + self.handle_visit_commentable(node) def depart_paragraph(self, node): HTMLTranslator.depart_paragraph(self, node) - self.support_document.add_commentable(self.current_id) - self.body.append("{{ render_comment('%s-p%s') }}" % - (self.builder.docname, self.current_id)) - self.current_id += 1 + self.handle_depart_commentable(node) |