From 175c6e66a6d3c23c3efecb27d22c44d9525db545 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Sun, 8 Jan 2017 14:35:44 +0900 Subject: [PATCH 1/2] Fix #978: `intersphinx_mapping` also allows a list as a parameter --- CHANGES | 1 + sphinx/ext/intersphinx.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index beab1c718..baf8a9bbc 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,7 @@ Features added * #3241: emit latex warning if buggy titlesec (ref #3210) * #3194: Refer the $MAKE environment variable to determine ``make`` command * Emit warning for nested numbered toctrees (refs: #3142) +* #978: `intersphinx_mapping` also allows a list as a parameter Bugs fixed ---------- diff --git a/sphinx/ext/intersphinx.py b/sphinx/ext/intersphinx.py index f0592e4c8..7513323ef 100644 --- a/sphinx/ext/intersphinx.py +++ b/sphinx/ext/intersphinx.py @@ -242,7 +242,7 @@ def load_mappings(app): cache = env.intersphinx_cache update = False for key, value in iteritems(app.config.intersphinx_mapping): - if isinstance(value, tuple): + if isinstance(value, (list, tuple)): # new format name, (uri, inv) = key, value if not isinstance(name, string_types): From 43eeb96e2f258583b7c3017f9affd5b8e2072e18 Mon Sep 17 00:00:00 2001 From: Takeshi KOMIYA Date: Mon, 9 Jan 2017 02:21:31 +0900 Subject: [PATCH 2/2] Fix copy_asset_file() rewrote destination-filename --- sphinx/util/fileutil.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sphinx/util/fileutil.py b/sphinx/util/fileutil.py index 4375b7e61..b258c2039 100644 --- a/sphinx/util/fileutil.py +++ b/sphinx/util/fileutil.py @@ -41,7 +41,9 @@ def copy_asset_file(source, destination, context=None, renderer=None): renderer = SphinxRenderer() with codecs.open(source, 'r', encoding='utf-8') as fsrc: - with codecs.open(destination[:-2], 'w', encoding='utf-8') as fdst: + if destination.lower().endswith('_t'): + destination = destination[:-2] + with codecs.open(destination, 'w', encoding='utf-8') as fdst: fdst.write(renderer.render_string(fsrc.read(), context)) else: copyfile(source, destination)