[Pelican] Add YouTube Embed Directive

After adding Gist support for Pelican, what is next? YouTube of course! Using HTML tag in reStructuredText just because we want embed YouTube video in our article really sucks, and it make the source code file looks ugly.

Why not create a youtube directive? Here is it, just modifiy pelican/rstdirective.py and add the following code into it. You will have a nice reStructuredTex directive to embed YouTube videos.

As usual, I've put this code on my Pelican fork, you could install it directly by using the following command:

# pip uninstall pelican
# pip install git+http://brianhsu@github.com/brianhsu/pelican.git#egg=pelican

After you either add the code manually or install it by using pip, you could embed YouTube video by using the following directive.

In this directive, you need to specify the YouTube video ID (which could be get from the video URL). width, height and align are optional. width and height could be any integer, and align have to be one of left, center, right.

.. youtube:: dfI_DnGazwg
   :width: 480
   :height: 320
   :align: center

By using the above directive, you will get the following embed YouTube video.

回響