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

This commit is contained in:
Jonathan Waltman 2013-02-19 03:24:57 -06:00
parent 4e87ea0517
commit e3a27b76f2
5 changed files with 24 additions and 7 deletions

View File

@ -1,6 +1,12 @@
Release 1.2 (in development) 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. * New locales: #1097: Added Basque locale.
* Fix text builder did not respect wide/fullwidth characters: * Fix text builder did not respect wide/fullwidth characters:

View File

@ -1288,6 +1288,13 @@ These options influence Texinfo output.
.. versionadded:: 1.1 .. 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 .. confval:: texinfo_elements
A dictionary that contains Texinfo snippets that override those Sphinx A dictionary that contains Texinfo snippets that override those Sphinx

View File

@ -192,6 +192,7 @@ class Config(object):
texinfo_elements = ({}, None), texinfo_elements = ({}, None),
texinfo_domain_indices = (True, None), texinfo_domain_indices = (True, None),
texinfo_show_urls = ('footnote', None), texinfo_show_urls = ('footnote', None),
texinfo_no_detailmenu = (False, None),
# linkcheck options # linkcheck options
linkcheck_ignore = ([], None), linkcheck_ignore = ([], None),

View File

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

View File

@ -391,7 +391,9 @@ class TexinfoTranslator(nodes.NodeVisitor):
return return
self.body.append('\n@menu\n') self.body.append('\n@menu\n')
self.add_menu_entries(entries) 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') self.body.append('\n@end menu\n')
return return
@ -404,14 +406,12 @@ class TexinfoTranslator(nodes.NodeVisitor):
for subentry in entries: for subentry in entries:
_add_detailed_menu(subentry) _add_detailed_menu(subentry)
if node_name == 'Top': self.body.append('\n@detailmenu\n'
self.body.append('\n@detailmenu\n' ' --- The Detailed Node Listing ---\n')
' --- The Detailed Node Listing ---\n')
for entry in entries: for entry in entries:
_add_detailed_menu(entry) _add_detailed_menu(entry)
if node_name == 'Top': self.body.append('\n@end detailmenu\n'
self.body.append('\n@end detailmenu') '@end menu\n')
self.body.append('\n@end menu\n\n')
def tex_image_length(self, width_str): def tex_image_length(self, width_str):
match = re.match('(\d*\.?\d*)\s*(\S*)', width_str) match = re.match('(\d*\.?\d*)\s*(\S*)', width_str)