[Zope] <dtml-comment> doesn't? Please fix... ;-)

Doug Hellmann Doug.Hellmann@ZapMedia.com
Mon, 04 Sep 2000 10:52:33 -0400


This is a multi-part message in MIME format.
--------------97BB5A0A2694CC5D2822DB68
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

I missed the beginning of this thread, so I'm not sure if this will
help.

I've attached a patch file which will add a DTML-commentline tag.  This
is different from the standard DTML-comment in that it does not require
an end tag.  Here's an example of its use:

<ul>
<dtml-commentline <dtml-in "PARENTS[1].objectValues()" sort=id>
<li><dtml-var title_or_id>
<dtml-commentline </dtml-in>
</ul>

This segment prints the 'title_or_id' for the current method, and does
not execute the loop.  Obviously the DTML-in syntax isn't correct, but
that's part of how the commentline tag works.  It eats up everything in
its own <> markers, and allows the DTML parser to ignore it.  It *does
not* go all the way to the end of the input line, as the name might
imply.

Doug


Chris Withers wrote:
> 
> Andrew Kenneth Milton wrote:
> > | What's wrong with that?
> >
> > It's wrong :-)
> >
> > <dtml-comment>
> > crap
> > more crap
> > <dtml-comment>
> > Lots of crap
> > </dtml-comment>
> > </dtml-comment>
> >
> > In order to parse that fragment, you need to parse the blocks in case you
> > find another opening block, so that you can recursively process comments.
> 
> Yeah, fair point...
> 
> > | > It doesn't look difficult to provide what you want, but, I'm not motivated
> > | > enough to fix it either at this stage. d8)
> > |
> > | Aww... go on, you know you want to really ;-)
> >
> > Now you know the problem domain, it shouldn't be hard for you to create
> > a cut-down equivalent of the DT_String parser that only parses comment blocks.
> 
> You obviously have a better understanding of DT_String than me and so
> would be much better suited to the task ;-)
> 
> Good luck, we're all rootin' for ya :P
> 
> Chris
> 
> PS:
> > Take you less time than writing these emails I'm sure d;)
> Er... no!
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
--------------97BB5A0A2694CC5D2822DB68
Content-Type: text/plain; charset=us-ascii;
 name="comment_line.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="comment_line.patch"

Index: DT_String.py
===================================================================
RCS file: /cvs-repository/Zope2/lib/python/DocumentTemplate/DT_String.py,v
retrieving revision 1.38
diff -r1.38 DT_String.py
91c91
< from DT_Var import Var, Call, Comment
---
> from DT_Var import Var, Call, CommentLine, Comment
143a144
>         'commentline': CommentLine,
Index: DT_Var.py
===================================================================
RCS file: /cvs-repository/Zope2/lib/python/DocumentTemplate/DT_Var.py,v
retrieving revision 1.36
diff -r1.36 DT_Var.py
448c448
< class Comment:
---
> class CommentLine:
462,463c462
<     name='comment'
<     blockContinuations=()
---
>     name='commentline'
470a470,473
> 
> class Comment(CommentLine):
>     name='comment'
>     blockContinuations=()

--------------97BB5A0A2694CC5D2822DB68--