rstgen.sphinxconf.sigal_image

Defines the sigal_image directive.

.. sigal_image::

This creates a bridge between a photo collection managed with Shotwell or digiKam and a blog generated with Sphinx. All photos remain in the single central file tree managed by Shotwell or digiKam. From within Shotwell or digiKam you use a tag “blog” to mark all photos that are to be available for your Sphinx blog. Then you use picsel to extract those images to a separate directory. This tree serves as input for Sigal which will generate a static html gallery. An example of a Sigal gallery is here. The sigal_image directive was the last missing part of this publishing bridge: it allows you to integrate your pictures into blog entries.

Usage:

.. sigal_image:: partial/path/to/photo.jpg[|title_or_options]

For example, if sigal_base_url in your conf.py is set to "http://sigal.saffre-rumma.net", the following directive in your rst source file:

.. sigal_image:: 2014/04/10/img_6617.jpg

will insert the following rst code:

.. raw:: html

  <a href="http://sigal.saffre-rumma.net/2014/04/10/img_6617.jpg">
  <img
  src="http://sigal.saffre-rumma.net/2014/04/10/thumbnails/img_6617.jpg"/>
</a>

The file name can contain formatting instructions inspired by Wikipedia pictures which uses a variable number of pipe characters. For example:

>>> print(line2html("foo.jpg"))
<a href="http://example.com/foo.jpg"  data-lightbox="image-1" data-title="foo.jpg"/><img src="http://example.com/thumbnails/foo.jpg" style="padding:4px; height:30ex" title="foo.jpg"/></a>
>>> print(line2html("foo.jpg|This is a nice picture"))
<a href="http://example.com/foo.jpg"  data-lightbox="image-1" data-title="This is a nice picture"/><img src="http://example.com/thumbnails/foo.jpg" style="padding:4px; height:30ex" title="This is a nice picture"/></a>
>>> print(line2html("foo.jpg|thumb|This is a nice picture"))
<a href="http://example.com/foo.jpg"  data-lightbox="image-1" data-title="This is a nice picture"/><img src="http://example.com/thumbnails/foo.jpg" style="padding:4px; float:right; height:30ex" title="This is a nice picture"/></a>
>>> print(line2html("foo.jpg|thumb|left|This is a nice picture"))
<a href="http://example.com/foo.jpg"  data-lightbox="image-1" data-title="This is a nice picture"/><img src="http://example.com/thumbnails/foo.jpg" style="padding:4px; float:left; height:30ex" title="This is a nice picture"/></a>
>>> print(line2html("foo.jpg|wide|This is a wide picture"))
<a href="http://example.com/foo.jpg"  data-lightbox="image-1" data-title="This is a wide picture"/><img src="http://example.com/thumbnails/foo.jpg" style="padding:4px; width:100%" title="This is a wide picture"/></a>
>>> print(line2html("foo.jpg | thumb | left | This is a nice picture"))
<a href="http://example.com/foo.jpg"  data-lightbox="image-1" data-title="This is a nice picture"/><img src="http://example.com/thumbnails/foo.jpg" style="padding:4px; float:left; height:30ex" title="This is a nice picture"/></a>

The generated HTML also includes attributes for lightbox. In order to activate this feature you must add the content of the lighbox dist directory somewhere to your web server and then change your layout.html template to something like this:

{%- block extrahead %}
  {{ super() }}
<script src="/data/lightbox/js/lightbox-plus-jquery.min.js"></script>
<link href="/data/lightbox/css/lightbox.css" rel="stylesheet" />
{% endblock %}

Functions

buildurl(*parts)

line2html(name[, buildurl])

parse_image_spec(caption, **context)

setup(app)

Classes

Duo(caption, **context)

Format(caption, **context)

SigalImage(name, arguments, options, ...)

Solo(caption, **context)

Standard(caption, **context)

Thumb(caption, **context)

Tiny(caption, **context)

Trio(caption, **context)

Wide(caption, **context)

rstgen.sphinxconf.sigal_image.parse_image_spec(caption, **context)

Parse an image specification that can contain optional formatting instructions inspired by Wikipedia pictures, which uses a variable number of pipe characters.

This is also being used by lino.modlib.uploads. See cms1 : a content management system