My script bin/series.sh was conceived to automatically play the next episode for your current TV show,
and it uses a ~/current file to know which folder to use.
We can use it to display the TV show I am currently watching:

In the Sphinx configuration file, conf.py,
we can easily add shortcuts to use this runblock extension with other languages.

First, we have to create an empty dictionary called autorun_languages:

autorun_languages={}

Then, add a value truc (which has to be a valid command-line program, like gnuplot or ocaml)
and truc_prefix_chars (size of the prefix)
to enable a new directive ..code-block::truc in all your reStructuredText document (in this project only):

# Add these two lines in your 'conf.py' fileautorun_languages['ocaml']=u'ocaml -stdin'autorun_languages['ocaml_prefix_chars']=2autorun_languages['ocaml_input_language']='utf_8'autorun_languages['ocaml_output_language']='utf_8'

This runblock extension uses the great pygments Python library to color the code.

Sometimes, I have seen the pygments or pygmentize command-line tool break completely,
and the only bugfix I found was to manually delete the « experimental » support of pkg_resources
in the pygments file plugin.py,
by manually forcing pkg_resources=None
(at line 41).
It’s durty, but it fixes my bug…