Skip to content

Commit

Permalink
Fixed merge issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Kura committed Dec 9, 2017
1 parent 77a4235 commit 407b97b
Showing 1 changed file with 0 additions and 34 deletions.
34 changes: 0 additions & 34 deletions pelican_youtube/youtube.py
Expand Up @@ -31,56 +31,33 @@ class YouTube(Directive):
Based on the YouTube directive by Brian Hsu:
https://gist.github.com/1422773
<<<<<<< HEAD
VIDEO_ID is required, other arguments are optional
Usage:
.. youtube:: VIDEO_ID
=======
VIDEO_ID is required, with / height are optional integer,
Usage:
.. youtube:: VIDEO_ID
:width: 640
:height: 480
>>>>>>> d34a1ac35df85cdc779ad8add1b2c316d1ddbfaf
"""

def boolean(argument):
"""Conversion function for yes/no True/False."""
value = directives.choice(argument, ('yes', 'True', 'no', 'False'))
return value in ('yes', 'True')

def yesno(argument):
return directives.choice(argument, ('yes', 'no'))

required_arguments = 1
optional_arguments = 5
option_spec = {
'class': directives.unchanged,
'width': directives.positive_int,
'height': directives.positive_int,
<<<<<<< HEAD
'allowfullscreen': boolean,
'seamless': boolean,
=======
'align': align, # back compatibility
'nocookie': yesno,
>>>>>>> d34a1ac35df85cdc779ad8add1b2c316d1ddbfaf
}

final_argument_whitespace = False
has_content = False

def run(self):
videoID = self.arguments[0].strip()
<<<<<<< HEAD
url = 'https://www.youtube.com/embed/{}'.format(videoID)
=======
width = 420
height = 315
domain = 'www.youtube.com'
>>>>>>> d34a1ac35df85cdc779ad8add1b2c316d1ddbfaf

width = self.options['width'] if 'width' in self.options else None
height = self.options['height'] if 'height' in self.options else None
Expand All @@ -97,7 +74,6 @@ def run(self):
css_classes += ' {}'.format('youtube-16x9')
# no additional classes if dimensions (height/width) are specified

<<<<<<< HEAD
iframe_arguments = [
(width, 'width="{}"'),
(height, 'height="{}"'),
Expand All @@ -112,16 +88,6 @@ def run(self):
embed_block += (format + ' ').format(value) if value else ''

embed_block = embed_block[:-1] + '></iframe>'
=======
if 'nocookie' in self.options and self.options['nocookie'] == 'yes':
domain = 'www.youtube-nocookie.com'


url = 'https://{}/embed/{}'.format(domain, videoID)
div_block = '<div class="youtube">'
embed_block = '<iframe width="{}" height="{}" src="{}">'\
'</iframe>'.format(width, height, url)
>>>>>>> d34a1ac35df85cdc779ad8add1b2c316d1ddbfaf

return [
nodes.raw('', div_block, format='html'),
Expand Down

0 comments on commit 407b97b

Please sign in to comment.