一种超快速的模板语言,它借鉴了现有模板语言的最佳思想。

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是根据麻省理工学院风格的许可证(见许可证)获得许可的。
其他注册项目可以根据不同的许可证获得许可。
所有许可证都允许非商业和商业用途。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java OnResizeListener或OnDrawListener或类似的东西   java Orika映射嵌套子列表   保存时java Heroku请求超时代码H12   数据库在Java中出现socket读取超时异常的原因是什么?   java如何更改来自Sqlite数据库的特定数据在Listview中的行颜色   java JAXB解组器无法正确处理XML中的列表   java Android日期时区让我抓狂   java不透明属性在Swing中如何工作?   eclipse从JavaEE代码生成流程图   java如何在Hibernate中从相关表中获取计数   java Glassfish部署了项目的依赖项库   java使内容适合JavaFx中的WebView   java不满意的链接错误libcrypto。所以1.0.0   循环中java数组的使用   java找出哪个包调用服务