Skip to content

Commit c67667f

Browse files
author
Kura
committed
initial
0 parents  commit c67667f

File tree

7 files changed

+250
-0
lines changed

7 files changed

+250
-0
lines changed

LICENSE

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
Copyright (c) 2013 Kura
2+
Permission is hereby granted, free of charge, to any person obtaining a copy
3+
of this software and associated documentation files (the "Software"), to deal
4+
in the Software without restriction, including without limitation the rights
5+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6+
copies of the Software, and to permit persons to whom the Software is
7+
furnished to do so, subject to the following conditions:
8+
9+
The above copyright notice and this permission notice shall be included in
10+
all copies or substantial portions of the Software.
11+
12+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
14+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18+
SOFTWARE.

MANIFEST.in

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
include README.rst LICENSE

README.rst

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
=============
2+
Pelican Vimeo
3+
=============
4+
5+
Pelican Vimeo is a plugin to enabled you to embed Vimeo videos in your pages
6+
and articles.
7+
8+
Installation
9+
============
10+
11+
To install pelican-gist, simply install it from PyPI:
12+
13+
.. code-block:: bash
14+
15+
$ pip install pelican-vimeo
16+
17+
Then enabled it in your pelicanconf.py
18+
19+
.. code-block:: python
20+
21+
PLUGINS = [
22+
# ...
23+
'pelican_vimeo',
24+
# ...
25+
]
26+
27+
Usage
28+
=====
29+
30+
In your article or page, you simply need to add a line to embed you video.
31+
32+
.. code-block:: rst
33+
34+
.. vimeo:: VIDEO_ID
35+
36+
Which will result in:
37+
38+
.. code-block:: html
39+
40+
<div class="vimeo" align="left">
41+
<iframe width="420" height="315" src="https://player.vimeo.com/video/VIDEO_ID" frameborder="0"></iframe>
42+
</div>
43+
44+
Additional arguments
45+
--------------------
46+
47+
You can also specify a `width`, `height` and `alignment`
48+
49+
.. code-block:: rst
50+
51+
.. vimeo:: 37818131
52+
:width: 800
53+
:height: 500
54+
:align: center
55+
56+
Which will result in:
57+
58+
.. code-block:: html
59+
60+
<div class="vimeo" align="center">
61+
<iframe width="800" height="500" src="https://player.vimeo.com/video/37818131" frameborder="0"></iframe>
62+
</div>
63+
64+
License
65+
=======
66+
67+
`MIT`_ license.
68+
69+
.. _MIT: http://opensource.org/licenses/MIT

pelican_vimeo/__init__.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright (c) 2013 Kura
2+
# Permission is hereby granted, free of charge, to any person obtaining a copy
3+
# of this software and associated documentation files (the "Software"), to deal
4+
# in the Software without restriction, including without limitation the rights
5+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
6+
# copies of the Software, and to permit persons to whom the Software is
7+
# furnished to do so, subject to the following conditions:
8+
9+
# The above copyright notice and this permission notice shall be included in
10+
# all copies or substantial portions of the Software.
11+
12+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
14+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18+
# SOFTWARE.
19+
20+
# -*- coding: utf-8 -*-
21+
__title__ = 'pelican-vimeo'
22+
__version__ = '0.1.0'
23+
__author__ = 'Kura'
24+
__credits__ = ["Kura", ]
25+
__maintainer__ = "Kura"
26+
__email__ = "[email protected]"
27+
__status__ = "Stable"
28+
__license__ = 'MIT'
29+
__copyright__ = 'Copyright 2013'
30+
31+
from pelican_vimeo.vimeo import register

pelican_vimeo/vimeo.py

+86
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
# -*- coding: utf-8 -*-
2+
3+
# Copyright (c) 2013 Kura
4+
# Permission is hereby granted, free of charge, to any person obtaining a copy
5+
# of this software and associated documentation files (the "Software"), to deal
6+
# in the Software without restriction, including without limitation the rights
7+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
# copies of the Software, and to permit persons to whom the Software is
9+
# furnished to do so, subject to the following conditions:
10+
11+
# The above copyright notice and this permission notice shall be included in
12+
# all copies or substantial portions of the Software.
13+
14+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY
16+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20+
# SOFTWARE.
21+
22+
from __future__ import unicode_literals
23+
24+
from docutils import nodes
25+
from docutils.parsers.rst import directives, Directive
26+
27+
28+
class Vimeo(Directive):
29+
""" Embed Vimeo video in posts.
30+
31+
Based on the YouTube directive by Brian Hsu:
32+
https://gist.github.com/1422773
33+
34+
VIDEO_ID is required, with / height are optional integer,
35+
and align could be left / center / right.
36+
37+
Usage:
38+
.. vimeo:: VIDEO_ID
39+
:width: 640
40+
:height: 480
41+
:align: center
42+
"""
43+
44+
def align(argument):
45+
"""Conversion function for the "align" option."""
46+
return directives.choice(argument, ('left', 'center', 'right'))
47+
48+
required_arguments = 1
49+
optional_arguments = 2
50+
option_spec = {
51+
'width': directives.positive_int,
52+
'height': directives.positive_int,
53+
'align': align
54+
}
55+
56+
final_argument_whitespace = False
57+
has_content = False
58+
59+
def run(self):
60+
videoID = self.arguments[0].strip()
61+
width = 420
62+
height = 315
63+
align = 'left'
64+
65+
if 'width' in self.options:
66+
width = self.options['width']
67+
68+
if 'height' in self.options:
69+
height = self.options['height']
70+
71+
if 'align' in self.options:
72+
align = self.options['align']
73+
74+
url = 'https://player.vimeo.com/video/%s' % videoID
75+
div_block = '<div class="vimeo" align="%s">' % align
76+
embed_block = '<iframe width="%s" height="%s" src="%s" '\
77+
'frameborder="0"></iframe>' % (width, height, url)
78+
79+
return [
80+
nodes.raw('', div_block, format='html'),
81+
nodes.raw('', embed_block, format='html'),
82+
nodes.raw('', '</div>', format='html')]
83+
84+
85+
def register():
86+
directives.register_directive('vimeo', Vimeo)

setup.cfg

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[aliases]
2+
release = egg_info -RDb ''
3+
upload = upload --sign --identity=49FCF4D9
4+
5+
[wheel]
6+
universal = 1

setup.py

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
from setuptools import setup
2+
from setuptools import find_packages
3+
4+
version = __import__('pelican_vimeo').__version__
5+
download_url = 'https://github.com/kura/pelican_gist/archive/{}.zip'.format(version)
6+
7+
setup(name='pelican_vimeo',
8+
version=version,
9+
url='https://github.com/kura/pelican_gist',
10+
download_url=download_url,
11+
author="Kura",
12+
author_email="[email protected]",
13+
maintainer="Kura",
14+
maintainer_email="[email protected]",
15+
description="Easily embed Vimeo videos in your posts",
16+
long_description=open("README.rst").read(),
17+
license='MIT',
18+
platforms=['linux'],
19+
packages=find_packages(exclude=["*.tests"]),
20+
package_data={'': ['LICENSE', ]},
21+
classifiers=[
22+
'Development Status :: 5 - Production/Stable',
23+
'Operating System :: OS Independent',
24+
'Programming Language :: Python',
25+
'Programming Language :: Python :: 2.6',
26+
'Programming Language :: Python :: 2.7',
27+
'Programming Language :: Python :: 3',
28+
'Programming Language :: Python :: 3.1',
29+
'Programming Language :: Python :: 3.2',
30+
'Programming Language :: Python :: 3.3',
31+
'Programming Language :: Python :: Implementation :: CPython',
32+
'Intended Audience :: Developers',
33+
'License :: OSI Approved :: MIT License',
34+
'Topic :: Internet :: WWW/HTTP',
35+
'Topic :: Software Development :: Libraries :: Python Modules',
36+
'Topic :: Text Processing',
37+
],
38+
zip_safe=True,
39+
)

0 commit comments

Comments
 (0)