]> thyrsus.com Git - imgsizer.git/commitdiff
First step to merging fixes.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 25 Apr 2003 13:03:50 +0000 (13:03 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 25 Apr 2003 13:03:50 +0000 (13:03 +0000)
imgsizer

index 8bcd257899470e3edde081880444d8caf0e6fdff..dd8b1cc3c0b38f2b3de0dd5b46b5025f21632f44 100755 (executable)
--- a/imgsizer
+++ b/imgsizer
 #
 #    Incorporated fixes by Peter S. Galbraith.
 #
+# 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.
+
 import sys, os, getopt, string, re, urllib, commands
 
 # Arrange for both 1.5 and 2.1 compatibility
@@ -62,10 +68,15 @@ 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
 
-version = "2.2, 06 September 2001";
+version = "2.4, 25 April 2003";
 
 splash = """imgsizer version %s, Eric S. Raymond <esr@thyrsus.com>
 See <http://www.tuxedo.org/~esr/software.html> for updates."""
@@ -173,10 +184,10 @@ def imgsize(src):
     sys.stderr.write("imgsizer: couldn't analyze %s\n" % src)
 
 source  = re.compile('SRC="?([^" \t\n]*)"?', re.I)
-awidth  = re.compile(' *WIDTH="?[0-9]*"?', re.I)
-aheight = re.compile(' *HEIGHT="?[0-9]*"?', re.I)
-pwidth  = re.compile('WIDTH="?[0-9]*%"?', re.I)
-pheight = re.compile('HEIGHT="?[0-9]*%"?', re.I)
+awidth  = re.compile(r' *WIDTH\s*=\s*"?[0-9]*"?', re.I)
+aheight = re.compile(r' *HEIGHT\s*=\s*"?[0-9]*"?', re.I)
+pwidth  = re.compile(r'WIDTH\s*=\s*"?[0-9]*%"?', re.I)
+pheight = re.compile(r'HEIGHT\s*=\s*"?[0-9]*%"?', re.I)
 
 def transform(attr):
     src = source.search(attr)
@@ -188,7 +199,7 @@ def transform(attr):
     # Correct the url for documentation root, if present
     url = src.group(1)
     if url[0] == '/' and root:
-        url = os.path.join(root, url)
+        url = os.path.join(root, url[1:])
     # OK, get the size tuple if possible
     dimensions = imgsize(url)
     if not dimensions: