At 21:15 13/07/99 , bruce@perens.com wrote:
However, I found this method constraining in that I could not add attributes such as "BORDER=0" to the tag. This patch adds a more versatile tag() method to Image. Arguments to the tag() method can be any of the usual IMG attributes. Defaults are provided for height and width (again, set from the image file) and For example:
Wonderful! A few comments: - I cannot remove the alt, width or height attrinutes. Yes, this is sometimes necessary. - Attributes are not quoted, except src and alt. This is needed with width and height when using percentages. Quotes are generally a good idea, even if the HTML spec says they are optional. Attached patch (against the latest CVS), solves these points. I changed addition of the alt attribute to conditional, and added quoting for all tags. I also changed the way alt, width and height are defaulted. The code now checks wether they are equal to None, so you can do things like: imagename.tag(alt='', width='', height='') to get an IMG tag without any alt, width or height attributes. -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------