I am sufficiently happy with my second patch to post it here for any
takers. It should be applied to 2.3.0b2 or 2.3.0b1. It *has not* been
tested against 2.2.5.
The new patch supports nested comments so long as they are properly
balanced inside the comment.
As with my first patch it also allows you to create a custom DTML block
tag that contains something other than valid DTML code. It now should
support block continuation tages as well, although this had not been
tested completely.
Patch files are attached. Enjoy.
--
| Casey Duncan
| Kaivo, Inc.
| [EMAIL PROTECTED]
`-->
*** DT_String.py~ Tue Dec 12 14:20:25 2000
--- DT_String.pyWed Jan 24 08:22:11 2001
***
*** 272,313
sname=stag
sstart=start
sa=sargs
! while 1:
l=tagre.search(text,start)
if l < 0: self.parse_error('No closing tag', stag, text, sloc)
try: tag, args, command, coname= self._parseTag(tagre,scommand,sa)
! except ParseError, m: self.parse_error(m[0],m[1], text, l)
!
! if command:
! start=l+len(tag)
! if hasattr(command, 'blockContinuations'):
! # New open tag. Need to find closing tag.
! start=self.parse_close(text, start, tagre, tag, l,
!command, args)
else:
! # Either a continuation tag or an end tag
! section=self.SubTemplate(sname)
! section._v_blocks=section.blocks=self.parse(text[:l],sstart)
! section._v_cooked=None
! blocks.append((tname,sargs,section))
! start=self.skip_eol(text,l+len(tag))
! if coname:
! tname=coname
! sname=tag
! sargs=args
! sstart=start
! else:
! try:
! r=scommand(blocks)
! if hasattr(r,'simple_form'): r=r.simple_form
! result.append(r)
! except ParseError, m: self.parse_error(m[0],stag,text,l)
! return start
parse_close__roles__=()
def parse_close(self, text, start, tagre, stag, sloc, scommand, sa):
--- 272,324
sname=stag
sstart=start
sa=sargs
! # Determine if the tag wants dtml parsing
! parse_dtml = not hasattr(scommand, 'disable_dtml_block_parsing')
+ while 1:
l=tagre.search(text,start)
if l < 0: self.parse_error('No closing tag', stag, text, sloc)
try: tag, args, command, coname= self._parseTag(tagre,scommand,sa)
! except ParseError, m:
! if parse_dtml: self.parse_error(m[0],m[1], text, l)
! else: start = l + 1 # Not parsing DTML: Skip malformed tags
else:
! if command:
! start=l+len(tag)
! if hasattr(command, 'blockContinuations'):
! # New open tag. Need to find closing tag.
! try: start=self.parse_close(text, start, tagre, tag, l,
! command, args)
! except:
! if parse_dtml: raise
! else:
! # Either a continuation tag or an end tag
! if parse_dtml:
! section=self.SubTemplate(sname)
! section._v_blocks=section.blocks=self.parse(text[:l],sstart)
! else:
! section = String(text[sstart:l], __name__=sname)
! section._v_blocks = section.blocks = [section.raw]
!
! section._v_cooked=None
! blocks.append((tname,sargs,section))
! start=self.skip_eol(text,l+len(tag))
! if coname:
! tname=coname
! sname=tag
! sargs=args
! sstart=start
! else:
! try:
! r=scommand(blocks)
! if hasattr(r,'simple_form'): r=r.simple_form
! result.append(r)
! except ParseError, m: self.parse_error(m[0],stag,text,l)
! return start
parse_close__roles__=()
def parse_close(self, text, start, tagre, stag, sloc, scommand, sa):
*** DT_Var.old Mon Jan 22 15:27:30 2001
--- DT_Var.py Mon Jan 22 15:28:14 2001
***
*** 461,466
--- 461,467
'''
name='comment'
blockContinuations=()
+ disable_dtml_block_parsing = 1
def __init__(s