*** DT_HTML.py.~1~ Tue Dec 22 17:23:59 1998 --- DT_HTML.py Thu Jan 28 18:14:12 1999 *************** *** 104,121 **** from string import strip, find, split, join, rfind class dtml_re_class: ! def search(self, text, start=0, name_match=regex.compile('[\0- ]*[a-zA-Z]+[\0- ]*').match, end_match=regex.compile('[\0- ]*\(/\|end\)', regex.casefold).match, ): s=find(text,'',s) ! if e < 0: return e ! n=s+5 l=end_match(text,n) if l > 0: end=strip(text[n:n+l]) --- 104,145 ---- from string import strip, find, split, join, rfind class dtml_re_class: ! # Note this class has been modified to support the proposed XML-style ! # syntax for DTML, which I've termed ZTML :-) def search(self, text, start=0, name_match=regex.compile('[\0- ]*[a-zA-Z]+[\0- ]*').match, end_match=regex.compile('[\0- ]*\(/\|end\)', regex.casefold).match, ): + + style = 0 # 0=Traditional, 1=XML-flavor + + # Try and find the start of a traditional DTML tag s=find(text,'',s) ! if e < 0: return e ! else: # XML-flavor ! e=find(text,'?>',s) ! if e < 0: return e ! ! # n = noise at the front ! if style == 0: ! n=s+5 ! else: ! n=s+8 ! # See if it's the end of something l=end_match(text,n) if l > 0: end=strip(text[n:n+l]) *************** *** 130,142 **** args=strip(text[a:e]) d=self.__dict__ ! d[0]=text[s:e+3] d[1]=end d['end']= end d[2]=name d['name']=name d[3]=args d['args']=args return s --- 154,170 ---- args=strip(text[a:e]) d=self.__dict__ ! if style == 0: # Traditional ! d[0]=text[s:e+3] ! else: # XML-flavor ! d[0]=text[s:e+2] d[1]=end d['end']= end d[2]=name d['name']=name d[3]=args d['args']=args + d['style']=style # Fit the style in there for later use return s