]> thyrsus.com Git - imgsizer.git/commitdiff
Version 2.4.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 25 Apr 2003 13:12:30 +0000 (13:12 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 25 Apr 2003 13:12:30 +0000 (13:12 +0000)
imgsizer

index dd8b1cc3c0b38f2b3de0dd5b46b5025f21632f44..6cd8e2716b636e123dce3f29de711048271468de 100755 (executable)
--- a/imgsizer
+++ b/imgsizer
@@ -57,9 +57,9 @@
 #
 # Fixes by EST, 25 April 2003
 #
-#    Merge Lennart Poettering's fix for Debian bug 139714.
-#    Merged an amended version of Jeron Jeroen N. Witmond's
-#    fix for Debian bug 168964.
+#    Merged amended versions of Lennart Poettering's fix for Debian bug 139714.
+#    and Jeroen N. Witmond's fix for Debian bug 168964.  Added regression-test
+#    production.
 
 import sys, os, getopt, string, re, urllib, commands
 
@@ -68,11 +68,6 @@ try:
     import filecmp
     cmp = filecmp
     del filecmp
-# Modified by Lennnart Poettering <mz696d6773697a6572@poettering.de> Mar 24 2002
-#
-#    Fixed a typo and corrected imgsizer for being able to cope with
-#    single-char html tags just before an <img>-tag.
-#
 except ImportError:
     import cmp
 
@@ -122,12 +117,13 @@ def sizefix(infp, outfp):
         outfp.write(ch)
         if ch == '<':
             # within an HTML tag
-            lead = infp.read(3)
-            if ch == '':
-                return
+            lead = infp.read(2)
             outfp.write(lead)
-            if string.find(lead, '>') > -1:
+            if not lead in ("im", "IM"):
                 continue
+            # splitting the read this way copes with single-char tags like <b>
+            lead = lead + infp.read(1)
+            outfp.write(lead[-1])
             if not lead in ("img", "IMG"):
                 continue
             # within an image tag