コード例 #1
0
    def post_process_images(self, doctree):
        # type: (nodes.Node) -> None
        """Pick the best candidate for an image and link down-scaled images to
        their high res version.
        """
        Builder.post_process_images(self, doctree)

        if self.config.html_scaled_image_link and self.html_scaled_image_link:
            for node in doctree.traverse(nodes.image):
                scale_keys = ('scale', 'width', 'height')
                if not any((key in node) for key in scale_keys) or \
                   isinstance(node.parent, nodes.reference):
                    # docutils does unfortunately not preserve the
                    # ``target`` attribute on images, so we need to check
                    # the parent node here.
                    continue
                uri = node['uri']
                reference = nodes.reference('', '', internal=True)
                if uri in self.images:
                    reference['refuri'] = posixpath.join(self.imgpath,
                                                         self.images[uri])
                else:
                    reference['refuri'] = uri
                node.replace_self(reference)
                reference.append(node)
コード例 #2
0
ファイル: html.py プロジェクト: ymarfoq/outilACVDesagregation
 def post_process_images(self, doctree):
     """Pick the best candidate for an image and link down-scaled images to
     their high res version.
     """
     Builder.post_process_images(self, doctree)
     for node in doctree.traverse(nodes.image):
         scale_keys = ("scale", "width", "height")
         if not any((key in node) for key in scale_keys) or isinstance(node.parent, nodes.reference):
             # docutils does unfortunately not preserve the
             # ``target`` attribute on images, so we need to check
             # the parent node here.
             continue
         uri = node["uri"]
         reference = nodes.reference("", "", internal=True)
         if uri in self.images:
             reference["refuri"] = posixpath.join(self.imgpath, self.images[uri])
         else:
             reference["refuri"] = uri
         node.replace_self(reference)
         reference.append(node)
コード例 #3
0
ファイル: html.py プロジェクト: wuxi20/Pythonista
 def post_process_images(self, doctree):
     """Pick the best candidate for an image and link down-scaled images to
     their high res version.
     """
     Builder.post_process_images(self, doctree)
     for node in doctree.traverse(nodes.image):
         if not node.has_key('scale') or \
            isinstance(node.parent, nodes.reference):
             # docutils does unfortunately not preserve the
             # ``target`` attribute on images, so we need to check
             # the parent node here.
             continue
         uri = node['uri']
         reference = nodes.reference('', '', internal=True)
         if uri in self.images:
             reference['refuri'] = posixpath.join(self.imgpath,
                                                  self.images[uri])
         else:
             reference['refuri'] = uri
         node.replace_self(reference)
         reference.append(node)
コード例 #4
0
ファイル: __init__.py プロジェクト: chadmv/sphinx-confluence
 def post_process_images(self, doctree):
     Builder.post_process_images(self, doctree)
コード例 #5
0
ファイル: __init__.py プロジェクト: chadmv/sphinx-confluence
 def post_process_images(self, doctree):
     Builder.post_process_images(self, doctree)