From 525dedb96b43ce87e00a842c51a3b24f8877e71e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 1 Dec 2017 11:33:07 +0100 Subject: [PATCH] m.images: don't freak out if there's no EXIF. Instead it just doesn't display anything as a caption. --- doc/plugins/images-test.rst | 6 ++++++ doc/plugins/images.rst | 8 ++++---- doc/static/tiny.png | Bin 0 -> 81 bytes pelican-plugins/m/images.py | 36 +++++++++++++++++++++++++----------- 4 files changed, 35 insertions(+), 15 deletions(-) create mode 100644 doc/static/tiny.png diff --git a/doc/plugins/images-test.rst b/doc/plugins/images-test.rst index cea68ab8..e3c49f47 100644 --- a/doc/plugins/images-test.rst +++ b/doc/plugins/images-test.rst @@ -81,3 +81,9 @@ Image grid, inflated: {filename}/static/flowers.jpg {filename}/static/ship.jpg + +Image grid with a PNG file: + +.. image-grid:: + + {filename}/static/tiny.png diff --git a/doc/plugins/images.rst b/doc/plugins/images.rst index 24570008..7cf64e63 100644 --- a/doc/plugins/images.rst +++ b/doc/plugins/images.rst @@ -125,10 +125,10 @@ option for both images and figures. Use the :rst:`.. image-grid::` directive for creating `image grid <{filename}/css/components.rst#image-grid>`_. Directive contents are a list of image URLs, blank lines separate grid rows. The plugin -automatically extracts size information and scales the images accordingly, in -addition EXIF properties such as aperture, shutter speed and ISO are extracted -and displayed in the caption on hover. The images are also made clickable, the -target is the image file itself. +automatically extracts size information and scales the images accordingly. If +the image has EXIF information, properties such as aperture, shutter speed and +ISO are extracted and displayed in the caption on hover. The images are also +made clickable, the target is the image file itself. Example of a two-row image grid is below. Sorry for reusing the same two images all over (I'm making it easier for myself); if you want to see a live example diff --git a/doc/static/tiny.png b/doc/static/tiny.png new file mode 100644 index 0000000000000000000000000000000000000000..cacab704188f9c4c676ab8105add4bec7fc875bd GIT binary patch literal 81 zcmeAS@N?(olHy`uVBq!ia0vp^%s|Y in case there's a caption + if caption: + text_nodes, _ = self.state.inline_text(caption, self.lineno) + text_node = nodes.paragraph('', '', *text_nodes) + overlay_node = nodes.caption() + overlay_node.append(text_node) + + # Otherwise an empty
+ else: overlay_node = nodes.container() + link_node = nodes.reference('', refuri=image_reference) link_node.append(image_node) link_node.append(overlay_node) -- 2.30.2