getpelican/pelican-plugins — pull request #20 by dflock (2013-04-23 23:52:19+00:00)
Title: New plugin: Improved Figures & Images

I added a new plugin that improves `` and `

` elements. It currently adds `style="width: ???px"` to both, based of the actual dimensions of the image file.

This plugin:

- Adds a style="width: ???px;" to each image in the content
- Also adds the width of the contained image to any parent div.figures.

It requires Pillow/PILL and BeautifulSoup4.

It's tested and seems to work well and allows much better CSS styling of figures in particular. There is test input and example output in the /test_data folder, but alas no automated/unit test yet.

I'm new to Pelican and this is also my first pelican plugin, so I'm sure it could be much better - indeed there may be a much better way to achieve this in Pelican in a different way, but this seemed like the most obvious way at the time.

If you want changes before merging, or know of a much better way, please let me know!

Thanks,
Dunc