diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-10-23 18:02:45 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-10-23 18:02:45 +0200 |
| commit | ce2eb8464b4387e98cd3b1081340cdebb586f2b3 (patch) | |
| tree | 416031da80cbd85804f2b1ff48ccd6f763dab3b3 /doc/_extensions/github_link.py | |
| parent | ef670016e6df436e30fef12d1915c6cec2b9d62a (diff) | |
| parent | d5cc05c9948c744f8f011250380cea20f9f859b2 (diff) | |
[MERGE] forward port branch 10.0 up to d5cc05c9948
Diffstat (limited to 'doc/_extensions/github_link.py')
| -rw-r--r-- | doc/_extensions/github_link.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/doc/_extensions/github_link.py b/doc/_extensions/github_link.py index cd0c5380621..b09177cf6e2 100644 --- a/doc/_extensions/github_link.py +++ b/doc/_extensions/github_link.py @@ -94,11 +94,12 @@ def add_doc_link(app, pagename, templatename, context, doctree): if not app.config.github_user and app.config.github_project: return - # FIXME: find other way to recover current document's source suffix - # in Sphinx 1.3 it's possible to have mutliple source suffixes and that - # may be useful in the future source_suffix = app.config.source_suffix - source_suffix = source_suffix if isinstance(source_suffix, basestring) else source_suffix[0] + # in 1.3 source_suffix can be a list + # in 1.8 source_suffix can be a mapping + # FIXME: will break if we ever add support for !rst markdown documents maybe + if not isinstance(source_suffix, basestring): + source_suffix = next(iter(source_suffix)) # can't use functools.partial because 3rd positional is line not mode context['github_link'] = lambda mode='edit': make_github_link( app, 'doc/%s%s' % (pagename, source_suffix), mode=mode) |
