|
@@ -14,11 +14,13 @@ Example
|
|
|
|
|
|
Output
|
|
|
------
|
|
|
-<iframe width="640" height="480" src="https://www.youtube.com/embed/dQw4w9WgXcQ" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
|
|
|
+<iframe
|
|
|
+ width="640" height="480" src="https://www.youtube.com/embed/dQw4w9WgXcQ"
|
|
|
+ frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen>
|
|
|
+</iframe>
|
|
|
|
|
|
[1] https://gist.github.com/jamieowen/2063748
|
|
|
"""
|
|
|
-import os
|
|
|
import re
|
|
|
from .mdx_liquid_tags import LiquidTags
|
|
|
|
|
@@ -26,6 +28,7 @@ SYNTAX = "{% youtube id [width height] %}"
|
|
|
|
|
|
YOUTUBE = re.compile(r'([\S]+)(\s+(\d+)\s(\d+))?')
|
|
|
|
|
|
+
|
|
|
@LiquidTags.register('youtube')
|
|
|
def youtube(preprocessor, tag, markup):
|
|
|
width = 640
|
|
@@ -43,9 +46,9 @@ def youtube(preprocessor, tag, markup):
|
|
|
youtube_out = """
|
|
|
<div class="videobox">
|
|
|
<iframe width="{width}" height="{height}"
|
|
|
- src='https://www.youtube.com/embed/{youtube_id}'
|
|
|
- frameborder='0'
|
|
|
- webkitAllowFullScreen mozallowfullscreen allowFullScreen>
|
|
|
+ src='https://www.youtube.com/embed/{youtube_id}'
|
|
|
+ frameborder='0' webkitAllowFullScreen mozallowfullscreen
|
|
|
+ allowFullScreen>
|
|
|
</iframe>
|
|
|
</div>
|
|
|
""".format(width=width, height=height, youtube_id=youtube_id).strip()
|
|
@@ -56,6 +59,6 @@ def youtube(preprocessor, tag, markup):
|
|
|
return youtube_out
|
|
|
|
|
|
|
|
|
-#----------------------------------------------------------------------
|
|
|
+# ---------------------------------------------------
|
|
|
# This import allows image tag to be a Pelican plugin
|
|
|
-from liquid_tags import register
|
|
|
+from liquid_tags import register # noqa
|