logo       

Re: Custom Directive Delimiter: msg#00047

python.cheetah

Subject: Re: Custom Directive Delimiter

You could even do something strange like this:

# strange.py
from Cheetah.Template import Template

source = '''
<!--
<def test(x) />
<li><b>$x</b> : $type($x)</li>
<end def />
-->
<ul>
<for $i in $range(20) />$test($i)<end for />
</ul>
'''

x = Template(source, compilerSettings={
'directiveStartToken':'<', 'directiveEndToken':'/>'})



On Friday, October 17, 2003, at 01:33 AM, Tavis Rudd wrote:

Hi Alex,
you just need to add something like this to the beginning of your templates:

#compiler directiveStartToken='@'

The setting 'directiveEndToken' is also configurable if you wish.

Cheers,
Tavis

On Thursday 16 October 2003 14:16, Alex J. Champandard wrote:
Hi,

I'm trying code generation with Cheetah. I have to say it's a pleasure
compared to XSLT! ;)

One thing that would help is replacing the default '#' directive tag.
It'd save me the worry of escaping all my C++ \#include if I could set
Cheetah to @include instead.

You mention it can be customized.

-- From the Guide --

Note: you can customize the start and end delimeters for placeholder
and directive tags, but in this Guide we'll assume you're using the
default.

How is this done? I can't find much on the subject in the documentation.

Thanks,
Alex



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Cheetahtemplate-discuss mailing list
Cheetahtemplate-discuss@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/cheetahtemplate-discuss




-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise