atelier.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:

>>> from __future__ import print_function
>>> 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; width:280px;" 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; width:280px;" 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; width:280px;" 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;; width:280px;" 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 %}

(This module’s source code is available here.)

Functions

buildurl(*parts)

line2html(name[, buildurl])

setup(app)

Classes

Format()

SigalImage(name, arguments, options, …)

Thumb()

Wide()