Bläddra i källkod

Merge pull request #788 from mothsART/liquid_tag_video_percentage

liquid_tag/video: add ability to specify width and height in percentages
Justin Mayer 8 år sedan
förälder
incheckning
b9ab2973ce
1 ändrade filer med 3 tillägg och 3 borttagningar
  1. 3 3
      liquid_tags/video.py

+ 3 - 3
liquid_tags/video.py

@@ -10,11 +10,11 @@ Syntax
 
 Example
 -------
-{% video http://site.com/video.mp4 720 480 http://site.com/poster-frame.jpg %}
+{% video http://site.com/video.mp4 100% 480 http://site.com/poster-frame.jpg %}
 
 Output
 ------
-<video width='720' height='480' preload='none' controls poster='http://site.com/poster-frame.jpg'>
+<video width='100%' height='480' preload='none' controls poster='http://site.com/poster-frame.jpg'>
    <source src='http://site.com/video.mp4' type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"'/>
 </video>
 
@@ -26,7 +26,7 @@ from .mdx_liquid_tags import LiquidTags
 
 SYNTAX = "{% video url/to/video [url/to/video] [url/to/video] [width height] [url/to/poster] %}"
 
-VIDEO = re.compile(r'(/\S+|https?:\S+)(\s+(/\S+|https?:\S+))?(\s+(/\S+|https?:\S+))?(\s+(\d+)\s(\d+))?(\s+(/\S+|https?:\S+))?')
+VIDEO = re.compile(r'(/\S+|https?:\S+)(\s+(/\S+|https?:\S+))?(\s+(/\S+|https?:\S+))?(\s+(\d+\%?)\s(\d+\%?))?(\s+(/\S+|https?:\S+))?')
 
 VID_TYPEDICT = {'.mp4':"type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"'",
                 '.ogv':"type='video/ogg; codecs=theora, vorbis'",