summaryrefslogtreecommitdiff
path: root/sphinx/builders/manpage.py
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-24 16:34:47 +0900
committerTakeshi KOMIYA <i.tkomiya@gmail.com>2021-01-24 16:34:47 +0900
commit51d500833e391c182f536e83a5d62d5e90ce8ca9 (patch)
treefb854309b759773feb83e7e4bbc91e3ed3cb2b00 /sphinx/builders/manpage.py
parent375fb52fe402d46d633e321ce8f20c1aa61c49b9 (diff)
parent41ee2d6e6595d0eefb4a2b752fd79a3451382d5a (diff)
downloadsphinx-git-51d500833e391c182f536e83a5d62d5e90ce8ca9.tar.gz
Merge branch '3.x' into 7774_remove_develop.rst
Diffstat (limited to 'sphinx/builders/manpage.py')
-rw-r--r--sphinx/builders/manpage.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/sphinx/builders/manpage.py b/sphinx/builders/manpage.py
index 4166dece9..292f495de 100644
--- a/sphinx/builders/manpage.py
+++ b/sphinx/builders/manpage.py
@@ -4,7 +4,7 @@
Manual pages builder.
- :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
+ :copyright: Copyright 2007-2021 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
@@ -20,13 +20,11 @@ from sphinx.builders import Builder
from sphinx.config import Config
from sphinx.errors import NoUri
from sphinx.locale import __
-from sphinx.util import logging
-from sphinx.util import progress_message
+from sphinx.util import logging, progress_message
from sphinx.util.console import darkgreen # type: ignore
from sphinx.util.nodes import inline_all_toctrees
-from sphinx.util.osutil import make_filename_from_project
-from sphinx.writers.manpage import ManualPageWriter, ManualPageTranslator
-
+from sphinx.util.osutil import ensuredir, make_filename_from_project
+from sphinx.writers.manpage import ManualPageTranslator, ManualPageWriter
logger = logging.getLogger(__name__)
@@ -80,7 +78,12 @@ class ManualPageBuilder(Builder):
docsettings.authors = authors
docsettings.section = section
- targetname = '%s.%s' % (name, section)
+ if self.config.man_make_section_directory:
+ ensuredir(path.join(self.outdir, str(section)))
+ targetname = '%s/%s.%s' % (section, name, section)
+ else:
+ targetname = '%s.%s' % (name, section)
+
logger.info(darkgreen(targetname) + ' { ', nonl=True)
destination = FileOutput(
destination_path=path.join(self.outdir, targetname),
@@ -115,6 +118,7 @@ def setup(app: Sphinx) -> Dict[str, Any]:
app.add_config_value('man_pages', default_man_pages, None)
app.add_config_value('man_show_urls', False, None)
+ app.add_config_value('man_make_section_directory', False, None)
return {
'version': 'builtin',