'Add a title node to the document (just copy the first section title),
and store that title in the environment.'

def create_title_from(self, docname, document):

    titlenode = nodes.title()
    longtitlenode = titlenode
    if document.has_key('title'):
        longtitlenode = nodes.title()
        longtitlenode += nodes.Text(document['title'])
    for node in document.traverse(nodes.section):
        visitor = SphinxContentsFilter(document)
        node[0].walkabout(visitor)
        titlenode += visitor.get_entry_text()
        break
    else:
        titlenode += nodes.Text('<no    title>')
    self.titles[docname] = titlenode
    self.longtitles[docname] = longtitlenode
