diff --git a/doc/usage/configuration.rst b/doc/usage/configuration.rst index 18eae9c1902..705e541a57b 100644 --- a/doc/usage/configuration.rst +++ b/doc/usage/configuration.rst @@ -402,6 +402,12 @@ General configuration .. versionadded:: 1.7 + +.. confval:: man_skip_desc_subtitle + + If true, Sphinx manpage builder will not generate a descriptive subtitle + for each man page. Default is ``False``. + .. confval:: nitpicky If true, Sphinx will warn about *all* references where the target cannot be diff --git a/sphinx/config.py b/sphinx/config.py index 553aa74d6a7..fd7ebb68c36 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -129,6 +129,7 @@ class Config: 'needs_sphinx': (None, None, [str]), 'needs_extensions': ({}, None, []), 'manpages_url': (None, 'env', []), + 'man_skip_desc_subtitle': (False, 'env', []), 'nitpicky': (False, None, []), 'nitpick_ignore': ([], None, []), 'nitpick_ignore_regex': ([], None, []), diff --git a/sphinx/writers/manpage.py b/sphinx/writers/manpage.py index 95e0f5658da..b0cf27bbf79 100644 --- a/sphinx/writers/manpage.py +++ b/sphinx/writers/manpage.py @@ -113,8 +113,9 @@ def __init__(self, document: nodes.document, builder: Builder) -> None: def header(self) -> str: tmpl = (".TH \"%(title_upper)s\" \"%(manual_section)s\"" " \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n" - ".SH NAME\n" - "%(title)s \\- %(subtitle)s\n") + ".SH NAME\n") + if (not self.config.man_skip_desc_subtitle): + tmpl += "%(title)s \\- %(subtitle)s\n" return tmpl % self._docinfo def visit_start_of_file(self, node: Element) -> None: