Chinaunix
标题:
mako的def 和namespace使用中遇到的输出换行问题
[打印本页]
作者:
yangward
时间:
2010-05-03 23:54
标题:
mako的def 和namespace使用中遇到的输出换行问题
根据官方提供的namespace的例子
我把index.html的内容无论是print 还是使用file生成到文件里面,都会自动换行
components.html
## components.html
<%def name="comp1()">
this is comp1
</%def>
<%def name="comp2(x)">
this is comp2, x is ${x}
</%def>
复制代码
index.html
<%namespace name="comp" file="components.html"/>
Heres comp1: ${comp.comp1()}
Heres comp2: ${comp.comp2(x=5)}
复制代码
结果
Heres comp1:
this is comp1
Heres comp2:
this is comp2, x is 5
哪位用过mako的def和namespace的同学指点下?
作者:
luffy.deng
时间:
2010-05-04 08:32
Heres comp1:
this is comp1
Heres comp2:
this is comp2, x is 5
yangward 发表于 2010-05-03 23:54
这是print的结果 还是浏览器里看到的结果? html文件里有换行没什么影响,浏览器又不解释换行。
欢迎光临 Chinaunix (http://bbs.chinaunix.net/)
Powered by Discuz! X3.2