From 24e964de536d0199d47e6ae87247f0df34f01298 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 25 Apr 2003 13:03:50 +0000 Subject: [PATCH] First step to merging fixes. --- imgsizer | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/imgsizer b/imgsizer index 8bcd257..dd8b1cc 100755 --- a/imgsizer +++ b/imgsizer @@ -55,6 +55,12 @@ # # 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 Mar 24 2002 +# +# Fixed a typo and corrected imgsizer for being able to cope with +# single-char html tags just before an -tag. +# except ImportError: import cmp -version = "2.2, 06 September 2001"; +version = "2.4, 25 April 2003"; splash = """imgsizer version %s, Eric S. Raymond See 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: -- 2.43.0