<#macro test>
<#local x="local">
${x}
</#macro>
${map.now?string("yyyy-MM-dd")}
<#setting time_zone="GMT">
${"中午好!"}<br>
4{"********************************************"}<br>
${"自定义宏 "}<br>
<#macro test sum a=0 b=0 c=0>
sum=a+b+c <br>
sum=${a+b+c}
</#macro>
<@test 4 5 6/><br>
{"********************************************"}<br>
<#macro do_thrice>
<#nested 1>
<#nested 2>
<#nested 3>
</#macro>
<@do_thrice;x>
${x} Anything
</@do_thrice>
<br>
{"********************************************"}<br>
<#macro repeat count>
<#list 1..count as x>
<#nested x,x/2>
</#list>
</#macro>
<@repeat count=5 ; c >
${c} <br>
</@repeat>
<br>
{"********************************************"}<br>
<#macro test>
Test text
<#return>
this will not be printed!
</#macro>
<@test/>
<br>
{"********************************************"}<br>
<#function avg nums...>
<#local sum=0>
<#list nums as num>
<#local sum=sum+num>
</#list>
<#if nums?size != 0>
<#return sum / nums?size>
</#if>
<#return sum>
</#function>
${avg(2,2,2,2,2)!"N/A"}
<br>
{"********************************************"}<br>
<#noparse>
哈哈...今天开始学习 Freemarker !
</#noparse><br>
${map.name?html}