diff options
| -rw-r--r-- | sphinx/config.py | 1 | ||||
| -rw-r--r-- | sphinx/quickstart.py | 3 | ||||
| -rw-r--r-- | sphinx/writers/manpage.py | 13 |
3 files changed, 17 insertions, 0 deletions
diff --git a/sphinx/config.py b/sphinx/config.py index 6f957314..13d0a990 100644 --- a/sphinx/config.py +++ b/sphinx/config.py @@ -159,6 +159,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 b67ee054..016460a2 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 5f93c7eb..2a2152be 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): |
