Просмотр исходного кода

liquid_tag : replace div to span

Ferry Jérémie лет назад: 7
Родитель
Сommit
bc59ee066c
4 измененных файлов с 17 добавлено и 15 удалено
  1. 2 2
      liquid_tags/diag.py
  2. 2 3
      liquid_tags/graphviz.py
  3. 4 4
      liquid_tags/vimeo.py
  4. 9 6
      liquid_tags/youtube.py

+ 2 - 2
liquid_tags/diag.py

@@ -57,7 +57,7 @@ Examples
 
 Output
 ------
-<div class="blockdiag" style="align: center;"><img src="data:image/png;base64,_BASE64_IMAGE DATA_/></div>
+<span class="blockdiag" style="align: center;"><img src="data:image/png;base64,_BASE64_IMAGE DATA_/></span>
 
 """
 
@@ -168,7 +168,7 @@ def blockdiag_parser(preprocessor, tag, markup):
 
         if output:
             # Return Base64 encoded image
-            return '<div class="blockdiag" style="align: center;"><img src="data:image/png;base64,%s"></div>' % base64.b64encode(output)
+            return '<span class="blockdiag" style="align: center;"><img src="data:image/png;base64,%s"></span>' % base64.b64encode(output)
     else:
         raise ValueError('Error processing input. '
                          'Expected syntax: {0}'.format(SYNTAX))

+ 2 - 3
liquid_tags/graphviz.py

@@ -45,7 +45,7 @@ Examples
 
 Output
 ------
-<div class="graphviz" style="text-align: center;"><img src="data:image/png;base64,_BASE64_IMAGE DATA_/></div>
+<span class="graphviz" style="text-align: center;"><img src="data:image/png;base64,_BASE64_IMAGE DATA_/></span>
 
 """
 
@@ -116,8 +116,7 @@ def graphviz_parser(preprocessor, tag, markup):
         output = run_graphviz(program, code)
 
         # Return Base64 encoded image
-        return '<div class="graphviz" style="text-align: center;"><img src="data:image/png;base64,%s"></div>' % base64.b64encode(output).decode('utf-8')
-
+        return '<span class="graphviz" style="text-align: center;"><img src="data:image/png;base64,%s"></span>' % base64.b64encode(output).decode('utf-8')
     else:
         raise ValueError('Error processing input. '
                          'Expected syntax: {0}'.format(SYNTAX))

+ 4 - 4
liquid_tags/vimeo.py

@@ -15,13 +15,13 @@ Example
 
 Output
 ------
-<div style="width:640px; height:480px;">
+<span 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>
+</span>
 
 [1] https://gist.github.com/jamieowen/2063748
 """
@@ -48,13 +48,13 @@ def vimeo(preprocessor, tag, markup):
 
     if vimeo_id:
         vimeo_out = """
-            <div class="videobox">
+            <span 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>
-            </div>
+            </span>
         """.format(width=width, height=height, vimeo_id=vimeo_id).strip()
     else:
         raise ValueError("Error processing input, "

+ 9 - 6
liquid_tags/youtube.py

@@ -14,10 +14,13 @@ Example
 
 Output
 ------
-<iframe
-    width="640" height="480" src="https://www.youtube.com/embed/dQw4w9WgXcQ"
-    frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen>
-</iframe>
+
+<span class="videobox">
+    <iframe
+        width="640" height="480" src="https://www.youtube.com/embed/dQw4w9WgXcQ"
+        frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen>
+    </iframe>
+</span>
 
 [1] https://gist.github.com/jamieowen/2063748
 """
@@ -44,13 +47,13 @@ def youtube(preprocessor, tag, markup):
 
     if youtube_id:
         youtube_out = """
-            <div class="videobox">
+            <span class="videobox">
                 <iframe width="{width}" height="{height}"
                     src='https://www.youtube.com/embed/{youtube_id}'
                     frameborder='0' webkitAllowFullScreen mozallowfullscreen
                     allowFullScreen>
                 </iframe>
-            </div>
+            </span>
         """.format(width=width, height=height, youtube_id=youtube_id).strip()
     else:
         raise ValueError("Error processing input, "