Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/sphinx-doc/sphinx.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2015-02-08 21:18:38 +0300
committerGeorg Brandl <georg@python.org>2015-02-08 22:13:47 +0300
commitbf3bdcc7f505a2761c0e83c9b1550e7206929f74 (patch)
tree709a5077dac1daf33e20ffeffbddaba23741681a /sphinx/builders
parent4b396d423209dc8fde3393ff3cbab3167cdf57f2 (diff)
source_suffix can now be a list.
Diffstat (limited to 'sphinx/builders')
-rw-r--r--sphinx/builders/__init__.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/sphinx/builders/__init__.py b/sphinx/builders/__init__.py
index 28b0706ca..72c27c307 100644
--- a/sphinx/builders/__init__.py
+++ b/sphinx/builders/__init__.py
@@ -19,6 +19,7 @@ except ImportError:
multiprocessing = threading = None
from docutils import nodes
+from six import string_types
from sphinx.util import i18n, path_stabilize
from sphinx.util.osutil import SEP, relative_uri, find_catalog
@@ -205,20 +206,23 @@ class Builder(object):
# relative to the source directory and without source_suffix.
dirlen = len(self.srcdir) + 1
to_write = []
- suffix = self.config.source_suffix
+ suffixes = tuple(self.config.source_suffix)
for filename in filenames:
filename = path.normpath(path.abspath(filename))
if not filename.startswith(self.srcdir):
self.warn('file %r given on command line is not under the '
'source directory, ignoring' % filename)
continue
- if not (path.isfile(filename) or path.isfile(filename + suffix)):
+ if not (path.isfile(filename) or
+ any(path.isfile(filename + suffix) for suffix in suffixes)):
self.warn('file %r given on command line does not exist, '
'ignoring' % filename)
continue
filename = filename[dirlen:]
- if filename.endswith(suffix):
- filename = filename[:-len(suffix)]
+ for suffix in suffixes:
+ if filename.endswith(suffix):
+ filename = filename[:-len(suffix)]
+ break
filename = filename.replace(path.sep, SEP)
to_write.append(filename)
self.build(to_write, method='specific',