Selaa lähdekoodia

Updated readme to reflect current behavior; removed old code

Duncan Lock 11 vuotta sitten
vanhempi
commit
bd3934a49a

+ 1 - 11
better_figures_and_images/better_figures_and_images.py

@@ -6,7 +6,7 @@ This plugin:
 
 - Adds a style="width: ???px; height: auto;" to each image in the content
 - Also adds the width of the contained image to any parent div.figures.
-    - If RESPONSIVE_IMAGES == True, adds style="max-width: 100%; height: auto;" instead
+    - If RESPONSIVE_IMAGES == True, adds style="width: ???px; max-width: 100%; height: auto;" instead
 - Corrects alt text: if alt == image filename, set alt = ''
 
 TODO: Need to add a test.py for this plugin.
@@ -27,16 +27,6 @@ def content_object_init(instance):
         content = instance._content
         soup = BeautifulSoup(content)
 
-        # if '<object type="image/svg+xml"' in content:
-        #     for obj in soup('object'):
-        #         extra_style = 'max-width: 100%;'
-        #         fig = obj.find_parent('div', 'figure')
-        #         if fig:
-        #             if obj.get('style'):
-        #                 obj['style'] += extra_style
-        #             else:
-        #                 obj['style'] = extra_style
-
         if 'img' in content:
             for img in soup('img'):
                 # TODO: Pretty sure this isn't the right way to do this, too hard coded.

+ 4 - 4
better_figures_and_images/readme.rst

@@ -3,10 +3,10 @@ Summary
 
 This plug-in:
 
-- Adds a `style="width: ???px;"` attribute to any `<img>` tags in the content, by checking
+- Adds a `style="width: ???px; height: auto;"` attribute to any `<img>` tags in the content, by checking
 the dimensions of the image file and adding the appropriate `style="width: ???px; height: auto;"` to the `<img>` 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="max-width: 100%; height: auto;"` instead.
+- 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 = the image filename, it sets it to ""
 
 
@@ -38,8 +38,8 @@ into output like this:
 
 or this, if RESPONSIVE_IMAGES = True:
 
-	<div class="figure" style="max-width: 100%; height: auto;">
-	    <img style="max-width: 100%; height: auto;" alt="" src="/static/images/image.jpg" />
+	<div class="figure" style="width: 250px; max-width: 100%; height: auto;">
+	    <img style="width: 250px; max-width: 100%; height: auto;" alt="" src="/static/images/image.jpg" />
 	    <p class="caption">
 	        This is the caption of the figure.
 	    </p>