On 11/06/13 09:37, Christian Weiske wrote:

I'd like to add an image gallery in HTML from a rST document.
The "gallery" is basically a list of image thumbnails beside each other
that can be clicked to open the original (large) image.

I thought about giving each image in the gallery a "gallery" field, as

.. image:: picture1.jpeg
  :gallery: 1
.. image:: picture2.jpeg
  :gallery: 1
.. image:: picture3.jpeg
  :gallery: 2
This would put pic1 + 2 in one gallery, and 3 in a separate one.

This would only work with a custom renderer of course, since the
gallery field is not supported anywhere.

I see two problems with this:

1. Since the "gallery" field is not supported by standard renderers,
   this is not backward-compatible
2. The renderer does not get notified when the gallery begins, and when
   it ends.

Do you people know of existing rST markup to do image galleries? If
not, what would be the best way (markup-wise) to get them?

Use a custom directive, it's much easier than a custom writer :-)

For example: