freemarker3
结束标签
可以在结束标签中忽略user_def_dir_exp 也就是说可以写</@>来代替</@anything>
循环变量
<@myRepeatMacro count=4>
SomeThing...
</@>
<@myRepeatMacro count=4 ;x>
${x}.SomeThing...
</@>
<@myRepeatMacro count=4 ;x,last> //自定义指令创建的循环变量和分号之后指定的循环变量数量需要不匹配 last可以不写 x也可以不写
${x}.Something...<#if last>This was the last!</#if>
</@>
位置参数传递: 目前仅仅支持宏定义
macro,nested,return指令
没有参数的宏
<#macro test>
Test text
</#macro>
<@test/> --> Test text
有参数的宏:
<#macro test foo bar baaz>
Test test,and the params:${foo},${bar},${baaz}
</#macro>
<@test foo="a" bar="b" baaz=5*5-2/>
--> Test text,and the params:a,b,23
一个复杂的宏
<#macro list title items>
<p>${title?cap_first}:
<ul>
<#list>
<li>${x?cap_first}
</#list>
</ul>
</#macro>
<@list item=["mouse","elephant","python"] title="Animals"/>
--> <p>Animals:
<ul>
<li>Mouse
<li>Elephant
<li>Python
</ul>
function return 指令
<#function name param1 param2 ... paramN> ... <#return returnVlalue> ... </#function> 例子:
<#function avg x y >
<#return (x+y)/2>
</#function>
${avg(10,20)}
-->15
freemarker3的更多相关文章
随机推荐
- DirectShow多媒体流捕获播放组件
英文原文地址:https://msdn.microsoft.com/en-us/library/windows/desktop/dd390351(v=vs.85).aspx Microsoft®Dir ...
- public static void main(String args[])什么意思?
public static void main(String[] args) 这绝对不是凭空想出来的,也不是没有道理的死规定,而是java程序执行的需要. jvm在试图运行一个类之前,先检查该类是否包 ...
- Mqtt ----心跳机制
心跳机制 Keep Alive指定连接最大空闲时间T,当客户端检测到连接空闲时间超过T时,必须向Broker发送心跳报文PINGREQ,Broker收到心跳请求后返回心跳响应PINGRESP.若Bro ...
- sql中一列拆成两列
declare @table table (name nvarchar(4))insert into @tableselect '张三' union allselect '李四' union alls ...
- quartus ii工程文件的分析
.pof:通过AS口将程序固化到EPCS(flash)内. .sof:通过JTAG口下载到FPGA内部的SRAM里面. .JIC:通过JTAG口将程序固化到EPCS(flash)内.
- Spatial Transformer Network
https://blog.csdn.net/yaoqi_isee/article/details/72784881 Abstract: 作者说明了CNN对于输入的数据缺乏空间变换不变形(lack of ...
- 区别getElementByID,getElementsByName,getElementsByTagName
以人来举例说明,人有能标识身份的身份证,有姓名,有类别(大人.小孩.老人)等. 1. ID 是一个人的身份证号码,是唯一的.所以通过getElementById获取的是指定的一个人. 2. Name ...
- samba 文件和目录权限控制
[laps_test] comment = laps_test path = /home/laps browseable = yes w ...
- shell获取用户输入
主题: 再学shell之获取用户输入echo -n(不换行)和read命令-p(提示语句) -n(字符个数) -t(等待时间) -s(不回显) 和“读文件”深入学习 1.基本读取read命令接收标准输 ...
- C Pointer-to-Function 与 C++ Pointer-to-MemberFunction 的区别
在看APUE Figure1.10的时候发现signal(SIGINT, sig_int)这里的sig_int直接用的函数名,但是看Thinking-in-C++ Vol.2的时候发现mem_fun( ...