##// END OF EJS Templates
replace extra (str) -> extras (iterable)
yuji96 -
Show More
@@ -8,7 +8,7 b' from os import walk, sep, fsdecode'
8
8
9 from IPython.core.display import DisplayObject, TextDisplayObject
9 from IPython.core.display import DisplayObject, TextDisplayObject
10
10
11 from typing import Tuple
11 from typing import Tuple, Iterable
12
12
13 __all__ = ['Audio', 'IFrame', 'YouTubeVideo', 'VimeoVideo', 'ScribdDocument',
13 __all__ = ['Audio', 'IFrame', 'YouTubeVideo', 'VimeoVideo', 'ScribdDocument',
14 'FileLink', 'FileLinks', 'Code']
14 'FileLink', 'FileLinks', 'Code']
@@ -263,15 +263,18 b' class IFrame(object):'
263 src="{src}{params}"
263 src="{src}{params}"
264 frameborder="0"
264 frameborder="0"
265 allowfullscreen
265 allowfullscreen
266 {extra}
266 {extras}
267 ></iframe>
267 ></iframe>
268 """
268 """
269
269
270 def __init__(self, src, width, height, extra="", **kwargs):
270 def __init__(self, src, width, height, extras: Iterable[str] = None, **kwargs):
271 if extras is None:
272 extras = []
273
271 self.src = src
274 self.src = src
272 self.width = width
275 self.width = width
273 self.height = height
276 self.height = height
274 self.extra = extra
277 self.extras = extras
275 self.params = kwargs
278 self.params = kwargs
276
279
277 def _repr_html_(self):
280 def _repr_html_(self):
@@ -286,7 +289,7 b' class IFrame(object):'
286 width=self.width,
289 width=self.width,
287 height=self.height,
290 height=self.height,
288 params=params,
291 params=params,
289 extra=self.extra,
292 extras=" ".join(self.extras),
290 )
293 )
291
294
292
295
@@ -320,7 +323,7 b' class YouTubeVideo(IFrame):'
320 self.id=id
323 self.id=id
321 src = "https://www.youtube.com/embed/{0}".format(id)
324 src = "https://www.youtube.com/embed/{0}".format(id)
322 if allow_autoplay:
325 if allow_autoplay:
323 kwargs.update(autoplay=1, extra='allow="autoplay"')
326 kwargs.update(autoplay=1, extras=['allow="autoplay"'])
324 super(YouTubeVideo, self).__init__(src, width, height, **kwargs)
327 super(YouTubeVideo, self).__init__(src, width, height, **kwargs)
325
328
326 def _repr_jpeg_(self):
329 def _repr_jpeg_(self):
General Comments 0
You need to be logged in to leave comments. Login now