|
Lines 16-21
import copy
Link Here
|
| 16 |
import warnings |
16 |
import warnings |
| 17 |
|
17 |
|
| 18 |
from six import string_types |
18 |
from six import string_types |
|
|
19 |
import docutils |
| 19 |
from docutils import nodes |
20 |
from docutils import nodes |
| 20 |
from docutils.writers.html4css1 import Writer, HTMLTranslator as BaseTranslator |
21 |
from docutils.writers.html4css1 import Writer, HTMLTranslator as BaseTranslator |
| 21 |
|
22 |
|
|
Lines 497-502
class HTMLTranslator(BaseTranslator):
Link Here
|
| 497 |
if 'height' not in node: |
498 |
if 'height' not in node: |
| 498 |
node['height'] = str(size[1]) |
499 |
node['height'] = str(size[1]) |
| 499 |
BaseTranslator.visit_image(self, node) |
500 |
BaseTranslator.visit_image(self, node) |
|
|
501 |
|
| 502 |
# overwritten |
| 503 |
def depart_image(self, node): |
| 504 |
if docutils.__version__ >= "0.13": |
| 505 |
# since docutils-0.13, HTMLWriter does not push context data on visit_image() |
| 506 |
if node['uri'].lower().endswith(('svg', 'svgz')): |
| 507 |
self.body.append(self.context.pop()) |
| 508 |
else: |
| 509 |
# docutils-0.12 or below, HTML Writer always push context data on visit_image() |
| 510 |
self.body.append(self.context.pop()) |
| 500 |
|
511 |
|
| 501 |
def visit_toctree(self, node): |
512 |
def visit_toctree(self, node): |
| 502 |
# this only happens when formatting a toc from env.tocs -- in this |
513 |
# this only happens when formatting a toc from env.tocs -- in this |