diff options
Diffstat (limited to 'sphinx/environment.py')
-rw-r--r-- | sphinx/environment.py | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/sphinx/environment.py b/sphinx/environment.py index ca9a213e4..ce6b23293 100644 --- a/sphinx/environment.py +++ b/sphinx/environment.py @@ -618,8 +618,16 @@ class BuildEnvironment: pub.process_programmatic_settings(None, self.settings, None) pub.set_source(None, src_path.encode(fs_encoding)) pub.set_destination(None, None) +<<<<<<< local pub.publish() doctree = pub.document +======= + try: + pub.publish() + doctree = pub.document + except UnicodeError as err: + raise SphinxError(str(err)) +>>>>>>> other # post-processing self.filter_messages(doctree) @@ -808,7 +816,7 @@ class BuildEnvironment: imgtype = imghdr.what(f) finally: f.close() - except (OSError, IOError), err: + except (OSError, IOError) as err: self.warn_node('image file %s not readable: %s' % (filename, err), node) if imgtype: @@ -919,7 +927,7 @@ class BuildEnvironment: longtitlenode = titlenode # explicit title set with title directive; use this only for # the <title> tag in HTML output - if document.has_key('title'): + if 'title' in document: longtitlenode = nodes.title() longtitlenode += nodes.Text(document['title']) # look for first section title and use that as the title @@ -1423,7 +1431,7 @@ class BuildEnvironment: for node in doctree.traverse(addnodes.only): try: ret = builder.tags.eval_condition(node['expr']) - except Exception, err: + except Exception as err: self.warn_node('exception while evaluating only ' 'directive expression: %s' % err, node) node.replace_self(node.children or nodes.comment()) @@ -1549,7 +1557,7 @@ class BuildEnvironment: add_entry(first, _('see also %s') % second, link=False) else: self.warn(fn, 'unknown index entry type %r' % type) - except ValueError, err: + except ValueError as err: self.warn(fn, str(err)) # sort the index entries; put all symbols at the front, even those |