Javascript模板 [英] Javascript templates

查看:85
本文介绍了Javascript模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道在Genshi中是否有任何方法可以创建javascrit模板?我的意思是,我需要一个.js文件,可以在其中使用<py:for>这样的指令.

Does anyone know if is there any way to create javascrit templates in Genshi? I mean, I need a .js file where I can use directives like <py:for> and so.

有什么主意吗?谢谢!

推荐答案

您可以像这样直接在html中编写它:

You can write it directly in html like this:

<script type="text/javascript">
<py:if test="func1">
/*&lt;![CDATA[*/
      function func1() {
      }
/*]]&gt;*/
</py:if>
</script>

注意:CDATA中的代码将右转义,因此您可以使用'>','<'像往常一样.

note: code inside CDATA will be right escaped, so you can use '>','<' as usual.

这篇关于Javascript模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆