Skip to content

Commit

Permalink
Omit NAME section if blank description
Browse files Browse the repository at this point in the history
Also, update man page for configuration to document that
if a blank description is entered, the "NAME" section is an
empty string.

Signed-off-by: Harumi Kuno <harumi.kuno@hpe.com>
  • Loading branch information
hkuno committed Sep 6, 2021
1 parent 26be2d1 commit d0e014b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions doc/usage/configuration.rst
Expand Up @@ -2331,6 +2331,8 @@ These options influence manual page output.

*description*
Description of the manual page. This is used in the NAME section.
Can be an empty string if you do not want to automatically generate
the NAME section.

*authors*
A list of strings with authors, or a single string. Can be an empty
Expand Down
6 changes: 3 additions & 3 deletions sphinx/writers/manpage.py
Expand Up @@ -112,10 +112,10 @@ def __init__(self, document: nodes.document, builder: Builder) -> None:
# overwritten -- added quotes around all .TH arguments
def header(self) -> str:
tmpl = (".TH \"%(title_upper)s\" \"%(manual_section)s\""
" \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n"
".SH NAME\n")
" \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n")
if self._docinfo['subtitle']:
tmpl += "%(title)s \\- %(subtitle)s\n"
tmpl += (".SH NAME\n"
"%(title)s \\- %(subtitle)s\n")
return tmpl % self._docinfo

def visit_start_of_file(self, node: Element) -> None:
Expand Down

0 comments on commit d0e014b

Please sign in to comment.