Skip to content

Commit

Permalink
Modified size of embedded videos
Browse files Browse the repository at this point in the history
  • Loading branch information
JackMorganNZ committed Feb 4, 2016
1 parent 157c316 commit 5fd3a9c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion generator/html-templates.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Click to download {text}

{centered}
<div class='row'>
<div class='col s12 m8 offset-m2 center-align'>
<div class='col s12 m{width} offset-m{offset_width} center-align'>
{html}
</div>
</div>
Expand Down
15 changes: 10 additions & 5 deletions generator/markdownsection.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ def create_image_html(self, filename, arguments, image_set=False):
if wrap:
html = self.html_templates['image-wrapped'].format(html=image_html, wrap_direction=wrap)
else:
html = self.html_templates['centered'].format(html=image_html)
html = self.center_html(image_html, 8)

return html

Expand Down Expand Up @@ -336,6 +336,12 @@ def check_conditional_content(self, match):
return html


def center_html(self, html, width):
"""Centers the HTML using the given number of columns"""
offset_width = (12 - width) // 2
return self.html_templates['centered'].format(html=html, width=width, offset_width=offset_width)


def embed_video(self, match):
youtube_src = "http://www.youtube.com/embed/{0}?rel=0"
vimeo_src = "http://player.vimeo.com/video/{0}"
Expand All @@ -350,6 +356,7 @@ def embed_video(self, match):
elif video_type == 'vimeo':
source_link = vimeo_src.format(video_identifier)
html = self.html_templates['video'].format(source=source_link)
html = self.center_html(html, 10)
else:
self.regex_functions['video'].log("Video url not given", self, match.group(0))
html = ''
Expand Down Expand Up @@ -401,7 +408,6 @@ def create_file_button(self, match):

button_text = self.html_templates['button-download-text'].format(text=text)
html = self.html_templates['button'].format(link=output_path, text=button_text)
# html = self.html_templates['centered'].format(html=html)
else:
self.regex_functions['file download button'].log("File filename argument not provided", self, match.group(0))
return html if html else ''
Expand All @@ -415,7 +421,6 @@ def create_link_button(self, match):

if link and text:
html = self.html_templates['button'].format(link=link, text=text)
# html = self.html_templates['centered'].format(html=html)
else:
self.regex_functions['link button'].log("Button parameters not valid", self, match.group(0))
return html if html else ''
Expand Down Expand Up @@ -482,8 +487,8 @@ def whole_page_interactive_html(self, source_folder, text, name, params, thumbna
link_html = link_template.format(interactive_thumbnail=thumbnail_location,
interactive_link_text=link_text,
interactive_source=file_link)

return self.html_templates['centered'].format(html=link_html)
html = self.center_html(link_html, 8)
return html


def inpage_interactive_html(self, source_folder, name, match):
Expand Down
3 changes: 3 additions & 0 deletions generator/scss/website.scss
Original file line number Diff line number Diff line change
Expand Up @@ -281,3 +281,6 @@ ul.panel {
height: 100%;
width: 100%;
}
.video-container {
margin-top: 1rem;
}

0 comments on commit 5fd3a9c

Please sign in to comment.