template-tal

Java Template library similar to ZPT (attribute language)

点点圈 提交于 2020-01-04 06:58:33
问题 I've been using ZPT in python recently and I love the templating language. I was looking for something similar for Java but couldn't really find anything I liked as well. The closest thing is FreeMarker. The problem with FreeMarker and the other Java template engines I looked at was their JSP style syntax that allows for non-conforming XML. I was just wondering if there was a Java template engine that is similar to Zope Page Templates such that it's an "attribute" language that requires valid

Line Breaking in Chameleon

巧了我就是萌 提交于 2020-01-04 05:11:31
问题 I have used the pyramid framework to build a large web application. Among other things, this application allows the user to enter text into a text area form field. This text is then saved to a database and of course can be readout again and displayed later. To display content I am using the Chameleon Template Engine. This works fine, except that line breaking is not displayed correctly (not displayed at all). This is probably due to the fact that the newlines entered into the text area do not

how to use macros with pyramid / ZPT (Chameleon)

℡╲_俬逩灬. 提交于 2020-01-01 06:38:08
问题 I want to use macros with pyramid+ZPT engine (Chameleon). The docs say that "A single Page Template can accommodate multiple macros." http://chameleon.readthedocs.org/en/latest/reference.html#macros-metal Thus I defined a file macros.pt : <div metal:define-macro="step-0"> <p>This is step 0</p> </div> <div metal:define-macro="step-1"> <p>This is step 1</p> </div> and a global template main_template.pt with all the html stuff defining a slot content . and a template for my view progress.pt

Python Pyramid & Chameleon templating language escapes html

梦想的初衷 提交于 2019-12-19 09:24:14
问题 I can't make sense of chameleon's tags. I'm a django user, but decided to introduce my CompSci course mates and myself to Pyramid, since I though more lightweight = easier to learn. At the moment the ${} tag is escaping any html tags I'm trying to output through it. In django there was some way to specify that a variable is "safe" and doesn't need to be escaped. How can I do the same thing in Pyramid / Chameleon? 回答1: Chameleon is based on the Zope Page Templates library, so if you find the

dynamicly fill table using zpt and ajax as update

谁说我不能喝 提交于 2019-12-13 19:17:12
问题 I'm creating a webproject in pyramid where I'd like to update a table every few secondes. I already decided to use ajax, but I'm stuck on something. On the client side I'm using the following code: function update() { var variable = 'variable '; $.ajax({ type: "POST", url: "/diagnose_voorstel_get_data/${DosierID}", dataType: "text", data: variable , success: function (msg) { alert(JSON.stringify(msg)); }, error: function(){ alert(msg + 'error'); } }); } Pyramid side: @view_config(route_name=

using base layout templates in chameleon

怎甘沉沦 提交于 2019-12-12 13:16:40
问题 In the pyramid docs there is a nice tutorial on UX stuff here: http://docs.pylonsproject.org/projects/pyramid_tutorials/en/latest/humans/creatingux/step07/index.html One thing I noticed though is in the tutorial they are setting up and passing around the 'global layout' explicitly in the code (see below). I thought this was unusual and unnecessary because I've always just used the 'load' command as shown in the docs here: http://chameleon.repoze.org/docs/latest/ Is this just a personal

How to set TAL condition to check the file type and accordingly render the template in Plone 4.1

懵懂的女人 提交于 2019-12-11 09:42:25
问题 How to use the tal condition to check the file type and render the template in Plone 4.1 My file preview template rendering depends upon the file extension. If file extension is 'pdf', I wish to use something like this:(just started working with TAL, TALES, METAL) <tal:define="file_nm global string:${here/absolute_url}" <tal:condition="file_nm.slice[-3:] = 'pdf'"> <embed width="100%" height="100%" name="plug-in" tal:attributes="src string:${here/absolute_url}#" draggable="false" onselectstart

Trouble repeating elements using TAL, Chameleon and Pyramid

流过昼夜 提交于 2019-12-08 03:27:50
问题 I'm really struggling to get TAL and Chameleon/Pyramid to play nice. . . I have a view in Pyramid that returns, for example, the following: def view(request): return {'results' : [ {'name':'alice', 'value':22}, {'name':'bob', 'value':11}, {'name':'charlie', 'value':33} ] } I have a template that contains the following bit of HTML: <!DOCTYPE html> <html> <head></head> <body> <table> <thead> <tr> <td>Keyword</td> <td class="center">Mean Position</td> </tr> </thead> <tbody> <tr tal:repeat"row

Trouble repeating elements using TAL, Chameleon and Pyramid

时光毁灭记忆、已成空白 提交于 2019-12-07 22:42:25
I'm really struggling to get TAL and Chameleon/Pyramid to play nice. . . I have a view in Pyramid that returns, for example, the following: def view(request): return {'results' : [ {'name':'alice', 'value':22}, {'name':'bob', 'value':11}, {'name':'charlie', 'value':33} ] } I have a template that contains the following bit of HTML: <!DOCTYPE html> <html> <head></head> <body> <table> <thead> <tr> <td>Keyword</td> <td class="center">Mean Position</td> </tr> </thead> <tbody> <tr tal:repeat"row results"> <td>${row.name}</td> <td>${row.value}</td> </tr> </tbody> </table> </body> </html> I'm hoping

ajax widgets in pyramid and chameleon

可紊 提交于 2019-12-04 15:12:29
问题 I would like to be able to easily create ajax 'widgets' backed by chameleon and pyramid on the server side. Does Pyramid provide any plumbing code that would make writing widgets easy? My current approach is I have a home view which uses home.pt as the renderer. home.pt uses a macro base.pt which defines the page structure and provides a slot for home.pt to fill. base.pt also uses a login 'widget' macro that I have written (see: account_login_widget.pt below). In theory, this all sounds great