コード例 #1
0
def oembed(input, args):
    if args:
        width, height = args.lower().split("x")
        if not width and height:
            raise template.TemplateSyntaxError(
                "Oembed's optional WIDTHxHEIGH" "T argument requires WIDTH and HEIGHT to be positive integers."
            )
    else:
        width, height = None, None
    return replace(input, max_width=width, max_height=height)
コード例 #2
0
 def render(self, context):
     kwargs = {}
     if self.width and self.height:
         kwargs["max_width"] = self.width
         kwargs["max_height"] = self.height
     return replace(self.nodelist.render(context), **kwargs)