您的位置:首页 > 其它

Artima新闻:Ryan Tomayko发布Kid 0.5

2005-01-28 10:09 309 查看
Ryan Tomayko发布了Kid0.5版。Kid是一个基于XML的Python模板语言的开源项目. 你可以利用Kid项目在XML中嵌入Python语言,利用动态语言的强大能力轻松完成工作。一个明显应用将是在web环境下,就象PHP所做的那样。

Ryan Tomayko has posted Kid 0.5, "a simple Pythonic template language for XML based vocabularies. It was spawned as a result of a kinky love triangle between XSLT, TAL, and PHP." The language is based on just six attributes:
kid:for
,
kid:if
,
kid:def
,
kid:content
,
kid:omit
, and
kid:replace
; each of which contains a Python expression. Since this expression can point to externally defined functions, this is most of what you need. In addition there are attribute value templates similar to XSLT's, and
<?python?>
processing instructions can embed code directly in the XML document. I'm not sure I approve of the use of processing instructions in the language, but I'm not sure I don't either. Not having to escape XML-significant symbols like
<
and
&
in the embedded code is convenient. Kid templates are compiled to Python byte-code and can be imported and invoked like normal Python code. Kid templates generate SAX events and can be used with existing libraries that work along SAX pipelines. This release changes the license from GPL to MIT. Overall it looks like a fairly well-designed, well-thought out system that has clearly learned from the mistakes of gnarly systems like PHP, JSP, and ASP.
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: