1. jacobmason
  2. sphinx

Commits

Roland Meister  committed 4ca9c13

Only add refnodes with a class of 'toctree-l%d' to the toc.ncx file

  • Participants
  • Parent commits 189ac95
  • Branches default

Comments (0)

Files changed (3)

File doc/config.rst

View file
  • Ignore whitespace
 .. confval:: epub_post_files
 
    Additional files that should be inserted after the text generated by Sphinx.
-   It is a list of tuples containing the file name and the title.  The default
-   value is ``[]``.
+   It is a list of tuples containing the file name and the title.  This option
+   can be used to add an appendix.  The default value is ``[]``.
 
 .. confval:: epub_exclude_files
 

File doc/faq.rst

View file
  • Ignore whitespace
   ``sphinx/themes/epub/static/`` directory to your local ``_static/``
   directory and remove the float settings.
 
+* Files that are inserted outside of the ``toctree`` directive must be manually
+  included. This sometimes applies to appendixes, e.g. the glossary or
+  the indices.  You can add them with the :confval:`epub_post_files` option.
+
 .. _Epubcheck: http://code.google.com/p/epubcheck/
 .. _Calibre: http://calibre-ebook.com/
 .. _FBreader: http://www.fbreader.org/

File sphinx/builders/epub.py

View file
  • Ignore whitespace
                 or refuri.startswith('irc:') or refuri.startswith('mailto:'):
                 return result
             classes = doctree.parent.attributes['classes']
-            level = 1
-            for l in range(8, 0, -1): # or range(1, 8)?
-                if (_toctree_template % l) in classes:
-                    level = l
-            result.append({
-                'level': level,
-                'refuri': self.esc(refuri),
-                'text': ssp(self.esc(doctree.astext()))
-            })
+            for level in range(8, 0, -1): # or range(1, 8)?
+                if (_toctree_template % level) in classes:
+                    result.append({
+                        'level': level,
+                        'refuri': self.esc(refuri),
+                        'text': ssp(self.esc(doctree.astext()))
+                    })
+                    break
         else:
             for elem in doctree.children:
                 result = self.get_refnodes(elem, result)