summaryrefslogtreecommitdiff
path: root/sphinx/environment/adapters/asset.py
blob: 91f2cf8eba392acf939e167d6cf45c2fcd5c6d78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
"""
    sphinx.environment.adapters.asset
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Assets adapter for sphinx.environment.

    :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS.
    :license: BSD, see LICENSE for details.
"""

if False:
    # For type annotation
    from sphinx.environment import BuildEnvironment  # NOQA


class ImageAdapter(object):
    def __init__(self, env):
        # type: (BuildEnvironment) -> None
        self.env = env

    def get_original_image_uri(self, name):
        # type: (unicode) -> unicode
        """Get the original image URI."""
        while name in self.env.original_image_uri:
            name = self.env.original_image_uri[name]

        return name