一种超快速的模板语言,它借鉴了现有模板语言的最佳思想。
Choco的Python项目详细描述
一个用python编写的模板库。它提供了一种熟悉的、非XML的BR/>语法,它编译成Python模块以获得最大性能。choco的
语法和api借鉴了许多其他方法的最佳思想,包括django
模板、cheetah、myghty和genshi。从概念上讲,CuCo是一个嵌入的
Python(即Python Server Page)语言,它提炼了熟悉的思想:组件化布局和继承的BR/>,从而产生了一个最容易使用的
直截了当和灵活的模型。同时还保持与python调用和作用域语义的紧密联系。
nutshell
==
:
<;%inherit file=“base.html”/>;
<;%
rows=[[v for v in range(0,10)]for row in range(0,10)]
%>;
<;table>;
%
>ui标签灵感灵感灵感灵感灵感灵感灵感灵感灵感灵感来源于Emberjs车把Tempalte。
index.html
>这是一个ui页
<;%@post view(post-id)/>
内容:${post.content}
…代码::python
def create_ui_container():
from choco.ui import uicontainer,uimodule
ui_container=uicontainer([“template/ui”])
class postview(uimodule):
>default_template=“post.html”
self.thing=thing(“post”)
def render(self,post-id:
post=self.thing.getbypostid(post-id)
返回{
“post”:post
}
ui-container.put-ui(“postview”,postview)
返回ui-container
tl2=lookup.templateLookup(directories=[“template”],ui_container=create_ui_container())
t12.get_template(“index.html”).render(post_id=122)
哲学
=
python是一种很棒的脚本语言。不要重新发明轮子…你的模板可以处理它!
许可证
==
choco是根据麻省理工学院风格的许可证(见许可证)获得许可的。
其他注册项目可以根据不同的许可证获得许可。
所有许可证都允许非商业和商业用途。
语法和api借鉴了许多其他方法的最佳思想,包括django
模板、cheetah、myghty和genshi。从概念上讲,CuCo是一个嵌入的
Python(即Python Server Page)语言,它提炼了熟悉的思想:组件化布局和继承的BR/>,从而产生了一个最容易使用的
直截了当和灵活的模型。同时还保持与python调用和作用域语义的紧密联系。
nutshell
==
:
<;%inherit file=“base.html”/>;
<;%
rows=[[v for v in range(0,10)]for row in range(0,10)]
%>;
<;table>;
%
>ui标签灵感灵感灵感灵感灵感灵感灵感灵感灵感灵感来源于Emberjs车把Tempalte。
index.html
>这是一个ui页
<;%@post view(post-id)/>
内容:${post.content}
…代码::python
def create_ui_container():
from choco.ui import uicontainer,uimodule
ui_container=uicontainer([“template/ui”])
class postview(uimodule):
>default_template=“post.html”
def render(self,post-id:
post=self.thing.getbypostid(post-id)
返回{
“post”:post
}
ui-container.put-ui(“postview”,postview)
返回ui-container
tl2=lookup.templateLookup(directories=[“template”],ui_container=create_ui_container())
t12.get_template(“index.html”).render(post_id=122)
哲学
=
python是一种很棒的脚本语言。不要重新发明轮子…你的模板可以处理它!
许可证
==
choco是根据麻省理工学院风格的许可证(见许可证)获得许可的。
其他注册项目可以根据不同的许可证获得许可。
所有许可证都允许非商业和商业用途。