Skip to content

Commit

Permalink
Merge pull request #20 from TunaLobster/master
Browse files Browse the repository at this point in the history
Fixes for compatibility
  • Loading branch information
dham authored Sep 13, 2021
2 parents 99004ac + 8175c3a commit 113f011
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 19 deletions.
6 changes: 3 additions & 3 deletions sphinxcontrib/youtube/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def visit_video_node(self, node, platform_url):
"border": "0",
}
attrs = {
"src": f"{platform_url}{node['id']}",
"src": "{}{}".format(platform_url,node['id']),
"style": css(style),
}
else:
Expand All @@ -67,7 +67,7 @@ def visit_video_node(self, node, platform_url):
"border": "0",
}
attrs = {
"src": f"{platform_url}{node['id']}",
"src": "{}{}".format(platform_url,node['id']),
"style": css(style),
}
attrs["allowfullscreen"] = "true"
Expand Down Expand Up @@ -120,5 +120,5 @@ def run(self):


def unsupported_visit_video(self, node, platform):
self.builder.warn(f'{platform}: unsupported output format (node skipped)')
self.builder.warn('{}: unsupported output format (node skipped)'.format(platform))
raise nodes.SkipNode
14 changes: 6 additions & 8 deletions sphinxcontrib/youtube/vimeo.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from . import utils
from functools import partial


class vimeo(utils.video):
Expand All @@ -12,17 +11,16 @@ class Vimeo(utils.Video):
_node = vimeo


visit_vimeo_node = partial(utils.visit_video_node,
platform_url="https://player.vimeo.com/video/")
def visit_vimeo_node(self, node):
return utils.visit_video_node(self, node, platform_url="https://player.vimeo.com/video/")


visit_vimeo_node_latex = partial(utils.visit_video_node_latex,
platform="vimeo",
platform_url="https://player.vimeo.com/video/")
def visit_vimeo_node_latex(self, node):
return utils.visit_video_node_latex(self, node, platform="vimeo", platform_url="https://player.vimeo.com/video/")


unsupported_visit_vimeo = partial(utils.unsupported_visit_video,
platform="vimeo")
def unsupported_visit_vimeo(self, node):
return utils.unsupported_visit_video(self, node, platform="vimeo")


_NODE_VISITORS = {
Expand Down
14 changes: 6 additions & 8 deletions sphinxcontrib/youtube/youtube.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from . import utils
from functools import partial


class youtube(utils.video):
Expand All @@ -12,17 +11,16 @@ class YouTube(utils.Video):
_node = youtube


visit_youtube_node = partial(utils.visit_video_node,
platform_url="https://www.youtube.com/embed/")
def visit_youtube_node(self, node):
return utils.visit_video_node(self, node, platform_url="https://www.youtube.com/embed/")


visit_youtube_node_latex = partial(utils.visit_video_node_latex,
platform="youtube",
platform_url="https://youtu.be/")
def visit_youtube_node_latex(self, node):
return utils.visit_video_node_latex(self, node, platform="youtube", platform_url="https://youtu.be/")


unsupported_visit_youtube = partial(utils.unsupported_visit_video,
platform="youtube")
def unsupported_visit_youtube(self, node):
return utils.unsupported_visit_video(self, node, platform="youtube")


_NODE_VISITORS = {
Expand Down

0 comments on commit 113f011

Please sign in to comment.