mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #9594 from hkuno/pr/no_empty_desc_4.x
let user skip printing command description
This commit is contained in:
commit
260f217a3d
1
CHANGES
1
CHANGES
@ -19,6 +19,7 @@ Features added
|
|||||||
3.10 or above
|
3.10 or above
|
||||||
* #9447: html theme: Expose the version of Sphinx in the form of tuple as a
|
* #9447: html theme: Expose the version of Sphinx in the form of tuple as a
|
||||||
template variable ``sphinx_version_tuple``
|
template variable ``sphinx_version_tuple``
|
||||||
|
* #9594: manpage: Suppress the title of man page if description is empty
|
||||||
* #9445: py domain: ``:py:property:`` directive supports ``:classmethod:``
|
* #9445: py domain: ``:py:property:`` directive supports ``:classmethod:``
|
||||||
option to describe the class property
|
option to describe the class property
|
||||||
* #9524: test: SphinxTestApp can take ``builddir`` as an argument
|
* #9524: test: SphinxTestApp can take ``builddir`` as an argument
|
||||||
|
@ -2331,6 +2331,8 @@ These options influence manual page output.
|
|||||||
|
|
||||||
*description*
|
*description*
|
||||||
Description of the manual page. This is used in the NAME section.
|
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*
|
*authors*
|
||||||
A list of strings with authors, or a single string. Can be an empty
|
A list of strings with authors, or a single string. Can be an empty
|
||||||
|
@ -112,9 +112,10 @@ class ManualPageTranslator(SphinxTranslator, BaseTranslator):
|
|||||||
# overwritten -- added quotes around all .TH arguments
|
# overwritten -- added quotes around all .TH arguments
|
||||||
def header(self) -> str:
|
def header(self) -> str:
|
||||||
tmpl = (".TH \"%(title_upper)s\" \"%(manual_section)s\""
|
tmpl = (".TH \"%(title_upper)s\" \"%(manual_section)s\""
|
||||||
" \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n"
|
" \"%(date)s\" \"%(version)s\" \"%(manual_group)s\"\n")
|
||||||
".SH NAME\n"
|
if self._docinfo['subtitle']:
|
||||||
"%(title)s \\- %(subtitle)s\n")
|
tmpl += (".SH NAME\n"
|
||||||
|
"%(title)s \\- %(subtitle)s\n")
|
||||||
return tmpl % self._docinfo
|
return tmpl % self._docinfo
|
||||||
|
|
||||||
def visit_start_of_file(self, node: Element) -> None:
|
def visit_start_of_file(self, node: Element) -> None:
|
||||||
|
@ -23,6 +23,9 @@ def test_all(app, status, warning):
|
|||||||
assert r'\fBprint \fP\fIi\fP\fB\en\fP' in content
|
assert r'\fBprint \fP\fIi\fP\fB\en\fP' in content
|
||||||
assert r'\fBmanpage\en\fP' in content
|
assert r'\fBmanpage\en\fP' in content
|
||||||
|
|
||||||
|
# heading (title + description)
|
||||||
|
assert r'sphinxtests \- Sphinx <Tests> 0.6alpha1' in content
|
||||||
|
|
||||||
# term of definition list including nodes.strong
|
# term of definition list including nodes.strong
|
||||||
assert '\n.B term1\n' in content
|
assert '\n.B term1\n' in content
|
||||||
assert '\nterm2 (\\fBstronged partially\\fP)\n' in content
|
assert '\nterm2 (\\fBstronged partially\\fP)\n' in content
|
||||||
@ -35,6 +38,15 @@ def test_all(app, status, warning):
|
|||||||
assert 'Footnotes' not in content
|
assert 'Footnotes' not in content
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.sphinx('man', testroot='basic',
|
||||||
|
confoverrides={'man_pages': [('index', 'title', None, [], 1)]})
|
||||||
|
def test_man_pages_empty_description(app, status, warning):
|
||||||
|
app.builder.build_all()
|
||||||
|
|
||||||
|
content = (app.outdir / 'title.1').read_text()
|
||||||
|
assert r'title \-' not in content
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.sphinx('man', testroot='basic',
|
@pytest.mark.sphinx('man', testroot='basic',
|
||||||
confoverrides={'man_make_section_directory': True})
|
confoverrides={'man_make_section_directory': True})
|
||||||
def test_man_make_section_directory(app, status, warning):
|
def test_man_make_section_directory(app, status, warning):
|
||||||
|
Loading…
Reference in New Issue
Block a user