[MRG?] DOC show referring examples on API reference pages

This places an example gallery on each API reference (class, function) page. Currently this is at the end of the page. It might be nicer for this to appear under the "examples" section, but that is much harder to implement (except perhaps by Javascript/DOM games). The intention is that this should provide a manual of examples for a particular class in many cases, such that, for example, the use of `PCA.components_` should be more obvious (cf. #3322).

The CSS/Javascript/Python that makes the example galleries work is a bit of a mess, but I'm only cleaning it up minimally in this PR.
I've made it exact anyway, as I think it makes the code easier to read.