def parse(self, text, maxwidth=None, maxheight=None, template_dir=None,<EOL>context=None, urlize_all_links=CONSUMER_URLIZE_ALL):
context = context or Context()<EOL>context['<STR_LIT>'] = maxwidth<EOL>context['<STR_LIT>'] = maxheight<EOL>try:<EOL><INDENT>text = unicode(text)<EOL><DEDENT>except UnicodeDecodeError:<EOL><INDENT>text = unicode(text.decode('<STR_LIT:utf-8>'))<EOL><DEDENT>return self.parse_data(text, maxwidth, maxheight, template_dir,<EOL>context, urlize_all_links)<EOL>
Scans a block of text, replacing anything matching a provider pattern
with an OEmbed html snippet, if possible.

Templates should be stored at oembed/{format}.html, so for example:

    oembed/video.html

An optional template_dir can be provided, allowing for

    oembed/[template_dir]/video.html

These templates are passed a context variable, ``response``, which is
an OEmbedResource, as well as the ``original_url``