预览速度模板
我正在编辑速度模板。这些用于生成PDF。问题是我无法预览它们。我看不到模板渲染时的外观。有什么工具可以使用吗?我尝试过谷歌搜索,但找不到任何东西。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
我正在编辑速度模板。这些用于生成PDF。问题是我无法预览它们。我看不到模板渲染时的外观。有什么工具可以使用吗?我尝试过谷歌搜索,但找不到任何东西。
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(1)
不确定这是否解决了您的需求,但是我创建了一个 velocity-template-tester-tester 几年前,当我使用速度模板工作时。它具有一个UI,您可以在其中指定一个模板,例如
< html> hello $ {user}</html>
和参数,例如{“用户”:“ test”}
或user = test
,它将显示为< html> hello test</html>
显示了扩展的模板。但这不会呈现输出。如果您的输出将是内部html并且您想要渲染的,则可以使用REST API,它也是。 Postman在
Body> Body
选项卡中具有Preview
按钮,可用于渲染HTML。 API同时接受JSON和YAML输入。 YAML输入使手动测试多行模板变得更加容易。带有YAML输入的示例API调用看起来如下:Not sure if this addresses what you need, but I created a velocity-template-tester a few years ago when I worked with Velocity templates. It has a UI where you can specify a template like
<html>Hello ${user}</html>
and parameters like{"user":"test"}
oruser=test
and it'll show you the expanded template as<html>Hello test</html>
. But it doesn't render the output as such.If your output will be internally HTML and you want it rendered, you could use a REST API that is also part of the tester in Postman. Postman has a
Preview
button in theBody
tab of the response which can be used to render HTML. The API accepts both JSON and YAML input. YAML input makes it easier to manually test multi-line templates. A sample API call with YAML input looks something like below: