On Sat, Jun 23, 2001 at 01:07:27AM +0800, Stas Bekman wrote: > Is the design doc open for discussion or do you regret you've sent this > URL at this busy time :)
It's totally open for discussion, suggestions, comments, etc. I can't guarantee I'll read or reply to it straight away, but if it's posted to the list then I will at least read it at some point in the future. > I was looking at http://www.tt2.org/v3/design.html#directives TEXT > directive. How is it going to parse this text: > > [% mytext = TEXT %] > This is some text. It can contain [% directives %] > but they are ignored. It is always processed as if > via INSERT. However, it may be a requirement > that the content is syntactically correct... for example you > cannot just leave [% FOR i = [1..2] %] without inserting the > closing directive. > [% END %] > > the closing directive is intentionally skipped :) I suppose that this is > what the 'syntactically correct' comment is about. Yep. I can install a parser handler to parse a block (e.g. from TEXT to END) that doesn't compile the directives embedded within but simply returns the directive text. When a directive is encountered that starts a new block (e.g. FOR), then the handler increments a counter. When it identifies an END, it decrements that same counter. When it reaches 0, it's the end of the TEXT block. So yes, you have to have balanced directives. I think this directive might be unnecessary as there are better ways to acheive the above: [% TAGS star %] [* mytext = BLOCK *] blah blah [% FOREACH not a problem %] etc [* END *] In v3, it will also be possible to inspect the parser START_TAG and END_TAG values, allowing you to re-create directives if you need to: [% mytext = BLOCK %] blah blah [% PARSER.START_TAG %] FOREACH not a problem [% PARSER.END_TAG %] [% END %] Maybe also a method to recreate a directive using the current START_TAG and END_TAG values? [% mytext = BLOCK %] blah blah [% PARSER.DIRECTIVE('FOREACH not a problem') %] etc A -- Andy Wardley <[EMAIL PROTECTED]> Signature regenerating. Please remain seated. <[EMAIL PROTECTED]> For a good time: http://www.kfs.org/~abw/
