Commits

Erik Hetzner committed 6507be4

fix title metadata

  • Participants
  • Parent commits 69d4897

Comments (0)

Files changed (1)

File sphinx/builders/epub.py

                 result = self.get_refnodes(elem, result)
         return result
 
+    def get_title(self):
+        doc_md = self.env.metadata.get(self.config.master_doc)
+        if doc_md.has_key('title'):
+            return doc_md['title']
+        else:
+            return self.env.titles[self.config.master_doc].astext()
+
     def get_toc(self):
         """Get the total table of contents, containing the master_doc
         and pre and post files not managed by sphinx.
         """
         metadata = {}
         doc_md = self.env.metadata.get(self.config.master_doc)
-        title = self.env.titles[app.config.master_doc].astext()
-
-        metadata['title'] = self.esc(title, self.config.epub_title))
+        metadata['title'] = self.esc(self.get_title())
         metadata['author'] = self.esc(doc_md.get('author', self.config.epub_author))
         metadata['uid'] = self.esc(doc_md.get('uid', self.config.epub_uid))
         metadata['lang'] = self.esc(doc_md.get('lang', self.config.epub_language))
         """
         metadata = {}
         metadata['uid'] = self.config.epub_uid
-        metadata['title'] = self.config.epub_title
+        metadata['title'] = self.get_title()
         metadata['level'] = level
         metadata['navpoints'] = navpoints
         return metadata