diff --git a/CHANGES b/CHANGES index ab7b25dcb..b43b7f7f2 100644 --- a/CHANGES +++ b/CHANGES @@ -54,6 +54,8 @@ Release 1.1 (in development) * #209: Added :confval:`text_newlines` and :confval:`text_sectionchars` config values. +* Added :confval:`man_show_urls` config value. + Release 1.0.6 (in development) ============================== diff --git a/doc/config.rst b/doc/config.rst index d02ce1b8e..ad711ee11 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -1110,6 +1110,12 @@ These options influence manual page output. .. versionadded:: 1.0 +.. confval:: man_show_urls + + If true, add URL addresses after links. Default is ``False``. + + .. versionadded:: 1.1 + .. _texinfo-options: diff --git a/sphinx/config.py b/sphinx/config.py index ca120ae3a..73fcf2be4 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -161,6 +161,7 @@ class Config(object): # manpage options man_pages = ([], None), + man_show_urls = (False, None), # Texinfo options texinfo_documents = ([], None), diff --git a/sphinx/quickstart.py b/sphinx/quickstart.py index a896fb568..4d7e2db3f 100644 --- a/sphinx/quickstart.py +++ b/sphinx/quickstart.py @@ -255,6 +255,9 @@ man_pages = [ [u'%(author_str)s'], 1) ] +# If true, show URL addresses after external links. +#man_show_urls = False + # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples diff --git a/sphinx/writers/manpage.py b/sphinx/writers/manpage.py index 5377ee58f..7c8c4653a 100644 --- a/sphinx/writers/manpage.py +++ b/sphinx/writers/manpage.py @@ -235,6 +235,19 @@ class ManualPageTranslator(BaseTranslator): self.body.append(self.defs['reference'][0]) self.body.append(node.astext()) self.body.append(self.defs['reference'][1]) + + uri = node.get('refuri', '') + if uri.startswith('mailto:') or uri.startswith('http:') or \ + uri.startswith('https:') or uri.startswith('ftp:'): + # if configured, put the URL after the link + if self.builder.config.man_show_urls and \ + node.astext() != uri: + if uri.startswith('mailto:'): + uri = uri[7:] + self.body.extend([ + ' <', + self.defs['strong'][0], uri, self.defs['strong'][1], + '>']) raise nodes.SkipNode def visit_centered(self, node):