delphi模板引擎
delphi模板引擎
开源地址:https://github.com/sempare/sempare-delphi-template-engine
可能适用的场景:
- 使用模板引擎(或语言)的网站
- 代码生成
- 邮件合并
- 通知消息
用法示例:
program Example; uses Sempare.Template; type TInformation = record name: string; favourite_sport : string; count : integer; end; begin var tpl := Template.Parse( 'My name is <% name %>.'#13#10 + 'My favourite sport is <% favourite_sport %>.'#13#10 + 'Counting... <% for i := 1 to count %><% i %><% betweenitems %>, <% end %>' ); var info : TInformation; info.name := 'conrad'; info.favourite_sport := 'ultimate'; info.count := 3; writeln(Template.Eval(tpl, info)); end.
本文来自博客园,作者:{咏南中间件},转载请注明原文链接:https://www.cnblogs.com/hnxxcxg/p/17021121.html