--- /usr/home/peter/devel/HTMLgen/HTMLgen.py Wed Apr 21 04:56:50 1999 +++ /usr/lib/HTMLgen/HTMLgen.py Thu Dec 20 22:02:46 2001 @@ -56,7 +56,7 @@ TupleType = type((1,2)) InstanceType = type(UserList.UserList()) CONTYPE = 'Content-Type: text/html\n\n' -DOCTYPE = '\n\n' +DOCTYPE = '' PRINTECHO = 1 @@ -287,7 +287,7 @@ s.append('\n \n' \ % (self.stylesheet, self.stylesheet)) if self.style: - s.append('\n\n' % self.style) + s.append('\n\n' % self.style) if self.script: # for javascripts if type(self.script) in (TupleType, ListType): for script in self.script: @@ -1611,7 +1611,7 @@ s.append('\n') s.append('\n') #close table - s.append('

\n') + s.append('\n') return string.join(s, '') def get_body_color(self, colors, i): diff -ur HTMLgen.org/HTMLcalendar.py HTMLgen/HTMLcalendar.py --- HTMLgen.org/HTMLcalendar.py Wed Feb 24 05:31:03 1999 +++ HTMLgen/HTMLcalendar.py Sat Sep 15 23:48:02 2001 @@ -212,12 +212,12 @@ return value else: raise TypeError, ('cannot convert to int', value) -import regex -datepat = regex.compile('^ *\([0-9*][0-9]?\)[/-]' #first 2 char date field +import re +datepat = re.compile('^ *\([0-9*][0-9]?\)[/-]' #first 2 char date field '\([0-9][0-9]?\)[/-]?' #second 2 char date field '\([12][0-9][0-9][0-9]\)?[ \t]*:') #optional year field -daypat = regex.compile('^ *\('+string.join(day_name,'\|')+'\)') -timepat = regex.compile('\([0-9][0-9]?\):\([0-9][0-9]\)') +daypat = re.compile('^ *\('+string.join(day_name,'\|')+'\)') +timepat = re.compile('\([0-9][0-9]?\):\([0-9][0-9]\)') def read_appt_file(filename): """Parsing function. diff -ur HTMLgen.org/HTMLtest.py HTMLgen/HTMLtest.py --- HTMLgen.org/HTMLtest.py Sun Apr 26 19:55:50 1998 +++ HTMLgen/HTMLtest.py Sat Sep 15 23:52:17 2001 @@ -2,7 +2,7 @@ """Test script which generates the online documentation for HTMLgen. """ -import string, regex, regsub, os, time, glob +import string, re, os, time, glob from HTMLcolors import * from HTMLgen import * import HTMLgen #only so I can pick off the __version__ @@ -232,11 +232,11 @@ doc.email = 'jefferson@montecello.virginia.gov' doc.logo = ('../image/eagle21.gif', 64, 54) # parse Declaration of Independence - re_hline = regex.compile('^--+$') - re_title = regex.compile('^Title:\(.*$\)') + re_hline = re.compile('^--+$') + re_title = re.compile('^Title:\(.*$\)') font2 = Font(size='+2') s = open(os.path.join(datadir, 'DoI.txt')).read() - paragraphs = regsub.split(s, '\n\([\t ]*\n\)+') + paragraphs = re.split(s, '\n\([\t ]*\n\)+') for para in paragraphs: if not para: continue if re_title.search(para) > -1: @@ -247,7 +247,7 @@ p = Paragraph( para ) # using \` to match beginning of paragraph # ^ won't work because it'll match all the newlines - n = p.markup('\`\(\w\)', font2, reg_type='regex') + n = p.markup('\`\(\w\)', font2, reg_type='re') doc.append(p) doc.write(os.path.join(htmldir, filename)) @@ -263,7 +263,7 @@ #Ok parse that file f = open(mpath(os.path.join(datadir, 'parrot.txt'))) line = f.readline() - re_dialog = regex.compile('\(^[OC].*:\)\(.*\)') + re_dialog = re.compile('\(^[OC].*:\)\(.*\)') while line: if re_dialog.search(line) > -1: role, prose = re_dialog.group(1,2) diff -ur HTMLgen.org/HTMLutil.py HTMLgen/HTMLutil.py --- HTMLgen.org/HTMLutil.py Thu May 28 22:26:59 1998 +++ HTMLgen/HTMLutil.py Sat Sep 15 23:45:46 2001 @@ -19,7 +19,7 @@ # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR # PERFORMANCE OF THIS SOFTWARE. __version__ = '$Id: HTMLgen.patch,v 1.2 2001/12/22 15:27:36 astrand Exp $' -import string, regex, os +import string, re, os import HTMLgen, HTMLcolors from types import * @@ -79,7 +79,7 @@ """Determine if the text have been marked by a previous gsub. (ugly hack but it works) """ - if regex.search('\( -1: + if re.search('\( -1: return 1 else: return 0 @@ -125,13 +125,13 @@ not_backslash = "[^\\\\]" triple_single = "'''" triple_double = '"""' -_doc_start_re = regex.compile( +_doc_start_re = re.compile( "\(^\|" + not_backslash + "\)" # bol or not backslash + "\(" + triple_single + "\|" + triple_double + "\)" ) single_re = not_backslash + triple_single double_re = not_backslash + triple_double -_triple_re = { triple_single : regex.compile(single_re), - triple_double : regex.compile(double_re) } +_triple_re = { triple_single : re.compile(single_re), + triple_double : re.compile(double_re) } del not_backslash, triple_single, triple_double, \ single_re, double_re @@ -150,13 +150,13 @@ return (None, None) return startquote, quotefinder.regs[0][1] -string_re = regex.compile('\(\(\'[^\'\n]*\'\)\|\("[^"\n]"\)\)') +string_re = re.compile('\(\(\'[^\'\n]*\'\)\|\("[^"\n]"\)\)') def find_string_literal( s, begin=0 ): if string_re.search(s, begin) > -1: return string_re.regs[1] return (None, None) -comment_re = regex.compile('#.*$') +comment_re = re.compile('#.*$') def find_comment( s, begin=0 ): while comment_re.search(s, begin) > -1: if been_marked(comment_re.group(0)): @@ -166,13 +166,13 @@ return (None, None) Name = '[a-zA-Z_][a-zA-Z0-9_]*' -func_re = regex.compile('\(^[ \t]*def[ \t]+' +Name+ '\)[ \t]*(') +func_re = re.compile('\(^[ \t]*def[ \t]+' +Name+ '\)[ \t]*\(') def find_function( s, begin=0 ): if func_re.search(s, begin) > -1: return func_re.regs[1] return (None, None) -class_re = regex.compile('\(^[ \t]*class[ \t]+' +Name+ '\)[ \t]*[(:]') +class_re = re.compile('\(^[ \t]*class[ \t]+' +Name+ '\)[ \t]*[(:]') def find_class( s, begin=0 ): if class_re.search(s, begin) > -1: return class_re.regs[1] diff -ur HTMLgen.org/ImagePaletteH.py HTMLgen/ImagePaletteH.py --- HTMLgen.org/ImagePaletteH.py Wed Apr 21 04:46:16 1999 +++ HTMLgen/ImagePaletteH.py Sat Sep 15 23:43:32 2001 @@ -21,6 +21,7 @@ import jarray jpython = 1 import ImageH +from whrandom import randint class ImagePalette: "Colour palette for palette mapped images" @@ -70,7 +71,6 @@ return ImagePalette(mode, palette * len(mode)) def random(mode = "RGB"): - from whrandom import randint palette = map(lambda a: randint(0, 255), [0]*256*len(mode)) return ImagePalette(mode, palette)