[Zope-dev] DTML block parsing

Casey Duncan cduncan@kaivo.com
Tue, 23 Jan 2001 10:10:55 -0700


Casey Duncan wrote:
> 
> Steve Alexander wrote:
> > With your patch applied, will nested dtml-comment tags still work?
> >
> > <dtml-comment>
> >    Some code commented out
> >      <dtml-comment>
> >        Documentation in a comment
> >      </dtml-comment>
> >    Rest of code commented out
> > </dtml-comment>
> >
> > --
> > Steve Alexander
> > Software Engineer
> > Cat-Box limited
> > http://www.cat-box.net
> 
> In present form no. It also does not support block continuation tags.
> 
> I will see what I can do about this.

OK, I have developed a new patch that almost completely fixes this
issue. In fact I am happier with it in general than my first patch.
There is only one flaw, although you can nest comments inside of one
another, and you can have any manner of broken dtml inside, if you open
another comment tag inside it, it must be properly balanced or you will
get a parse error. Here are some examples:

These do not generate errors with my new patch:
<dtml-comment>
	<dtml-if blah>
</dtml-comment>

<dtml-comment>
	</dtml-with>
</dtml-comment>

<dtml-comment>
	<dtml-asdfsadf>
</dtml-comment>

<dtml-comment>
	<dtml-comment>
		Blah Blah
	</dtml-comment>
</dtml-comment>

These do:

<dtml-comment>
	<dtml-comment>
</dtml-comment>

<dtml-comment>
	<dtml-if foo>
		<dtml-comment>
	</dtml-if>
	</dtml-comment>
</dtml-comment>

I am a bit concerned that <dtml-comment> should ever generate errors at
all, but this is certainly an improvement. Anybody have any thoughts?
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>