Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > template engine

Reply
Thread Tools

template engine

 
 
piotr
Guest
Posts: n/a
 
      01-13-2007
Hi,

I'm looking for a template engine that can give me names of required
variables in parse time.
Calculation of a value for a specific variable name could be possibly done
in specified callback function.

For example:

<html>
<head>
<title>$title</title>
</head>
<body>
#if user
hello $user/name
#else
hello guest
#endif
</body>
</html>

for above document engine should call my function first giving an argument
"title", then second time with argument "user", and optionally if result
for user was not empty call function again with argument "user/name"
then engine should replace specific placeholders with results of my
callback function
obviously this is just example syntax, I hope you catch the idea

that would be nice if engine could work with non HTML documents.

thanks in advance for your help, and sorry for my English
//peter
 
Reply With Quote
 
 
 
 
Jorge Godoy
Guest
Posts: n/a
 
      01-13-2007
piotr <(E-Mail Removed)> writes:

(...)

> for user was not empty call function again with argument "user/name"
> then engine should replace specific placeholders with results of my
> callback function
> obviously this is just example syntax, I hope you catch the idea
>
> that would be nice if engine could work with non HTML documents.
>
> thanks in advance for your help, and sorry for my English


Take a look at Kid (http://www.kid-templating.org/) and Genshi
(http://genshi.edgewall.org/).

--
Jorge Godoy <(E-Mail Removed)>
 
Reply With Quote
 
 
 
 
piotr
Guest
Posts: n/a
 
      01-13-2007
On Sat, 13 Jan 2007 16:42:16 -0200, Jorge Godoy wrote:

> Take a look at Kid (http://www.kid-templating.org/) and Genshi
> (http://genshi.edgewall.org/).


I've already done a short look at kid, but to be honest I don't like it's
XML/Python syntax. I strongly prefer idea from SimpleTAL or HTMLTemplates
where HTML and Python code are separated.
But syntax is for me not so important like functionality so maybe I have
to get back and look at kid again

any other engines?

thanks
//peter
 
Reply With Quote
 
Cliff Wells
Guest
Posts: n/a
 
      01-13-2007
piotr wrote:
> On Sat, 13 Jan 2007 16:42:16 -0200, Jorge Godoy wrote:
>
>> Take a look at Kid (http://www.kid-templating.org/) and Genshi
>> (http://genshi.edgewall.org/).

>
> I've already done a short look at kid, but to be honest I don't like it's
> XML/Python syntax. I strongly prefer idea from SimpleTAL or HTMLTemplates
> where HTML and Python code are separated.
> But syntax is for me not so important like functionality so maybe I have
> to get back and look at kid again
>
> any other engines?


Perhaps Breve might interest you:

http://breve.twisty-industries.com

Regards,
Cliff

 
Reply With Quote
 
petercable@gmail.com
Guest
Posts: n/a
 
      01-14-2007
> <html>
> <head>
> <title>$title</title>
> </head>
> <body>
> #if user
> hello $user/name
> #else
> hello guest
> #endif
> </body>
> </html>


This example code would work in cheetah with only 2 changes...

www.cheetahtemplate.org

Pete

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
.Net Search Engine - Has anyone used dtSearch .Net Engine? Sasha ASP .Net 3 05-22-2007 04:20 PM
wiki engine (just engine) available? loguser@almad.net Python 1 04-10-2006 07:58 AM
Is ASP Validator Regex Engine Same As VS2003 Find Regex Engine? =?Utf-8?B?SmViQnVzaGVsbA==?= ASP .Net 2 10-22-2005 02:43 PM
Re: A Newbie Question about template template template tom_usenet C++ 0 07-24-2003 12:06 PM
Re: A Newbie Question about template template template Chris Theis C++ 2 07-24-2003 09:42 AM



Advertisments