It all started quietly with an Issue in the Nikola bug tracker:
gustavodiazjaimes opened this issue 3 hours agooembed by micawber - feature sugestioninstead of using specific code for embed object (Youtube, Vimeo, Soundcloud) use a generic solution like https://github.com/coleifer/micawber
So, I looked at micawber. And it's awesome and I had never heard of it before. What it does is, it looks at a URL, and if it knows the site where it's pointed at, it will then gather information from it. And using that information it will create for you a HTML fragment so you can embed it in your own HTML page.
And how hard is it to turn that into a reStructuredText directive? NOT HARD AT ALL.
import micawber class Media(Directive): """ Restructured text extension for inserting any sort of media using micawber.""" has_content = False required_arguments = 1 def run(self): providers = micawber.bootstrap_basic() return [nodes.raw('', micawber.parse_text(self.arguments, providers), format='html')]
So now, in Nikola's github master you can do this:
.. media:: http://www.flickr.com/photos/ralsina/7827374994/ ----- .. media:: http://www.youtube.com/watch?v=cEh5cLqxgpA
And get this: