Skip to content

Commit

Permalink
Merge branch 'release/0.10.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Hayley van Waas committed Sep 28, 2018
2 parents 917f763 + 8103abb commit 2bfb488
Show file tree
Hide file tree
Showing 12 changed files with 74 additions and 5 deletions.
11 changes: 11 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
Changelog
#######################################

0.10.0
=======================================

- Add title parameter to :doc:`processors/video` processor for translations.
- Dependency updates:

- Update ``setuptools`` to 40.4.3
- Update ``sphinx`` to 1.8.1

0.9.3
=======================================
- Resolve issues of broken package due to unpinned dependencies.
- Remove automated deployment to PyPI.

0.9.2
=======================================

- Broken release, removed from PyPI.

0.9.1
=======================================

- Broken release, removed from PyPI.

0.9.0
Expand Down
2 changes: 1 addition & 1 deletion docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ Other notes
=======================================

Why are requirements split across two files?
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

The ``requirements.txt`` file is used to specify required dependencies for Verto (and are automatically installed as dependencies when installed via ``pip``).
The ``requirements-dev.txt`` file is used to specify dependencies for developing Verto (for example, documentation generators).
Expand Down
7 changes: 7 additions & 0 deletions docs/source/processors/video.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,12 @@ Required Tag Parameters
- ``https://vimeo.com/94502406`` - Standard URL
- ``https://player.vimeo.com/video/94502406``- Embed URL

Optional Tag Parameters
***************************************

- ``title`` - The title text for the video.


The default HTML for a video is:

.. literalinclude:: ../../../verto/html-templates/video.html
Expand Down Expand Up @@ -57,6 +63,7 @@ Overriding HTML for Videos
When overriding the HTML for videos, the following Jinja2 placeholders are available:

- ``{{ video_url }}`` - The URL of the video to be embedded.
- ``{{ title }}`` - The title of the video.

In the ``video-youtube.html``, the following Jinja2 placeholders are available:

Expand Down
4 changes: 2 additions & 2 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
setuptools==40.2.0
sphinx==1.8.0
setuptools==40.4.3
sphinx==1.8.1
sphinx_rtd_theme==0.4.1
coverage==4.5.1
flake8==3.5.0
2 changes: 1 addition & 1 deletion verto/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# flake8: noqa
from .Verto import Verto

__version__ = '0.9.3'
__version__ = '0.10.0'
3 changes: 3 additions & 0 deletions verto/html-templates/video.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
<div>
{% if title %}
<div class="video-title">{{ title }}</div>
{% endif %}
<iframe allowfullscreen='allowfullscreen' frameborder='0' src='{{ video_url }}'></iframe>
</div>
8 changes: 8 additions & 0 deletions verto/processor-info.json
Original file line number Diff line number Diff line change
Expand Up @@ -509,6 +509,14 @@
"arguments": {
"url": {
"required": true
},
"title": {
"required": false
}
},
"template_parameters": {
"title": {
"argument": "title"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion verto/processors/VideoBlockProcessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def run(self, parent, blocks):
if not identifier:
raise NoVideoIdentifierError(block, url, 'missing video identifier')

context = dict()
context = self.process_parameters(self.processor, self.template_parameters, argument_values)
context['identifier'] = identifier
context['video_url'] = ''

Expand Down
34 changes: 34 additions & 0 deletions verto/tests/VideoTest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from verto.VertoExtension import VertoExtension
from verto.processors.VideoBlockProcessor import VideoBlockProcessor
from verto.errors.ArgumentMissingError import ArgumentMissingError
from verto.errors.NoVideoIdentifierError import NoVideoIdentifierError
from verto.errors.UnsupportedVideoPlayerError import UnsupportedVideoPlayerError
from verto.tests.ProcessorTest import ProcessorTest
Expand Down Expand Up @@ -173,6 +174,18 @@ def test_contains_multiple_videos(self):
expected_file_string = self.read_test_file(self.processor_name, 'contains_multiple_videos_expected.html', strip=True)
self.assertEqual(converted_test_string, expected_file_string)

def test_contains_title(self):
'''Tests output for video with title.
'''
test_string = self.read_test_file(self.processor_name, 'contains_title.md')
blocks = self.to_blocks(test_string)

self.assertListEqual([True], [VideoBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string))

converted_test_string = markdown.markdown(test_string, extensions=[self.verto_extension])
expected_file_string = self.read_test_file(self.processor_name, 'contains_title_expected.html', strip=True)
self.assertEqual(converted_test_string, expected_file_string)

def test_url_false_custom_argument_rules(self):
'''Tests to ensure that video tag is rendered correctly when url argument is not required.
'''
Expand All @@ -195,6 +208,27 @@ def test_url_false_custom_argument_rules(self):
expected_string = self.read_test_file(self.processor_name, 'url_false_expected.html', strip=True)
self.assertEqual(expected_string, converted_test_string)

def test_custom_argument_rules_title_true_not_provided(self):
'''Tests to ensure that error is raised when title argument is required but not provided.
'''
custom_argument_rules = {
"video": {
"title": True
}
}
verto_extension_custom_rules = VertoExtension(
processors=[self.processor_name],
custom_argument_rules=custom_argument_rules
)

test_string = self.read_test_file(self.processor_name, 'title_true_not_provided.md')
blocks = self.to_blocks(test_string)

self.assertListEqual([True], [VideoBlockProcessor(self.ext, self.md.parser).test(blocks, block) for block in blocks], msg='"{}"'.format(test_string))

self.assertRaises(ArgumentMissingError, lambda x: markdown.markdown(x, extensions=[verto_extension_custom_rules]), test_string)


# ~
# Doc Tests
# ~
Expand Down
1 change: 1 addition & 0 deletions verto/tests/assets/video/contains_title.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{video url="https://vimeo.com/94502406" title="this is the video title"}
4 changes: 4 additions & 0 deletions verto/tests/assets/video/contains_title_expected.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<div>
<div class="video-title">this is the video title</div>
<iframe allowfullscreen="allowfullscreen" frameborder="0" src="https://player.vimeo.com/video/94502406"></iframe>
</div>
1 change: 1 addition & 0 deletions verto/tests/assets/video/title_true_not_provided.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{video url="https://vimeo.com/94502406"}

0 comments on commit 2bfb488

Please sign in to comment.