diff options
| author | Dmitry Shachnev <mitya57@gmail.com> | 2014-01-20 18:32:47 +0400 |
|---|---|---|
| committer | Dmitry Shachnev <mitya57@gmail.com> | 2014-01-20 18:32:47 +0400 |
| commit | c7539932b582ce7f849d6a83de296426393594d6 (patch) | |
| tree | bb18c53d431f98cb3a33df663efe9093af0775ea /sphinx/writers/html.py | |
| parent | f3ff3c037b4a78fbadf528e4e86b455400b1361c (diff) | |
| parent | 344417db950d6e816ab2efb21737c2bdf9d1ad53 (diff) | |
| download | sphinx-c7539932b582ce7f849d6a83de296426393594d6.tar.gz | |
Merge
Diffstat (limited to 'sphinx/writers/html.py')
| -rw-r--r-- | sphinx/writers/html.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/sphinx/writers/html.py b/sphinx/writers/html.py index 1e0c9f77..e5271cc4 100644 --- a/sphinx/writers/html.py +++ b/sphinx/writers/html.py @@ -70,7 +70,7 @@ class HTMLTranslator(BaseTranslator): self.no_smarty = 0 self.builder = builder self.highlightlang = builder.config.highlight_language - self.highlightlinenothreshold = sys.maxint + self.highlightlinenothreshold = sys.maxsize self.protect_literal_text = 0 self.permalink_text = builder.config.html_add_permalinks # support backwards-compatible setting to a bool @@ -260,11 +260,11 @@ class HTMLTranslator(BaseTranslator): linenos = node.rawsource.count('\n') >= \ self.highlightlinenothreshold - 1 highlight_args = node.get('highlight_args', {}) - if node.has_key('language'): + if 'language' in node: # code-block directives lang = node['language'] highlight_args['force'] = True - if node.has_key('linenos'): + if 'linenos' in node: linenos = node['linenos'] def warner(msg): self.builder.warn(msg, (self.builder.current_docname, node.line)) @@ -373,13 +373,13 @@ class HTMLTranslator(BaseTranslator): if node['uri'].lower().endswith('svg') or \ node['uri'].lower().endswith('svgz'): atts = {'src': node['uri']} - if node.has_key('width'): + if 'width' in node: atts['width'] = node['width'] - if node.has_key('height'): + if 'height' in node: atts['height'] = node['height'] - if node.has_key('alt'): + if 'alt' in node: atts['alt'] = node['alt'] - if node.has_key('align'): + if 'align' in node: self.body.append('<div align="%s" class="align-%s">' % (node['align'], node['align'])) self.context.append('</div>\n') @@ -388,21 +388,21 @@ class HTMLTranslator(BaseTranslator): self.body.append(self.emptytag(node, 'img', '', **atts)) return - if node.has_key('scale'): + if 'scale' in node: # Try to figure out image height and width. Docutils does that too, # but it tries the final file name, which does not necessarily exist # yet at the time the HTML file is written. - if Image and not (node.has_key('width') - and node.has_key('height')): + if Image and not ('width' in node + and 'height' in node): try: im = Image.open(os.path.join(self.builder.srcdir, olduri)) except (IOError, # Source image can't be found or opened UnicodeError): # PIL doesn't like Unicode paths. pass else: - if not node.has_key('width'): + if 'width' not in node: node['width'] = str(im.size[0]) - if not node.has_key('height'): + if 'height' not in node: node['height'] = str(im.size[1]) del im BaseTranslator.visit_image(self, node) |
