UNPKG

lite

Version:

A cross platform template engine base on xml/html and javascript expression.

30 lines 1.15 kB
<test> <unit title="函数定义"> <model> { intValue:123, stringValue:"abc中文字符..." } </model> <case title="嵌套函数定义"> <source><![CDATA[<p><c:def name="test1()">[${test2()}]</c:def><c:def name="test2()">test2</c:def>${test2()}/${test1()}</p>]]></source> <expect><![CDATA[<p>test2/[test2]</p>]]></expect> </case> <case title="capture"> <source><![CDATA[<p><c:var name="var1">${intValue}[${test2()}]</c:var><c:def name="test2()">test2</c:def>{${var1}}</p>]]></source> <expect><![CDATA[<p>{123[test2]}</p>]]></expect> </case> <case title="var"> <source><![CDATA[<p><c:var name="var1" value="${intValue+'['+test2()+']'}"></c:var><c:def name="test2()">test2</c:def>{${var1}}</p>]]></source> <expect><![CDATA[<p>{123[test2]}</p>]]></expect> </case> <case title="capture+var"> <source><![CDATA[<p><c:var name="var1" value="${'a'}"/><c:var name="var1">${intValue}[${test2()}${var1}<c:var name="var1" value="${'b'}"/>]${var1}</c:var><c:def name="test2()">test2</c:def>{${var1}}</p>]]></source> <expect><![CDATA[<p>{123[test2a]b}</p>]]></expect> </case> </unit> </test>