寻找一个预处理器来填充静态文件
我正在寻找的内容将允许我采用这样的内容:
index.html.template:
<html>
<body>
<# include ("body.html.template") #>
</body>
</html>
body.html.template:
Hello World! <# include("text.txt") #>
text.txt:
4
并将其变成这样:
<html>
<body>
Hello World! 4
</body>
</html>
虽然示例是HTML,但我可能最终会使用一些东西很多奇怪的地方都是这样。我认为有很多预处理器;有适合这项任务的非常基本的吗?
What I'm looking for would allow me to take something like this:
index.html.template:
<html>
<body>
<# include ("body.html.template") #>
</body>
</html>
body.html.template:
Hello World! <# include("text.txt") #>
text.txt:
4
And turn it into this:
<html>
<body>
Hello World! 4
</body>
</html>
While the example is HTML, I would probably end up using something like this in a lot of weird places. I think there are a number of preprocessors out there; is there a very basic one that's suited to this task?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
http://www.cheetahtemplate.org/
它基本上是嵌入在模板中的Python语句,所以你可以访问所有 python 功能。小例子:
将生成
此链接文件包含指令:
http://www.cheetahtemplate.org/docs/users_guide_html/users_guide.html#节000860000000000000000
http://www.cheetahtemplate.org/
it is basically python statements embedded in template, so you have access to all python functionality. Small example:
will produce
this link documents include directive:
http://www.cheetahtemplate.org/docs/users_guide_html/users_guide.html#SECTION000860000000000000000