<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> <#-- FreeMarker samples --> <#import "lib-datetime.ftl" as dt> <#import "lib-string.ftl" as str>

${title}

<@widget name="test" />

Dates

Dates

Formatted datetime

${dt.xsdDateTimeToYear(xsddatetime)}

Apples

Fruit

Animal: ${animal}

Book Title: ${bookTitle}

Zoo 1

Zoo 2

Berries: ${berries}

${year?number?c}

Raw String Literals

${r"#{title}"}

${r"${title}"}

Containers do not pick up changes to the value of their elements

<#assign fruit = ["apples", "oranges", "bananas"] veg = ["beans", "peas", "carrots"] food = [fruit, veg] fruit = fruit + ["pears"] > <#noparse> <#assign
fruit = ["apples", "oranges", "bananas"]
veg = ["beans", "peas", "carrots"]
food = [fruit, veg]
fruit = fruit + ["pears"]
>

List elements of ${r"${fruit}"}

<#list fruit as f> ${f}

List elements of ${r"${food}"}: contains no pears

<#list food as item> <#list item as i> ${i}

Numbers

<#assign one = 1 two = 2 numbers = [one, two] two = 20 numbers2 = [one, two] > <#noparse> <#assign
one = 1
two = 2
numbers = [one, two]
two = 20
numbers2 = [one, two]
>
${r"${two}"}: ${two}
${r"${numbers[1]}"}: ${numbers[1]}
${r"${numbers2[1]}"}: ${numbers2[1]}

Uncamelcasing

<#assign s1 = "FreemarkerTest"> ${s1} => ${str.unCamelCase(s1)}
<#assign s2 = "Freemarker"> ${s2} => ${str.unCamelCase(s2)}
<@dump var="now" /> <@dump var="urls" /> <@dump var="fruit" /> <@dump var="trueStatement" /> <@dump var="zoo1" /> <@dump var="pojo" /> ${stylesheets.addFromTheme("/css/sstest.css", "/css/sstest2.css")} ${scripts.addFromTheme("/js/jstest.js")} ${scripts.add("/js/script1.js", "/js/script2.js", "/js/script3.js")} <@dumpAll /> <@help for="dump" /> <@help for="profileUrl" /> <@describe var="stylesheets" />