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.

posted @ 2024-04-23 13:56  lucken  阅读(49)  评论(0编辑  收藏  举报