readme.rst 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Summary
  2. ===========
  3. This plug-in:
  4. - Adds a `style="width: ???px; height: auto;"` attribute to any `<img>` tags in the content, by checking
  5. the dimensions of the image file and adding the appropriate `style="width: ???px; height: auto;"` to the `<img>` tag.
  6. - Also finds any `div class="figures"` tags in the content, that contain images and adds the same style to them too.
  7. - If RESPONSIVE_IMAGES setting is true, it adds `style="width: ???px; max-width: 100%; height: auto;"` instead.
  8. - Corrects Alt text: If an img alt attribute = the image filename, it sets it to ""
  9. Assuming that the image is 250px wide, it turns output like this:
  10. <div class="figure">
  11. <img alt="/static/images/image.jpg" src="/static/images/image.jpg" />
  12. <p class="caption">
  13. This is the caption of the figure.
  14. </p>
  15. <div class="legend">
  16. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
  17. tempor incididunt ut labore et dolore magna aliqua.
  18. </div>
  19. </div>
  20. into output like this:
  21. <div class="figure" style="width: 250px; height: auto;">
  22. <img style="width: 250px; height: auto;" alt="" src="/static/images/image.jpg" />
  23. <p class="caption">
  24. This is the caption of the figure.
  25. </p>
  26. <div class="legend">
  27. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
  28. tempor incididunt ut labore et dolore magna aliqua.
  29. </div>
  30. </div>
  31. or this, if RESPONSIVE_IMAGES = True:
  32. <div class="figure" style="width: 250px; max-width: 100%; height: auto;">
  33. <img style="width: 250px; max-width: 100%; height: auto;" alt="" src="/static/images/image.jpg" />
  34. <p class="caption">
  35. This is the caption of the figure.
  36. </p>
  37. <div class="legend">
  38. Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
  39. tempor incididunt ut labore et dolore magna aliqua.
  40. </div>
  41. </div>