diff options
| author | Georg Brandl <georg@python.org> | 2010-10-22 10:02:10 +0200 |
|---|---|---|
| committer | Georg Brandl <georg@python.org> | 2010-10-22 10:02:10 +0200 |
| commit | 0859bada809ada0c232f532ed2d527410f3d32c8 (patch) | |
| tree | 5242a9d9994fcbac7df4e09dcf488691048fb3f0 /sphinx/application.py | |
| parent | c1fe3491aed7bc7860f3f3b654f4129bae2bc79c (diff) | |
| download | sphinx-0859bada809ada0c232f532ed2d527410f3d32c8.tar.gz | |
#534: warning message instead of crash if invalid Pygments lexer name is used.
Diffstat (limited to 'sphinx/application.py')
| -rw-r--r-- | sphinx/application.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sphinx/application.py b/sphinx/application.py index 11f887da..134f607a 100644 --- a/sphinx/application.py +++ b/sphinx/application.py @@ -213,6 +213,12 @@ class Sphinx(object): self.builder.cleanup() def warn(self, message, location=None, prefix='WARNING: '): + if isinstance(location, tuple): + docname, lineno = location + if docname: + location = '%s:%s' % (self.env.doc2path(docname), lineno or '') + else: + location = None warntext = location and '%s: %s%s\n' % (location, prefix, message) or \ '%s%s\n' % (prefix, message) if self.warningiserror: |
