摘要:1. 多值属性的呈现例如一个Image类有属性ImageUrl、TargetUrl,取出一个Image对象集合IList<Image> images,使用st.SetAttribute("images", images); 将这个集合设置给StringTemplate对象,想生成一段文本:pics=ImageUrl1|ImageUrl2|...&targets=TargetUr...
阅读全文
摘要:属性范围:StringTemplate的文档:Reference to attribute a in template t is resolved as follows: 1. Look in t's attribute table 在自己的属性里面找2. Look in t's arguments 在参数里面找3. Look recursively up t's enclosing templa...
阅读全文
摘要:If you need to get the attributes list that referenced in a StringTemplate, as well as which specific templates that invoked by it, you need to parse the StringTemplate expression. The following code ...
阅读全文
摘要: Enforcing Strict Model-View Separation in Template Engines(在模板引擎中强制模型-视图严格分离),是StringTemplate作者Terence Parr的一篇学术理论性论文,从学术的角度对模型-视图的分离给出清晰的定义,包括实现分离的规则,目的是使对模板引擎的研究规范化。
这篇论文是使用StringTemplate一个非常好的理论基础,在大型应用中使用JSP、ASP.NET等其它模板时,也可以作为一个相当优秀的参考。
内容简介:
1. 对模型-视图分离情况的总体介绍
2. 简单介绍模板引擎的发展
3. 总结分离的优点
4. 对模型-视图-控制器模式的介绍
5. 模板的正式定义
6. 对限制性模板进行分类:正则模板、上下文无关模板、上下文相关模板
7. 正式的定义分离,给出确定/衡量分离的规则(混杂索引指数),并介绍模板(视图)与模型间数据交互的两种方式:提取策略(Pull S
阅读全文