Austin Dworaczyk Wiltshire 3d48c68594 Better Images: Prevent errors when RESPONIVE_IMAGES is not set. 9 gadi atpakaļ
..
test_data 9201d51d33 improved examples 11 gadi atpakaļ
__init__.py b998ad60e0 Updated to cope with multiple images and figures, and to deal with indivdual images. 11 gadi atpakaļ
better_figures_and_images.py 3d48c68594 Better Images: Prevent errors when RESPONIVE_IMAGES is not set. 9 gadi atpakaļ
readme.rst abd850a76f Correct list and code samples formatting 10 gadi atpakaļ

readme.rst

Requirements
------------

* pip install pillow beautifulsoup4

Summary
=======

This plug-in:

- Adds a ``style="width: ???px; height: auto;"`` attribute to any ```` tags in the content, by checking the dimensions of the image file and adding the appropriate ``style="width: ???px; height: auto;"`` to the ```` tag.

- Also finds any ``div class="figures"`` tags in the content, that contain images and adds the same style to them too.

- If ``RESPONSIVE_IMAGES`` setting is true, it adds ``style="width: ???px; max-width: 100%; height: auto;"`` instead.

- Corrects Alt text: If an img ``alt`` attribute equals the image filename, it sets it to ""


Assuming that the image is 250px wide, it turns this::


/static/images/image.jpg


This is the caption of the figure.



Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.



into this::




This is the caption of the figure.



Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.



or this, if ``RESPONSIVE_IMAGES = True``::




This is the caption of the figure.



Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.