#
# 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
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."""
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)
# 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: