big-moving.ru/api/soft/ajaxorg/demo/kitchen-sink/docs/soy_template.soy

46 lines
1.0 KiB
Plaintext
Executable File

/**
* Greets a person using "Hello" by default.
* @param name The name of the person.
* @param? greetingWord Optional greeting word to use instead of "Hello".
*/
{template .helloName #eee}
{if not $greetingWord}
Hello {$name}!
{else}
{$greetingWord} {$name}!
{/if}
{/template}
/**
* Greets a person and optionally a list of other people.
* @param name The name of the person.
* @param additionalNames The additional names to greet. May be an empty list.
*/
{template .helloNames}
// Greet the person.
{call .helloName data="all" /}<br>
// Greet the additional people.
{foreach $additionalName in $additionalNames}
{call .helloName}
{param name: $additionalName /}
{/call}
{if not isLast($additionalName)}
<br> // break after every line except the last
{/if}
{ifempty}
No additional people to greet.
{/foreach}
{/template}
{/foreach}
{if length($items) > 5}
{msg desc="Says hello to the user."}
{namespace ns autoescape="contextual"}
/** Example. */
{template .example}
foo is {$ij.foo}
{/template}