Edgewall Software

Opened 18 years ago

Closed 17 years ago

#67 closed enhancement (fixed)

Allow "Markup" constructor to be used from templates

Reported by: talin@… Owned by: cmlenz
Priority: trivial Milestone: 0.4
Component: Template processing Version: 0.3.3
Keywords: Cc:

Description

I have a couple of classes that generate XML (specifically, they take the output of 'diff' and convert them into <ins> and <del> tags). I'd like to be able to flag the result as XML so that Genshi doesn't attempt to escape the XML markup - however, I can't figure out how to call "Markup()" from within a template expression. Because the 'diff' classes know nothing about Genshi, I dont want to modify them to add the "Markup()" wrapper, or use the Genshi xml constuction APIs.

Change History (7)

comment:1 follow-up: Changed 18 years ago by cmlenz

You can just put the Markup class in the context data. Are you using Genshi by itself, or through the template engine plugin? I guess the plugin could add the Markup class automatically (as it already does for a couple other things), but for Genshi itself I've been following the policy of not adding anything automatically (except for the Python builtins and the magic Undefined type). But maybe Markup should be an exception, I'm not sure.

comment:2 Changed 17 years ago by jochen.kupperschmidt@…

Since Markup() is very common and even usually mandatory for real-world templates, I second the idea of adding it to the context by default - so users won't need to do it themselves in their application code anymore.

comment:3 in reply to: ↑ 1 ; follow-up: Changed 17 years ago by cboos

Replying to cmlenz:

... But maybe Markup should be an exception, I'm not sure.

Another exception worth considering would be Undefined (perhaps even more needed than Markup).

See e.g. [Trac 4348].

comment:4 in reply to: ↑ 3 ; follow-up: Changed 17 years ago by cmlenz

Replying to cboos:

Replying to cmlenz:

... But maybe Markup should be an exception, I'm not sure.

Another exception worth considering would be Undefined (perhaps even more needed than Markup).

Undefined is already an exception (as noted in the comment you replied to ;-) ). I think what you've seen was that this was broken for a bit on trunk, but it should work again now since [464].

comment:5 in reply to: ↑ 4 Changed 17 years ago by cboos

Replying to cmlenz:

Undefined is already an exception (as noted in the comment you replied to ;-) ).

Oops, yes, overlooked that!

I think what you've seen was that this was broken for a bit on trunk, but it should work again now since [464].

Most probably, yes. Fixed that in [T4405]. Sorry for the noise ;)

comment:6 Changed 17 years ago by jochen.kupperschmidt@…

So, what about finally adding Markup to make life a little easier and closing this ticket?

comment:7 Changed 17 years ago by cmlenz

  • Resolution set to fixed
  • Status changed from new to closed

Done in [493].

Note: See TracTickets for help on using tickets.