diff options
author | jacob <jacob@panda> | 2010-05-30 21:33:04 -0500 |
---|---|---|
committer | jacob <jacob@panda> | 2010-05-30 21:33:04 -0500 |
commit | 099a58e0b7b37b0737c83253fda5b1ff344bdec2 (patch) | |
tree | 739d9645894d5adee068743f64f2098bfe0db078 /sphinx/websupport/document.py | |
parent | 460874e11951815c3c96baf4ceaf79cfee5889cb (diff) | |
download | sphinx-git-099a58e0b7b37b0737c83253fda5b1ff344bdec2.tar.gz |
"Initial commit": Added sphinx.websupport module, as well as a builder and writer for the web support package.
Diffstat (limited to 'sphinx/websupport/document.py')
-rw-r--r-- | sphinx/websupport/document.py | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/sphinx/websupport/document.py b/sphinx/websupport/document.py new file mode 100644 index 000000000..d1f5677bb --- /dev/null +++ b/sphinx/websupport/document.py @@ -0,0 +1,37 @@ +# -*- coding: utf-8 -*- +""" + sphinx.websupport.document + ~~~~~~~~~~~~~~~~~~~~ + + Contains a Document class for working with Sphinx documents. + + :copyright: Copyright 2007-2010 by the Sphinx team, see AUTHORS. + :license: BSD, see LICENSE for details. +""" + +from os import path + +from jinja2 import Template +from docutils import nodes +from sphinx import addnodes + +class Document(object): + """A single Document such as 'index'.""" + def __init__(self): + self.commentable_nodes = [] + self.template = None + + def add_commentable(self, node_id, rst_source=''): + node = CommentableNode(node_id, rst_source) + + def render_comment(self, id): + return self.comment_template.render(id=id) + + def render_html(self, comments=False): + template = Template(self.body) + return template.render(render_comment=self.render_comment) + +class CommentableNode(object): + def __init__(self, id, rst_source=''): + self.id = id + self.rst_source='' |