[FIX] _extensions: p3 compatibility (8)
This commit is contained in:
parent
db5604f703
commit
48b11b31cc
@ -10,6 +10,12 @@ from sphinx.locale import admonitionlabels
|
|||||||
|
|
||||||
from . import pycompat
|
from . import pycompat
|
||||||
|
|
||||||
|
try:
|
||||||
|
from urllib import url2pathname
|
||||||
|
except ImportError:
|
||||||
|
# P3
|
||||||
|
from urllib.request import url2pathname
|
||||||
|
|
||||||
|
|
||||||
def _parents(node):
|
def _parents(node):
|
||||||
while node.parent:
|
while node.parent:
|
||||||
@ -652,7 +658,7 @@ class BootstrapTranslator(nodes.NodeVisitor, object):
|
|||||||
banner = '_static/' + cover
|
banner = '_static/' + cover
|
||||||
base, ext = os.path.splitext(banner)
|
base, ext = os.path.splitext(banner)
|
||||||
small = "{}.small{}".format(base, ext)
|
small = "{}.small{}".format(base, ext)
|
||||||
if os.path.isfile(urllib.url2pathname(small)):
|
if os.path.isfile(url2pathname(small)):
|
||||||
banner = small
|
banner = small
|
||||||
style = u"background-image: url('{}')".format(
|
style = u"background-image: url('{}')".format(
|
||||||
util.relative_uri(baseuri, banner) or '#')
|
util.relative_uri(baseuri, banner) or '#')
|
||||||
|
Loading…
Reference in New Issue
Block a user