http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/localization.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/localization.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/localization.ftl new file mode 100644 index 0000000..cf46fbf --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/localization.ftl @@ -0,0 +1,32 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<html> +<head> +<title>FreeMarker: Localization Test</title> +</head> +<body> + +<p>A simple test follows:</p> + +<p>${message}</p> + +<p>Hello, in the default language.</p> + +</body> +</html> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/localization_en.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/localization_en.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/localization_en.ftl new file mode 100644 index 0000000..f8292bc --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/localization_en.ftl @@ -0,0 +1,32 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<html> +<head> +<title>FreeMarker: Localization Test</title> +</head> +<body> + +<p>A simple test follows:</p> + +<p>${message}</p> + +<p>Hello, in the English language.</p> + +</body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/localization_en_AU.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/localization_en_AU.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/localization_en_AU.ftl new file mode 100644 index 0000000..938f681 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/localization_en_AU.ftl @@ -0,0 +1,32 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<html> +<head> +<title>FreeMarker: Localization Test</title> +</head> +<body> + +<p>A simple test follows:</p> + +<p>${message}</p> + +<p>G'day, mate!</p> + +</body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/logging.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/logging.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/logging.ftl new file mode 100644 index 0000000..c44d6b8 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/logging.ftl @@ -0,0 +1,42 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<html> +<head> +<title>FreeMarker: Logging Test</title> +</head> +<body> + +A simple test follows: + +${message.test[ "me" ]} + +<if message> + <p>Message exists! + <transform message.sdf> + ...and even generates output! + </transform> + </p> +</if> + +<compress> +Try this for size. +</compress> + +</body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/loopvariable.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/loopvariable.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/loopvariable.ftl new file mode 100644 index 0000000..bc77b82 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/loopvariable.ftl @@ -0,0 +1,49 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<#setting locale="en_US"> +--- +<#macro myLoop from to> + <#list from..to as x> + - <#nested x></#list>* +</#macro> +<#list 2..1 as i> + ${i} + <@myLoop from=1 to=3; i> + L1 ${i} + <@myLoop from=1 to=2; i> + L2 ${i}: <#list 1..3 as i>${i}; </#list> + </@> + </@> +</#list> +--- +<#macro repeat count> + <#list 1..count as x> + <#nested x, x/2, x==count> + </#list> +</#macro> +<#macro test2> +<#local c = 123> +<@repeat count=4 ; c, halfc, last> + <#local c = .locals.c + 0.1> + ${c} ${halfc}<#if last> Last!</#if> +</@repeat> +${c} +</#macro> +<@test2/> +--- \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/macros-return.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/macros-return.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/macros-return.ftl new file mode 100644 index 0000000..220fa2a --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/macros-return.ftl @@ -0,0 +1,34 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<#macro m>m{<#return>}</#macro> +<@m/> + +<#macro m><#if true>m{<#return>}</#if></#macro> +<@m/> + +<#macro m><#if true>m{<#return></#if>}</#macro> +<@m/> + +<#macro b>b{<#nested>}</#macro> +<#macro m><@b><#return></@></#macro> +<@m/> + +<#macro b>b{<#nested>}</#macro> +<#macro m>m:<@b><#return></@></#macro> +<@m/> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/macros.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/macros.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/macros.ftl new file mode 100644 index 0000000..9d8f456 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/macros.ftl @@ -0,0 +1,101 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<html> +<head> +<title>FreeMarker: Function Test</title> +</head> +<body> + +<p>A simple test follows:</p> + +<p>${message}</p> + +<p>Now perform function tests:</p> + +<#assign urls = {"home" : "/home.html", "about" : "/about.html"}> +<#assign images = {"home" : "/images/home.png", "about" : "/image/about-us.jpeg"}> +<#assign preferences = {"showImages" : true}> +<#assign "español" = français><#macro français(url, image, alt)> + <#local var = "Kilroy"> + <a href="${url}"> + <#if preferences.showImages> + <img src="${image}" border="0" alt="${alt}"> + <#else> + ${alt} + </#if> + </a> + ${var} was here. +</#macro> + +<p>Function is defined, now let's call it:</p> + + <@español urls.home images.home "Home" /><#t> + +<p>Again, but with different parameters:</p> + +<@français + url=urls.about + image=images.about + alt="About Us" +/> + +<#if var?exists> + Something is wrong here. +<#else> + Good. +</#if> + +<p>A recursive function call:</p> + +<#macro recurse(dummy, a=3)> + <#if (a > 0)> + <@recurse dummy a - 1 /> + </#if> + ${a} +</#macro> + +<@recurse urls /> + +<p>Test "catch-all" macro parameter:</p> + +<#macro "catch-all" foo bar...> +foo=${foo} baz=[<#list bar?keys?sort as key>${key}=${bar[key]}<#if key_has_next>, </#if></#list>] +</#macro> +<#assign catchall = .namespace["catch-all"]> + +<@catchall foo="a"/> +<@catchall foo="a" bar="b"/> +<@catchall foo="a" bar="b" baz="c"/> + +<#macro fmt pattern args...> + <#list args as arg> + <#local pattern = pattern?replace("{" + arg_index + "}", arg)> + </#list> + ${pattern}<#lt> +</#macro> + +<#macro m a=1 b=2> +</#macro> +<@assertFails message='"c"'><@m c=3 /></@> +<@assertFails message='3'><@m 9 8 7 /></@> + +<@fmt "Hello {0}! Today is {1}.", "World", "Monday" /> + +</body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/macros2.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/macros2.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/macros2.ftl new file mode 100644 index 0000000..55ceefd --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/macros2.ftl @@ -0,0 +1,35 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<#macro m1 a b=a> +${a} ${b} +</#macro> +<@m1 a="1"/> +<#macro m2 a=b b=""> +${a} ${b} +</#macro> +<@m2 b="2"/> +<#macro m3 d b=c[a] a=d c={"3":"4"}> +${b} +</#macro> +<@m3 d="3"/> +<#attempt> +<@m3 d="4"/> +<#recover> +m3 with d="4" Failed! +</#attempt> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/multimodels.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/multimodels.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/multimodels.ftl new file mode 100644 index 0000000..f356386 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/multimodels.ftl @@ -0,0 +1,84 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<html> +<head> +<title>FreeMarker: Test of Multiple Model implementations</title> +</head> +<body> + +<p>Let's begin with a simple model:</p> +<p>${message}</p> + +<p>Cool, now get into the first model. This implements a scalar, list, and +hash as a single class. Let's try some tests...</p> + +<p>${data}</p> + +<p>Now as a list...</p> + +<#list data as item>${item}<br /> +</#list> + +<p>Index into a list...</p> +<p>${data[ 1 ]}</p> +<p>List size is: ${data.size}</p> +<p>List size is: ${data["size"]}</p> + +<p>Now, again, as a hash. First using dot notation, then using [] notation:</p> + +<p>${data.selftest}</p> +<p>${data["selftest"]}</p> + +<p>Now for the tricky stuff... use a model to index into another model...</p> +<p>${test}</p> +<p>${data[ test ]}</p> +<p>${self}</p> +<p>${data[ self + "test" ]}</p> + +<p>Same thing, this time a List index...</p> +<p>${zero}</p> +<p>${data[ zero ]}</p> +<p>${data[ zero + 1 ]}</p> + +<p>Now, do the same recursively...</p> +<p>${data}</p> +<p>${data.model2}</p> +<p>${data.model2( "test" )}</p> +<p>${data.model2( data, data.selftest, message )}</p> + +<p>Does this really not work?</p> +<p>${data[ 10 ]}</p> +<p>${data[ 10 ].selftest}</p> +<p>${data[ 10 ].message}</p> + +<p>(Again, with Hashes)</p> +<p>${data.nesting1.nested}</p> +<p>${data.nesting1.nested.selftest}</p> + +<p>${data["nesting1"].nested}</p> +<p>${data["nesting1"].nested["selftest"]}</p> +<p>${data["nesting1"]["nested"]["selftest"]}</p> + +<p>As I suspected! (Manual on Expressions needs updating.)</p> + +<p>Second test on list size</p> +<p>${data.one.size}</p> +<p>${data.one["size"]}</p> +</body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/nested.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/nested.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/nested.ftl new file mode 100644 index 0000000..46f4492 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/nested.ftl @@ -0,0 +1,29 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<#macro repeat count> + <#local y = "test"> + <#list 1..count as x> + ${y} ${count}/${x}: <#nested x, "asdf"> <#-- the second body parameter is not used below --> + </#list> +</#macro> +<@repeat count=3>${y?default("undefined")} ${x?default("undefined")} ${count?default("undefined")}</@repeat> +<#global x = "X"> +<#global y = "Y"> +<#global count = "Count"> +<@repeat count=3 ; param1>${y?default("undefined")} ${x?default("undefined")} ${count?default("undefined")} ${param1}</@repeat> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/nestedinclude.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/nestedinclude.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/nestedinclude.ftl new file mode 100644 index 0000000..c6e7b11 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/nestedinclude.ftl @@ -0,0 +1,21 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<#assign nestedMessage = "I'm here, mon!"> +${.main.bar} +<#-- ${.root.message} --> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/new-defaultresolver.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/new-defaultresolver.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/new-defaultresolver.ftl new file mode 100644 index 0000000..04b6665 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/new-defaultresolver.ftl @@ -0,0 +1,23 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<#attempt> +${"org.apache.freemarker.core.templatesuite.models.NewTestModel"?new("works")} +<#recover> +fails +</#attempt> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/new-optin.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/new-optin.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/new-optin.ftl new file mode 100644 index 0000000..a2cd276 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/new-optin.ftl @@ -0,0 +1,30 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +${"org.apache.freemarker.core.templatesuite.models.NewTestModel"?new("works")} +<#attempt> +${"org.apache.freemarker.core.templatesuite.models.NewTestModel2"?new("works")} +<#recover> +fails +</#attempt> + +<#include "subdir/new-optin.ftl"> + +<#include "subdir/new-optin-2.ftl"> + +<#include "subdir/subsub/new-optin.ftl"> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/newlines1.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/newlines1.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/newlines1.ftl new file mode 100644 index 0000000..18f4b32 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/newlines1.ftl @@ -0,0 +1,29 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<html> +<head> +<title>FreeMarker: Newlines Test</title> +</head> +<body> +<p>A simple test follows:</p> + +<p>${message}</p> + +</body> +</html> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/newlines2.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/newlines2.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/newlines2.ftl new file mode 100644 index 0000000..ac8337c --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/newlines2.ftl @@ -0,0 +1,33 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<#assign message="Hello, world!\n"> +<#assign normalizeNewlines = "org.apache.freemarker.core.util.NormalizeNewlines"?new()> +<@normalizeNewlines> +<html> +<head> +<title>FreeMarker: Newlines the Second Test</title> +</head> +<body> +<p>A simple test follows:</p> + +<p>${message}</p> + +</body> +</html> +</@normalizeNewlines> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/noparse.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/noparse.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/noparse.ftl new file mode 100644 index 0000000..f7f1be3 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/noparse.ftl @@ -0,0 +1,62 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<html> +<head> +<title>FreeMarker: NoParse Test</title> +</head> +<body> +<#noparse> + +A simple test follows: + +${message} + +A more rigorous test, showing that we're not faking it: + +${message@#$%&} + +</#noparse> +<#if message?exists> + <p>Message exists! + <#noparse> + ...and even generates output! + <#if message> + Nested statements are ok, too. + </#if> + </#noparse> + </p> +</#if> + +Here's another edge case, this time, trying to output a <noparse> +inside another <noparse> + +<#noparse> + +This is what the noparse instruction looks like: + +<#nop</#noparse><#noparse>arse>This part of the template wont be parsed by the +FreeMarker parser. Instead, it will be treated as verbatim text information, +and output as such.</#nop</#noparse><#noparse>arse> + +The rest of the template appears here. +</#noparse> + +Simple. +</body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-format.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-format.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-format.ftl new file mode 100644 index 0000000..d060a44 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-format.ftl @@ -0,0 +1,42 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<#setting number_format = ",##0.##"> +<#setting locale = "fr_FR"> +${1} +${1?c} +${1234567.886} +${1234567.886?c} +<#setting number_format = "0.00"> +${1} +${1?c} +${1234567.886} +${1234567.886?c} +${int?c} +${double?c} +${double2?c} +${double3?c} +${double4?c} +${bigDecimal?c} +${bigDecimal2?c} +<@assertEquals expected="INF" actual="INF"?number?c /> +<@assertEquals expected="INF" actual="INF"?number?c /> +<@assertEquals expected="-INF" actual="-INF"?number?c /> +<@assertEquals expected="-INF" actual="-INF"?number?float?c /> +<@assertEquals expected="NaN" actual="NaN"?number?float?c /> +<@assertEquals expected="NaN" actual="NaN"?number?float?c /> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-literal.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-literal.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-literal.ftl new file mode 100644 index 0000000..c881d0f --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-literal.ftl @@ -0,0 +1,133 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<html> +<head> +<title>FreeMarker: Number Literal Test</title> +</head> +<body> +<#assign hash = {"1" : "one", + "12" : "twelve", + "2one" : "two-one", + "one2" : "one-two"} + list = ["zero", + "one", + "two", + "three", + "four", + "five", + "six", + "seven", + "eight", + "nine", + "ten", + "eleven", + "twelve"], + foo = "bar", + one = "one", + "1" = "one", + "12" = "twelve", + "2one" = "two-one", + "one2" = "one-two", + call = "org.apache.freemarker.core.templatesuite.models.SimpleTestMethod"?new() +> + +<p>A simple test follows:</p> + +<p>${message}</p> + +<p>Now perform a number assignment:</p> + +#{1.300000?double} + +<#assign mynumber = 1.8, USA="en_US" /> +<#assign myfloat = mynumber?float /> + +My number is: ${mynumber} +<#setting locale="en_US"> +My float is: #{myfloat ; m6} +The int part is: ${myfloat?int} + +<#assign mymessage = mynumber?string> + +${mymessage + 3} + +<p>Now use numbers in assignment</p> + +<#assign mymessage = 1 + 5> +${mymessage} + +<#assign mymessage = mymessage + 2> +#{mymessage} + +<p>Try numbers in tests</p> + +<#if (mymessage == 152)> +MyMessage is 152 +<#else> +MyMessage is not 152, its: ${mymessage}. +</#if > + +<if (mymessage > 5)> + MyMessage is greater than five. +</if + +<#switch mymessage> + <#case 1> + MyMessage is one + <#break> + + <#case 15> + MyMessage is fifteen + <#break> + + <#case 152> + MyMessage is one-five-two + <#break> + + <#default> + MyMessage is: ${mymessage}. + <#break> + +</#switch> + +<p>Now for numbers in dynamic keys:</p> + +<#assign one = 1> +<#assign two = 2> + +${list[ 1 ]} +${list[ 1 + 2 ]} + +<p>Numbers in hashes:</p> + +${hash[ 1 + "2" ]} +${hash[ "1" + 2 ]} +${hash[ "1" + two ]} + + +<p>Numbers in method calls:</p> + +${call( 1 )} +${call( one )} +${call( one + "2" )} +${call( one + 2 )} +${call( 1 + 2 )} + +</body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-math-builtins.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-math-builtins.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-math-builtins.ftl new file mode 100644 index 0000000..6dab082 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-math-builtins.ftl @@ -0,0 +1,78 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<@assertEquals actual=0?abs expected=0 /> +<@assertEquals actual=3?abs expected=3 /> +<@assertEquals actual=(-3)?abs expected=3 /> +<@assertEquals actual=3.5?abs expected=3.5 /> +<@assertEquals actual=(-3.5)?abs expected=3.5 /> + +<@assert test=fNan?abs?is_nan /> +<@assert test=dNan?abs?is_nan /> +<@assert test=fNinf?abs?is_infinite /> +<@assert test=dPinf?abs?is_infinite /> +<@assert test=fNinf lt 0 /> +<@assert test=dPinf gt 0 /> +<@assert test=fNinf?abs gt 0 /> +<@assert test=dPinf?abs gt 0 /> + +<@assertEquals actual=fn?abs expected=0.05 /> +<@assertEquals actual=dn?abs expected=0.05 /> +<@assertEquals actual=ineg?abs expected=5 /> +<@assertEquals actual=ln?abs expected=5 /> +<@assertEquals actual=sn?abs expected=5 /> +<@assertEquals actual=bn?abs expected=5 /> +<@assertEquals actual=bin?abs expected=5 /> +<@assertEquals actual=bdn?abs expected=0.05 /> + +<@assertEquals actual=fp?abs expected=0.05 /> +<@assertEquals actual=dp?abs expected=0.05 /> +<@assertEquals actual=ip?abs expected=5 /> +<@assertEquals actual=lp?abs expected=5 /> +<@assertEquals actual=sp?abs expected=5 /> +<@assertEquals actual=bp?abs expected=5 /> +<@assertEquals actual=bip?abs expected=5 /> +<@assertEquals actual=bdp?abs expected=0.05 /> + +<@assert test=!0?is_infinite /> +<@assert test=!fn?is_infinite /> +<@assert test=!dn?is_infinite /> +<@assert test=!ineg?is_infinite /> +<@assert test=!ln?is_infinite /> +<@assert test=!sn?is_infinite /> +<@assert test=!bn?is_infinite /> +<@assert test=!bin?is_infinite /> +<@assert test=!bdn?is_infinite /> +<@assert test=!fNan?is_infinite /> +<@assert test=!dNan?is_infinite /> +<@assert test=fNinf?is_infinite /> +<@assert test=dPinf?is_infinite /> + +<@assert test=!0?is_nan /> +<@assert test=!fn?is_nan /> +<@assert test=!dn?is_nan /> +<@assert test=!ineg?is_nan /> +<@assert test=!ln?is_nan /> +<@assert test=!sn?is_nan /> +<@assert test=!bn?is_nan /> +<@assert test=!bin?is_nan /> +<@assert test=!bdn?is_nan /> +<@assert test=fNan?is_nan /> +<@assert test=dNan?is_nan /> +<@assert test=!fNinf?is_nan /> +<@assert test=!dPinf?is_nan /> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-to-date.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-to-date.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-to-date.ftl new file mode 100644 index 0000000..403e033 --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/number-to-date.ftl @@ -0,0 +1,35 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +${1305575275540?number_to_datetime?iso_utc_ms} == 2011-05-16T19:47:55.54Z +${1305575275540?number_to_date?iso_utc} == 2011-05-16 +${1305575275540?number_to_time?iso_utc_ms} == 19:47:55.54Z + +${1305575275540?long?number_to_datetime?iso_utc_ms} == 2011-05-16T19:47:55.54Z +${1305575275540?double?number_to_datetime?iso_utc_ms} == 2011-05-16T19:47:55.54Z +${bigInteger?number_to_datetime?iso_utc_ms} == 2011-05-16T19:47:55.54Z +${bigDecimal?number_to_datetime?iso_utc_ms} == 2011-05-16T19:47:55.54Z +${1000?float?number_to_datetime?iso_utc} == 1970-01-01T00:00:01Z +${1000?int?number_to_datetime?iso_utc} == 1970-01-01T00:00:01Z +${0?byte?number_to_datetime?iso_utc} == 1970-01-01T00:00:00Z + +<#attempt> +${9999991305575275540?number_to_datetime?iso_utc} <#-- doesn't fit into long --> +<#recover> +failed +</#attempt> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/numerical-cast.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/numerical-cast.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/numerical-cast.ftl new file mode 100644 index 0000000..221b61b --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/numerical-cast.ftl @@ -0,0 +1,82 @@ +<#ftl> +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<#setting locale="en_US"> +<#setting number_format="0.#########"> + +<#assign testlist= [ 0, 1, -1, 0.5, 1.5, -0.5, + -1.5, 0.25, -0.25, 1.75, -1.75, + 1.01, -1.01, 0.01, -0.01, + 127, 128, -127, -128, + 32767, 32768, -32767, -32768, + 2147483647, 2147483648, -2147483647, -2147483648, + 4294967295, 4294967296, -4294967295, -4294967296, + 2147483647.1, 2147483648.1, -2147483647.1, -2147483648.1, + 4294967295.1, 4294967296.1, -4294967295.1, -4294967296.1 + 2147483647.5, 2147483648.5, -2147483647.5, -2147483648.5, + 4294967295.5, 4294967296.5, -4294967295.5, -4294967296.5 + ] /> + +?int: +<#list testlist as result> + ${result}?int=${result?int} +</#list> + +?double +<#list testlist as result> + ${result}?double=${result?double} +</#list> + +?long +<#list testlist as result> + ${result}?long=${result?long} +</#list> + +?long from date + ${"2011-05-08 18:00:15 GMT"?date("yyyy-MM-dd HH:mm:ss z")?long} = 1304877615000 + +?float +<#list testlist as result> + ${result}?float=${result?float} +</#list> + +?byte +<#list testlist as result> + ${result}?byte=${result?byte} +</#list> + +?short +<#list testlist as result> + ${result}?short=${result?short} +</#list> + +?floor +<#list testlist as result> + ${result}?floor=${result?floor} +</#list> + +?ceiling +<#list testlist as result> + ${result}?ceiling=${result?ceiling} +</#list> + +?round +<#list testlist as result> + ${result}?round=${result?round} +</#list> http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/output-encoding1.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/output-encoding1.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/output-encoding1.ftl new file mode 100644 index 0000000..da1128f --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/output-encoding1.ftl @@ -0,0 +1,30 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +Output charset: ${.output_encoding?default("undefined")} +URL escaping charset: ${.url_escaping_charset?default("undefined")} + +<#assign s="a/%b"> +<#setting url_escaping_charset="UTF-16"> +${s?url} +${s?url} +<#setting url_escaping_charset="ISO-8859-1"> +${s?url} +${s?url} +${s?url('UTF-16')} +${s?url} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/output-encoding2.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/output-encoding2.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/output-encoding2.ftl new file mode 100644 index 0000000..3a4f24d --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/output-encoding2.ftl @@ -0,0 +1,28 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +Output charset: ${.output_encoding?default("undefined")} +URL escaping charset: ${.url_escaping_charset?default("undefined")} + +<#assign s="a/%b"> +UTF-16: ${s?url} +ISO-8859-1: ${s?url('ISO-8859-1')} +UTF-16: ${s?url} +<#setting url_escaping_charset="ISO-8859-1"> +ISO-8859-1: ${s?url} +ISO-8859-1: ${s?url} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/4b75ea93/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/output-encoding3.ftl ---------------------------------------------------------------------- diff --git a/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/output-encoding3.ftl b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/output-encoding3.ftl new file mode 100644 index 0000000..3a4f24d --- /dev/null +++ b/freemarker-core-test/src/test/resources/org/apache/freemarker/core/templatesuite/templates/output-encoding3.ftl @@ -0,0 +1,28 @@ +<#-- + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +Output charset: ${.output_encoding?default("undefined")} +URL escaping charset: ${.url_escaping_charset?default("undefined")} + +<#assign s="a/%b"> +UTF-16: ${s?url} +ISO-8859-1: ${s?url('ISO-8859-1')} +UTF-16: ${s?url} +<#setting url_escaping_charset="ISO-8859-1"> +ISO-8859-1: ${s?url} +ISO-8859-1: ${s?url} \ No newline at end of file
