Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
:height: 315
:width: 560
:align: left
:http: http
:start: None
:end: None
"""
html = """
<div style="margin-left: auto; margin-right:auto" class="runestone">
<div data-video-end="%(end)s" data-video-start="%(start)d" data-video-divid="%(divid)s" data-video-videoid="%(video_id)s" data-video-width="%(width)d" data-video-height="%(height)d" class="align-%(align)s youtube-video" id="%(divid)s"></div>
<p class="runestone_caption"><span class="runestone_caption_text">Video: (%(divid)s)</span> </p>
</div>
"""
option_spec = IframeVideo.option_spec
option_spec.update(
{"start": directives.nonnegative_int, "end": directives.nonnegative_int}
)
def run(self):
if not self.options.get("start"):
self.options["start"] = 0
if not self.options.get("end"):
self.options["end"] = -1
raw_node = super(Youtube, self).run()
addQuestionToDB(self)
return raw_node
self.options['height'] = self.default_height
if not self.options.get('align'):
self.options['align'] = 'left'
if not self.options.get('http'):
self.options['http'] = 'https'
if not self.options.get('divid'):
self.options['divid'] = self.arguments[0]
res = self.html % self.options
addHTMLToDB(self.options['divid'], self.options['basecourse'], res)
raw_node = nodes.raw(self.block_text, res, format='html')
raw_node.source, raw_node.line = self.state_machine.get_source_and_line(self.lineno)
return [raw_node]
class Youtube(IframeVideo):
"""
.. youtube:: YouTubeID
:divid: the runestone id for this video
:height: 315
:width: 560
:align: left
:http: http
"""
html = '''
<div style="margin-left: auto; margin-right:auto" class="runestone">
</div>
'''
"""
html = '''
<div style="margin-left: auto; margin-right:auto" class="runestone">
</div>
'''
def run(self):
raw_node = super(Youtube, self).run()
addQuestionToDB(self)
return raw_node
class Vimeo(IframeVideo):
"""
.. vimeo:: vimeoID
:height: 315
:width: 560
:align: left
:http: http
"""
html = ''
def run(self):
super(IframeVideo, self).run()
self.options["video_id"] = directives.uri(self.arguments[0])
if not self.options.get("width"):
self.options["width"] = self.default_width
if not self.options.get("height"):
self.options["height"] = self.default_height
if not self.options.get("align"):
self.options["align"] = "left"
if not self.options.get("http"):
self.options["http"] = "https"
if not self.options.get("divid"):
self.options["divid"] = self.arguments[0]
res = self.html % self.options
addHTMLToDB(self.options["divid"], self.options["basecourse"], res)
raw_node = nodes.raw(self.block_text, res, format="html")
raw_node.source, raw_node.line = self.state_machine.get_source_and_line(
self.options["align"] = "left"
if not self.options.get("http"):
self.options["http"] = "https"
if not self.options.get("divid"):
self.options["divid"] = self.arguments[0]
res = self.html % self.options
addHTMLToDB(self.options["divid"], self.options["basecourse"], res)
raw_node = nodes.raw(self.block_text, res, format="html")
raw_node.source, raw_node.line = self.state_machine.get_source_and_line(
self.lineno
)
return [raw_node]
class Youtube(IframeVideo):
"""
.. youtube:: YouTubeID
:divid: the runestone id for this video
:height: 315
:width: 560
:align: left
:http: http
:start: None
:end: None
"""
html = """
<div style="margin-left: auto; margin-right:auto" class="runestone">
<div data-video-end="%(end)s" data-video-start="%(start)d" data-video-divid="%(divid)s" data-video-videoid="%(video_id)s" data-video-width="%(width)d" data-video-height="%(height)d" class="align-%(align)s youtube-video" id="%(divid)s"></div>
<p class="runestone_caption"><span class="runestone_caption_text">Video: (%(divid)s)</span> </p>
</div>
{"start": directives.nonnegative_int, "end": directives.nonnegative_int}
)
def run(self):
if not self.options.get("start"):
self.options["start"] = 0
if not self.options.get("end"):
self.options["end"] = -1
raw_node = super(Youtube, self).run()
addQuestionToDB(self)
return raw_node
class Vimeo(IframeVideo):
"""
.. vimeo:: vimeoID
:height: 315
:width: 560
:align: left
:http: http
"""
html = ''
source = """\
This is some text.
def run(self):
super(IframeVideo, self).run()
self.options['video_id'] = directives.uri(self.arguments[0])
if not self.options.get('width'):
self.options['width'] = self.default_width
if not self.options.get('height'):
self.options['height'] = self.default_height
if not self.options.get('align'):
self.options['align'] = 'left'
if not self.options.get('http'):
self.options['http'] = 'https'
if not self.options.get('divid'):
self.options['divid'] = self.arguments[0]
res = self.html % self.options
addHTMLToDB(self.options['divid'], self.options['basecourse'], res)
raw_node = nodes.raw(self.block_text, res, format='html')
raw_node.source, raw_node.line = self.state_machine.get_source_and_line(self.lineno)