mirror of
https://github.com/Hopiu/django-embed-video.git
synced 2026-05-11 22:23:12 +00:00
Update embed_video_tags.py
Now is possible set relative sizes in template tag. Ex: '100%x500' or '500x100%' or '100%x100%'
This commit is contained in:
parent
0af959ea02
commit
765d1b2904
1 changed files with 2 additions and 2 deletions
|
|
@ -48,7 +48,7 @@ class VideoNode(Node):
|
|||
error_msg = 'Syntax error. Expected: ``{% video URL ... %}``'
|
||||
default_size = 'small'
|
||||
|
||||
re_size = re.compile('(?P<width>\d+)x(?P<height>\d+)')
|
||||
re_size = re.compile('(?P<width>\w+[%]?)x(?P<height>\w+[%]?)')
|
||||
|
||||
def __init__(self, parser, token):
|
||||
self.size = None
|
||||
|
|
@ -150,7 +150,7 @@ class VideoNode(Node):
|
|||
|
||||
try:
|
||||
size = VideoNode.re_size.match(value)
|
||||
return [int(size.group('width')), int(size.group('height'))]
|
||||
return [size.group('width'), size.group('height')]
|
||||
except AttributeError:
|
||||
raise TemplateSyntaxError(
|
||||
'Incorrect size.\nPossible format is WIDTHxHEIGHT or using '
|
||||
|
|
|
|||
Loading…
Reference in a new issue