Texen文本生成工具
Texen是一种通用的文字生成工具。能够生产几乎任何种类的文本输出。提供一个Ant的任务, Texen使用一个控制模板,以及一些可选的 worker 模板,用来控制和管理输出。
控制模板示例:
#*
file: Control.vm
This is the control template for our HTML
page generator!
*#
#set ($Planets = ["Earth", "Mars", "Venus"])
#foreach ($planet in $Planets)
#set ($outputFile = $strings.concat([$planet, ".html"]))
$generator.parse("HtmlTemplate.vm", $outputFile, "planet", $planet)
#end
worker模板示例:
#*
file: HtmlTemplate.vm
This is worker template. It is called by the
control template to produce useful output (or
not so useful in this case). :-)
*#
#set ($bgcolor = "#ffffff")
<html>
<head>
<title>
Everything you wanted to know about $planet!
</title>
</head>
<body bgcolor="$bgcolor">
$planet is a great place to live!
</body>
</html>
评论