ソースを参照

Merge pull request #399 from Azd325/master

Update spotify, vimeo & youtube tags to be more PEP8
Justin Mayer 9 年 前
コミット
ed7fe5aee2
共有3 個のファイルを変更した30 個の追加17 個の削除を含む
  1. 7 4
      liquid_tags/spotify.py
  2. 13 6
      liquid_tags/vimeo.py
  3. 10 7
      liquid_tags/youtube.py

+ 7 - 4
liquid_tags/spotify.py

@@ -14,9 +14,11 @@ Example
 
 Output
 ------
-<iframe src='https://embed.spotify.com/?uri=spotify:track:1HNZcRFlIKwHAJD3LxvX4d' width='300' height='380' frameborder='0' allowtransparency='true'></iframe>
+<iframe
+    src='https://embed.spotify.com/?uri=spotify:track:1HNZcRFlIKwHAJD3LxvX4d'
+    width='300' height='380' frameborder='0' allowtransparency='true'>
+</iframe>
 """
-import os
 import re
 from .mdx_liquid_tags import LiquidTags
 
@@ -24,6 +26,7 @@ SYNTAX = "{% spotify id %}"
 
 SPOTIFY = re.compile(r'(\w+)(\s+(\d+)\s(\d+))?')
 
+
 @LiquidTags.register('spotify')
 def spotify(preprocessor, tag, markup):
     spotify_id = None
@@ -47,6 +50,6 @@ def spotify(preprocessor, tag, markup):
     return spotify_out
 
 
-#----------------------------------------------------------------------
+# ---------------------------------------------------
 # This import allows image tag to be a Pelican plugin
-from liquid_tags import register
+from liquid_tags import register  # noqa

+ 13 - 6
liquid_tags/vimeo.py

@@ -15,7 +15,13 @@ Example
 
 Output
 ------
-<div style="width:640px; height:480px;"><iframe src="//player.vimeo.com/video/10739054?title=0&amp;byline=0&amp;portrait=0" width="640" height="480" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe></div>
+<div style="width:640px; height:480px;">
+    <iframe
+        src="//player.vimeo.com/video/10739054?title=0&amp;byline=0&amp;portrait=0"
+        width="640" height="480" frameborder="0"
+        webkitallowfullscreen mozallowfullscreen allowfullscreen>
+    </iframe>
+</div>
 
 [1] https://gist.github.com/jamieowen/2063748
 """
@@ -43,9 +49,10 @@ def vimeo(preprocessor, tag, markup):
     if vimeo_id:
         vimeo_out = """
             <div class="videobox">
-                <iframe src="//player.vimeo.com/video/{vimeo_id}?title=0&amp;byline=0&amp;portrait=0"
-                        width="{width}" height="{height}" frameborder="0"
-                        webkitAllowFullScreen mozallowfullscreen allowFullScreen>
+                <iframe
+                    src="//player.vimeo.com/video/{vimeo_id}?title=0&amp;byline=0&amp;portrait=0"
+                    width="{width}" height="{height}" frameborder="0"
+                    webkitAllowFullScreen mozallowfullscreen allowFullScreen>
                 </iframe>
             </div>
         """.format(width=width, height=height, vimeo_id=vimeo_id).strip()
@@ -56,6 +63,6 @@ def vimeo(preprocessor, tag, markup):
     return vimeo_out
 
 
-#----------------------------------------------------------------------
+# ---------------------------------------------------
 # This import allows vimeo tag to be a Pelican plugin
-from liquid_tags import register
+from liquid_tags import register  # noqa

+ 10 - 7
liquid_tags/youtube.py

@@ -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