Commits

Jon Waltman  committed c7e9c4e

Closes #1110: Add new config value texinfo_no_detailmenu and do not generate detailed menus for non-"Top" nodes.

  • Participants
  • Parent commits 017330e

Comments (0)

Files changed (5)

 Release 1.2 (in development)
 ============================
 
+* #1110: Added a new configuration value :confval:`texinfo_no_detailmenu` for
+  controlling whether the Texinfo writer generates a ``@detailmenu`` in the
+  "Top" node's menu.
+
+* The Texinfo writer now only generates detailed menus for the "Top" node.
+
 * New locales: #1097: Added Basque locale.
 
 * Fix text builder did not respect wide/fullwidth characters:

File doc/config.rst

 
    .. versionadded:: 1.1
 
+.. confval:: texinfo_no_detailmenu
+
+   If true, do not generate a ``@detailmenu`` in the "Top" node's menu
+   containing entries for each sub-node in the document.  Default is ``False``.
+
+   .. versionadded:: 1.2
+
 .. confval:: texinfo_elements
 
    A dictionary that contains Texinfo snippets that override those Sphinx

File sphinx/config.py

         texinfo_elements = ({}, None),
         texinfo_domain_indices = (True, None),
         texinfo_show_urls = ('footnote', None),
+        texinfo_no_detailmenu = (False, None),
 
         # linkcheck options
         linkcheck_ignore = ([], None),

File sphinx/quickstart.py

 
 # How to display URL addresses: 'footnote', 'no', or 'inline'.
 #texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+#texinfo_no_detailmenu = False
 '''
 
 EPUB_CONFIG = u'''

File sphinx/writers/texinfo.py

             return
         self.body.append('\n@menu\n')
         self.add_menu_entries(entries)
-        if not self.node_menus[entries[0]]:
+        if (node_name != 'Top' or
+            not self.node_menus[entries[0]] or
+            self.builder.config.texinfo_no_detailmenu):
             self.body.append('\n@end menu\n')
             return
 
             for subentry in entries:
                 _add_detailed_menu(subentry)
 
-        if node_name == 'Top':
-            self.body.append('\n@detailmenu\n'
-                             ' --- The Detailed Node Listing ---\n')
+        self.body.append('\n@detailmenu\n'
+                         ' --- The Detailed Node Listing ---\n')
         for entry in entries:
             _add_detailed_menu(entry)
-        if node_name == 'Top':
-            self.body.append('\n@end detailmenu')
-        self.body.append('\n@end menu\n\n')
+        self.body.append('\n@end detailmenu\n'
+                         '@end menu\n')
 
     def tex_image_length(self, width_str):
         match = re.match('(\d*\.?\d*)\s*(\S*)', width_str)