Closed tiktuk closed 10 years ago
from micawber.contrib.mcdjango import extension
def custom_handler(url, response_data):
return url
oembed_alt = extension(
'oembed_alt',
urlize_all=False,
block_handler=custom_handler)
text = '\n'.join((
'this is the first line',
'http://photo-test2',
'this is the third line http://photo-test2',
'http://photo-test2 this is the fourth line'))
rendered = self.render('{{ text|oembed_alt }}', text=text)
self.assertEqual(rendered.splitlines(), [
'this is the first line',
self.full_pairs['http://photo-test2'],
'this is the third line http://photo-test2',
'http://photo-test2 this is the fourth line',
])
Thanks, works perfectly :) .
I have a Markdown RichText field in my Django app that I'm using micawber for converting video links into embedded videos. I only want micawber to convert links on their own line into embedded media however. I don't want it to convert my markdown links, the mardown converter will take care of those.
So far the text is first run through an
oembed_no_urlize
function as described in your documentation:Inline YouTube links are still oEmbed converted though, so a Markdown link like
is converted into
when first converted by micawber and then markdown.
Is it possible to disable all inline conversion?