template engine

Discussion in 'Python' started by piotr, Jan 13, 2007.

  1. piotr

    piotr Guest

    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
    piotr, Jan 13, 2007
    #1
    1. Advertising

  2. piotr

    Jorge Godoy Guest

    piotr <> 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 <>
    Jorge Godoy, Jan 13, 2007
    #2
    1. Advertising

  3. piotr

    piotr Guest

    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
    piotr, Jan 13, 2007
    #3
  4. piotr

    Cliff Wells Guest

    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
    Cliff Wells, Jan 13, 2007
    #4
  5. piotr

    Guest

    > <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
    , Jan 14, 2007
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmViQnVzaGVsbA==?=

    Is ASP Validator Regex Engine Same As VS2003 Find Regex Engine?

    =?Utf-8?B?SmViQnVzaGVsbA==?=, Oct 22, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    695
    =?Utf-8?B?SmViQnVzaGVsbA==?=
    Oct 22, 2005
  2. Chris Theis
    Replies:
    2
    Views:
    465
    Chris Theis
    Jul 24, 2003
  3. tom_usenet
    Replies:
    0
    Views:
    532
    tom_usenet
    Jul 24, 2003
  4. Replies:
    1
    Views:
    367
    Sybren Stuvel
    Apr 10, 2006
  5. Sasha
    Replies:
    3
    Views:
    582
    Sasha
    May 22, 2007
Loading...

Share This Page