GithubHelp home page GithubHelp logo

Comments (5)

malthe avatar malthe commented on May 27, 2024

Works for me:

>>> PageTemplate('<a tal:content="addr+\'town\'"></a>')(addr='home')
u'<a>hometown</a>'

Note that I had to escape the single quote character for Python to compile the line.

from chameleon.

malthe avatar malthe commented on May 27, 2024

I see the issue now with the second template.

You're right and it's because in 2.x –– which is reverting a behavior back to ZPT –– you must escape semicolon (by adding an additional semicolon).

This was done to be 100% compatible with ZPT in this respect, but I realize that it might bite users of Chameleon.

from chameleon.

robert-zaremba avatar robert-zaremba commented on May 27, 2024

The documentation does not say anything about escaping.
The code was valid in version 1.x.

from chameleon.

malthe avatar malthe commented on May 27, 2024

Thanks --- I've added a note in the documentation: http://pagetemplates.org/docs/latest/reference.html#id49.

To remain compatible with both, one way is to use expression interpolation:

 PageTemplate('<a href="${addr+'?page=1;#results'}"></a>')(addr='home')

Does that work for you?

from chameleon.

robert-zaremba avatar robert-zaremba commented on May 27, 2024

Yes, thank you for resolving nuisances and updating documentation.

from chameleon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.