http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/ref_directive_setting.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_directive_setting.html b/builds/2.3.26-nightly/ref_directive_setting.html new file mode 100644 index 0000000..85971e2 --- /dev/null +++ b/builds/2.3.26-nightly/ref_directive_setting.html @@ -0,0 +1,478 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-section"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>setting - Apache FreeMarker Manual</title> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width,initial-scale=1"> +<meta name="format-detection" content="telephone=no"> +<meta property="og:site_name" content="Apache FreeMarker Manual"> +<meta property="og:title" content="setting"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_directive_setting.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_directive_setting.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache FreeMarker Manual"> + + <!--[if lte IE 9]> + <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div> + <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref.html"><span itemprop="name">Template Language Reference</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_directives.html"><span itemprop="name">Directive Reference</span></a></li><li class="step- 3" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_directive_setting.html"><span itemprop="name">setting</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","Template Language Reference","Directive Reference","setting"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="ref_directive_outputformat.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_stop.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_directive_setting" itemprop="headline">setting</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#autoid_124" data-menu-target="autoid_124">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_125" data-menu-target="autoid_125">Description</a></li></ul> </div><a name="ref.directive.setting"></a> + + + + +<h2 class="content-header header-section2" id="autoid_124">Synopsis</h2> + + + +<pre class="metaTemplate"> +<code class="inline-code"><#setting <em class="code-color">name</em>=<em class="code-color">value</em>></code> +</pre> + + + <p>Where:</p> + + <ul> + <li> + <code class="inline-code"><em class="code-color">name</em></code>: name + of the setting. It is not expression! + </li> + + <li> + <code class="inline-code"><em class="code-color">value</em></code>: New + value of the setting. Expression + </li> + </ul> + + + + + +<h2 class="content-header header-section2" id="autoid_125">Description</h2> + + + <p>Sets a setting for the further part of processing. Settings + are values that influence the behavior of FreeMarker. The new value + will be present only in the template processing where it was set, + and does not touch the template itself. The initial value of + settings is set by the programmer <span class="marked-for-programmers">(see: <a href="pgui_config_settings.html">Programmer's Guide/The Configuration/Settings</a>)</span>.</p> + + <p>The supported settings are:</p> + + <ul> + <li> + <p><code class="inline-code">locale</code>: The locale (language) + of the output. It can influence the presentation format of + numbers, dates, etc. The value is a string which consist of a + language code (lowercase two-letter ISO-639 code) plus optional + county code (uppercase two-letter ISO-3166 code) separated from + the language code with underscore, and if we have specified the + country then an optional variant code (not standardized) + separated from the country with underscore. Examples of valid + values: <code class="inline-code">en</code>, <code class="inline-code">en_US</code>, + <code class="inline-code">en_US_MAC</code>. FreeMarker will try to use the + most specific available locale, so if you specify + <code class="inline-code">en_US_MAC</code> but that is not known, then it will + try <code class="inline-code">en_US</code>, and then <code class="inline-code">en</code>, + and then the default locale of the computer (which is may set by + the programmer).</p> + </li> + + <li> + <p><a name="ref.setting.number_format"></a><code class="inline-code">number_format</code>: The number + format that is used to convert numbers to strings when no + explicit format is specified. Can be one of the + following:</p> + + <ul> + <li> + <p>Predefined values defined by the Java platform: + <code class="inline-code">number</code> (the default), + <code class="inline-code">currency</code>, or + <code class="inline-code">percent</code></p> + </li> + + <li> + <p><code class="inline-code">computer</code>, which formats like <a href="ref_builtins_number.html#ref_builtin_c">the <code>c</code> + built-in</a></p> + </li> + + <li> + <p>Format pattern written in <a href="http://java.sun.com/j2se/1.4/docs/api/java/text/DecimalFormat.html">Java + decimal number format syntax</a>, for example + <code class="inline-code">0.###</code>. FreeMarker <a href="ref_builtins_number.html#topic.extendedJavaDecimalFormat">extends this + format</a> to allow specifying rounding mode, symbols + used, etc.</p> + </li> + + <li> + <p>Values starting with <code class="inline-code">@</code> that's also + followed by a letter, refer to a <a href="pgui_config_custom_formats.html">custom format</a>. + For example, <code class="inline-code">"@price"</code> refers to the + custom format registered with the <code class="inline-code">"price"</code> + name. The custom format name is possibly followed by space + or <code class="inline-code">_</code> and then format parameters, whose + interpretation depends on the custom format. For backward + compatibility, the initial <code class="inline-code">@</code> only has + this new meaning if either <a href="pgui_config_incompatible_improvements.html#pgui_config_incompatible_improvements_how_to_set">the + <code>incompatible_improvements</code> setting</a> + is at least 2.3.24, or there's any custom formats defined. + When the initial <code class="inline-code">@</code> isn't followed by a + letter (any UNICODE letter), it's never treated as a + reference to a custom format.</p> + </li> + </ul> + </li> + + <li> + <p><code class="inline-code">boolean_format</code>: The + comma-separated pair of strings for representing true and false + values respectively that is used to convert booleans to strings + when no explicit format is specified (like in + <code class="inline-code">${<em class="code-color">booleanValue</em>}</code>). + Note that currently white space isn't removed from this string, + so don't put space after the comma. Default value is + <code class="inline-code">"true,false"</code>, but FreeMarker will deny using + that particular value for + <code class="inline-code">${<em class="code-color">booleanValue</em>}</code>, + and requires using + <code class="inline-code">${<em class="code-color">booleanValue</em>?c}</code> + instead (this works since 2.3.21). For any other value, like + <code class="inline-code">"Y,N"</code>, + <code class="inline-code">${<em class="code-color">booleanValue</em>}</code> + will work. See also:<a href="ref_builtins_boolean.html#ref_builtin_string_for_boolean"><code>string</code> + built-in</a>.</p> + </li> + + <li> + <p><a name="topic.dateTimeFormatSettings"></a><a name="topic_date_format_settings"></a> <code class="inline-code">date_format</code>, + <code class="inline-code">time_format</code>, + <code class="inline-code">datetime_format</code>: The format used to convert + date/time/date-time values (Java + <code class="inline-code">java.util.Date</code>-s and its subclasses) to + strings when no explicit format is specified via the <a href="ref_builtins_date.html#ref_builtin_string_for_date"><code>string</code> + built-in</a> (or otherwise), as in the case of + <code class="inline-code">${someDate}</code>. The + <code class="inline-code">date_format</code> setting only effects the + formatting of date values that store no time part, + <code class="inline-code">time_format</code> only effects the formatting of + times that store no date part, and + <code class="inline-code">datetime_format</code> only effects formatting of + date-time values. These settings also effects what format do + <a href="ref_builtins_string.html#ref_builtin_string_date"><code>?time</code>, + <code>?date</code>, and + <code>?datetime</code></a> expect when it's applied on + a string value.</p> + + <p>The possible setting values are (the quotation marks + aren't part of the value itself):</p> + + <ul> + <li> + <p>Patterns <a href="http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html">accepted + by Java's <code>SimpleDateFormat</code></a>, for + example <code class="inline-code">"dd.MM.yyyy HH:mm:ss"</code> (where + <code class="inline-code">"HH"</code> means 0-23 hours) or + <code class="inline-code">"MM/dd/yyyy hh:mm:ss a"</code> (where + <code class="inline-code">"a"</code> prints AM or PM, if the current + language is English).</p> + </li> + + <li> + <p><code class="inline-code">"xs"</code> for XML Schema format, or + <code class="inline-code">"iso"</code> for ISO 8601:2004 format. These + formats allow various additional options, separated with + space, like in <code class="inline-code">"iso m nz"</code> (or with + <code class="inline-code">_</code>, like in <code class="inline-code">"iso_m_nz"</code>; + this is useful in a case like + <code class="inline-code">lastModified?string.iso_m_nz</code>). The + options and their meanings are:</p> + + <ul> + <li> + <p>Accuracy options:</p> + + <ul> + <li> + <code class="inline-code">ms</code>: Milliseconds, always + shown with all 3 digits, even if it's all 0-s. + Example: <code class="inline-code">13:45:05.800</code> + </li> + + <li> + <code class="inline-code">s</code>: Seconds (fraction + seconds are dropped even if non-0), like + <code class="inline-code">13:45:05</code> + </li> + + <li> + <code class="inline-code">m</code>: Minutes, like + <code class="inline-code">13:45</code>. This isn't allowed for + <code class="inline-code">"xs"</code>. + </li> + + <li> + <code class="inline-code">h</code>: Hours, like + <code class="inline-code">13</code>. This isn't allowed for + <code class="inline-code">"xs"</code>. + </li> + + <li> + Neither: Up to millisecond accuracy, but + trailing millisecond 0-s are removed, also the whole + milliseconds part if it would be 0 otherwise. + Example: <code class="inline-code">13:45:05.8</code> + </li> + </ul> + </li> + + <li> + <p>Time zone offset visibility options:</p> + + <ul> + <li> + <code class="inline-code">fz</code>: "Force + Zone", always show time zone offset (even for + for <code class="inline-code">java.sql.Date</code> and + <code class="inline-code">java.sql.Time</code> values). But, + because ISO 8601 doesn't allow for dates (means date + without time of the day) to show the zone offset, + this option will have no effect in the case of + <code class="inline-code">"iso"</code> with dates. + </li> + + <li> + <code class="inline-code">nz</code>: "No Zone", + never show time zone offset + </li> + + <li> + Neither: Always show time zone offset, except + for <code class="inline-code">java.sql.Date</code> and + <code class="inline-code">java.sql.Time</code>, and for + <code class="inline-code">"iso"</code> date values. + </li> + </ul> + </li> + + <li> + <p>Time zone options:</p> + + <ul> + <li> + <code class="inline-code">u</code>: Use UTC instead of what + the <code class="inline-code">time_zone</code> setting suggests. + However, <code class="inline-code">java.sql.Date</code> and + <code class="inline-code">java.sql.Time</code> aren't affected by + this (see + <code class="inline-code">sql_date_and_time_time_zone</code> to + understand why) + </li> + + <li> + <code class="inline-code">fu</code>: "Force + UTC", that is, use UTC instead of what the + <code class="inline-code">time_zone</code> or the + <code class="inline-code">sql_date_and_time_time_zone</code> + setting suggests. This also effects + <code class="inline-code">java.sql.Date</code> and + <code class="inline-code">java.sql.Time</code> values + </li> + + <li> + Neither: Use the time zone suggested by the + <code class="inline-code">time_zone</code> or the + <code class="inline-code">sql_date_and_time_time_zone</code> + configuration setting + </li> + </ul> + </li> + </ul> + + <p>Options from the same category are mutually exclusive, + like using <code class="inline-code">m</code> and <code class="inline-code">s</code> + together is an error.</p> + + <p>The options can be specified in any order.</p> + + <p>The accuracy and time zone offset visibility options + don't influence parsing, only formatting. For example, even + if you use <code class="inline-code">"iso m nz"</code>, + <code class="inline-code">"2012-01-01T15:30:05.125+01"</code> will be + parsed successfully and with milliseconds accuracy. The time + zone options (like <code class="inline-code">"u"</code>) influence what + time zone is chosen only when parsing a string that doesn't + contain time zone offset.</p> + + <p>Parsing with <code class="inline-code">"iso"</code> understands both + "extend format" and "basic + format", like <code class="inline-code">20141225T235018</code>. It + doesn't, however, support the parsing of all kind of ISO + 8601 strings: if there's a date part, it must use year, + month and day of the month values (not week of the year), + and the day can't be omitted.</p> + + <p>The output of <code class="inline-code">"iso"</code> is deliberately + so that it's also a good representation of the value with + XML Schema format, except for 0 and negative years, where + it's impossible. Also note that the time zone offset is + omitted for date values in the <code class="inline-code">"iso"</code> + format, while it's preserved for the <code class="inline-code">"xs"</code> + format.</p> + </li> + + <li> + <p><code class="inline-code">"short"</code>, + <code class="inline-code">"medium"</code>, <code class="inline-code">"long"</code>, or + <code class="inline-code">"full"</code>, which has locale-dependent + meaning defined by the Java platform (see in the <a href="http://docs.oracle.com/javase/7/docs/api/java/text/DateFormat.html">documentation + of <code>java.text.DateFormat</code></a>). For + date-time values, you can specify the length of the date and + time part independently, be separating them with + <code class="inline-code">_</code>, like + <code class="inline-code">"short_medium"</code>. + (<code class="inline-code">"medium"</code> means + <code class="inline-code">"medium_medium"</code> for date-time + values.)</p> + </li> + + <li> + <p>Values starting with <code class="inline-code">@</code> that's also + followed by a letter, refer to a <a href="pgui_config_custom_formats.html">custom format</a>, + like <code class="inline-code">"@worklog"</code> refers to the custom + format registered with the <code class="inline-code">"worklog"</code> + name. The format name is possibly followed by space or + <code class="inline-code">_</code> and then format parameters, whose + interpretation depends on the custom format. For backward + compatibility, the initial <code class="inline-code">@</code> only has + this new meaning if either <a href="pgui_config_incompatible_improvements.html#pgui_config_incompatible_improvements_how_to_set">the + <code>incompatible_improvements</code> setting</a> + is at least 2.3.24, or there's any custom formats defined. + When the initial <code class="inline-code">@</code> isn't followed by a + letter (any UNICODE letter), it's never treated as a + reference to a custom format.</p> + </li> + </ul> + </li> + + <li> + <p><code class="inline-code">time_zone</code>: The name of the time + zone used to format times for display. By default, the default + time zone of the JVM is used. Can be any value that is accepted + by <a href="http://docs.oracle.com/javase/7/docs/api/java/util/TimeZone.html">Java + TimeZone API</a>, or <code class="inline-code">"JVM default"</code> (since + FreeMarker 2.3.21) to use the JVM default time zone. Examples: + <code class="inline-code">"GMT"</code>, <code class="inline-code">"GMT+2"</code>, + <code class="inline-code">"GMT-1:30"</code>, <code class="inline-code">"CET"</code>, + <code class="inline-code">"PST"</code>, + <code class="inline-code">"America/Los_Angeles"</code>.</p> + + <div class="callout warning"> + <strong class="callout-label">Warning!</strong> + + <p>If you change this setting from its default value, you + should certainly also set + <code class="inline-code">sql_date_and_time_time_zone</code> to "JVM + default". <span class="marked-for-programmers">See more in the Java + API documentation of + <code class="inline-code">Configurable.setSQLDateAndTimeTimeZone(TimeZone)</code>.</span></p> + </div> + + </li> + + <li> + <p><code class="inline-code">sql_date_and_time_time_zone</code> + (since FreeMarker 2.3.21): This handles a highly technical + issue, so it should usually be set from the Java code by the + programmers. <span class="marked-for-programmers">For programmers: If + this is set to non-<code class="inline-code">null</code>, for date-only and + time-only values coming from SQL database (more precisely, for + <code class="inline-code">java.sql.Date</code> and + <code class="inline-code">java.sql.Time</code> objects) FreeMarker will use + this time zone instead of the time zone specified by the + <code class="inline-code">time_zone</code> FreeMarker setting. See more in the + Java API documentation of + <code class="inline-code">Configurable.setSQLDateAndTimeTimeZone(TimeZone)</code>.</span></p> + </li> + + <li> + <p><code class="inline-code">url_escaping_charset</code>: The + charset used for URL escaping (e.g. for + <code class="inline-code">${foo?url}</code>) to calculate the escaped + (<code class="inline-code">%<em class="code-color">XX</em></code>) parts. + Usually the framework that encloses FreeMarker should set it, so + you hardly ever should set this setting in templates. <span class="marked-for-programmers">(Programmers can read more about this + <a href="pgui_misc_charset.html">here...</a>)</span></p> + </li> + + <li> + <p><code class="inline-code">output_encoding</code>: Tells + FreeMarker what the charset of the output is. As FreeMarker + outputs a stream of UNICODE characters (<span class="marked-for-programmers">it writes into a + <code class="inline-code">java.io.Writer</code></span>), it's not affected + by the output encoding, but some macros/functions and built-ins + may want to used this information.</p> + </li> + + <li> + <p><code class="inline-code">classic_compatible</code>: This is for + experts. Its value should be a boolean. See the documentation of + <code class="inline-code">freemarker.template.Configurable</code> for more + information.</p> + </li> + </ul> + + <p>Example: Assume that the initial locale of template is + <code class="inline-code">de_DE</code> (German). Then this:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template">${1.2} +<#setting locale="en_US"> +${1.2}</pre></div> + + <p>will output this:</p> + + + +<div class="code-wrapper"><pre class="code-block code-output">1,2 +1.2</pre></div> + + <p>because German people use the comma as their decimal + separator, while US people use the dot.</p> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_outputformat.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_stop.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html>
http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/ref_directive_stop.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_directive_stop.html b/builds/2.3.26-nightly/ref_directive_stop.html new file mode 100644 index 0000000..6898671 --- /dev/null +++ b/builds/2.3.26-nightly/ref_directive_stop.html @@ -0,0 +1,96 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-section"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>stop - Apache FreeMarker Manual</title> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width,initial-scale=1"> +<meta name="format-detection" content="telephone=no"> +<meta property="og:site_name" content="Apache FreeMarker Manual"> +<meta property="og:title" content="stop"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_directive_stop.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_directive_stop.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache FreeMarker Manual"> + + <!--[if lte IE 9]> + <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div> + <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref.html"><span itemprop="name">Template Language Reference</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_directives.html"><span itemprop="name">Directive Reference</span></a></li><li class="step- 3" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_directive_stop.html"><span itemprop="name">stop</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","Template Language Reference","Directive Reference","stop"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="ref_directive_setting.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_switch.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_directive_stop" itemprop="headline">stop</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#autoid_126" data-menu-target="autoid_126">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_127" data-menu-target="autoid_127">Description</a></li></ul> </div><a name="ref.directive.stop"></a> + + + + +<h2 class="content-header header-section2" id="autoid_126">Synopsis</h2> + + + +<pre class="metaTemplate"><code class="inline-code"><#stop></code> +or +<code class="inline-code"><#stop <em class="code-color">reason</em>></code> +</pre> + + + <p>Where:</p> + + <ul> + <li> + <code class="inline-code"><em class="code-color">reason</em></code>: + Informative message that describes the reason of the terminating + error. Expression, must evaluate to a string. + </li> + </ul> + + + + + +<h2 class="content-header header-section2" id="autoid_127">Description</h2> + + + <p>Aborts template processing with the given (optional) error + message. <em>This must not be used for ending template + processing in normal situations!</em> The caller of the + FreeMarker template will see this as a failed template rendering, + not as a normally finished one.</p> + + <p><span class="marked-for-programmers">This directive throws a + <code class="inline-code">StopException</code>, and the + <code class="inline-code">StopException</code> will hold the value of the reason + parameter.</span></p> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_setting.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_switch.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/ref_directive_switch.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_directive_switch.html b/builds/2.3.26-nightly/ref_directive_switch.html new file mode 100644 index 0000000..9f4f1b3 --- /dev/null +++ b/builds/2.3.26-nightly/ref_directive_switch.html @@ -0,0 +1,162 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-section"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>switch, case, default, break - Apache FreeMarker Manual</title> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width,initial-scale=1"> +<meta name="format-detection" content="telephone=no"> +<meta property="og:site_name" content="Apache FreeMarker Manual"> +<meta property="og:title" content="switch, case, default, break"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_directive_switch.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_directive_switch.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache FreeMarker Manual"> + + <!--[if lte IE 9]> + <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div> + <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref.html"><span itemprop="name">Template Language Reference</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_directives.html"><span itemprop="name">Directive Reference</span></a></li><li class="step- 3" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_directive_switch.html"><span itemprop="name">switch, case, default, break</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","Template Language Reference","Directive Reference","switch, case, default, break"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="ref_directive_stop.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_t.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_directive_switch" itemprop="headline">switch, case, default, break</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#autoid_128" data-menu-target="autoid_128">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_129" data-menu-target="autoid_129">Description</a></li></ul> </div><a name="ref.directive.switch"></a><a name="ref.directive.case"></a><a name="ref.directive.default"></a><a name="ref.directive.switch.break"></a> + + + + +<h2 class="content-header header-section2" id="autoid_128">Synopsis</h2> + + + +<pre class="metaTemplate"> +<code class="inline-code"><#switch <em class="code-color">value</em>> + <#case <em class="code-color">refValue1</em>> + <em class="code-color">...</em> + <#break> + <#case <em class="code-color">refValue2</em>> + <em class="code-color">...</em> + <#break> + <em class="code-color">...</em> + <#case <em class="code-color">refValueN</em>> + <em class="code-color">...</em> + <#break> + <#default> + <em class="code-color">...</em> +</#switch> +</code> +</pre> + + + <p>Where:</p> + + <ul> + <li> + <code class="inline-code"><em class="code-color">value</em></code>, + <code class="inline-code"><em class="code-color">refValue1</em></code>, etc.: + Expressions evaluates to scalars of the same type. + </li> + </ul> + + <p>The <code class="inline-code">break</code>-s and <code class="inline-code">default</code> + are optional.</p> + + + + + +<h2 class="content-header header-section2" id="autoid_129">Description</h2> + + + <p>The usage of this directive is not recommended, as it's + error-prone because of the fall-through behavior. Use <a href="ref_directive_if.html#ref.directive.elseif"><code>elseif</code></a>-s + instead unless you want to exploit the fall-through behavior.</p> + + <p>Switch is used to choose a fragment of template depending on + the value of an expression:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#switch animal.size> + <#case "small"> + This will be processed if it is small + <#break> + <#case "medium"> + This will be processed if it is medium + <#break> + <#case "large"> + This will be processed if it is large + <#break> + <#default> + This will be processed if it is neither +</#switch></pre></div> + + <p>Inside the <code class="inline-code">switch</code> must be one or more + <code class="inline-code"><#case <em class="code-color">value</em>></code>, + and after all such <code class="inline-code">case</code> tags optionally one + <code class="inline-code"><#default></code>. When FM reaches the + <code class="inline-code">switch</code> directive, it chooses a + <code class="inline-code">case</code> directive where + <code class="inline-code"><em class="code-color">refValue</em></code> equals with + <code class="inline-code"><em class="code-color">value</em></code> and continues + the processing of the template there. If there is no + <code class="inline-code">case</code> directive with appropriate value then it + continues processing at the <code class="inline-code">default</code> directive if + that exists, otherwise it continues the processing after the end-tag + of <code class="inline-code">switch</code>. And now comes the confusing thing: + when it has chosen a <code class="inline-code">case</code> directive, it will + continue the processing there, and will go ahead until it reaches a + <code class="inline-code">break</code> directive. That is, it will not + automatically leave the <code class="inline-code">switch</code> directive when it + reaches another <code class="inline-code">case</code> directive or the + <code class="inline-code"><#default></code> tag. Example:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#switch x> + <#case 1> + 1 + <#case 2> + 2 + <#default> + d +</#switch></pre></div> + + <p>If <code class="inline-code">x</code> is 1, then it will print 1 2 d; if + <code class="inline-code">x</code> is 2 then it will print 2 d; if + <code class="inline-code">x</code> is 3 then it will print d. This is the + mentioned fall-through behavior. The <code class="inline-code">break</code> tag + instructs FM to immediately skip past the <code class="inline-code">switch</code> + end-tag.</p> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_stop.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_t.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/ref_directive_t.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_directive_t.html b/builds/2.3.26-nightly/ref_directive_t.html new file mode 100644 index 0000000..4ffd393 --- /dev/null +++ b/builds/2.3.26-nightly/ref_directive_t.html @@ -0,0 +1,149 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-section"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>t, lt, rt - Apache FreeMarker Manual</title> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width,initial-scale=1"> +<meta name="format-detection" content="telephone=no"> +<meta property="og:site_name" content="Apache FreeMarker Manual"> +<meta property="og:title" content="t, lt, rt"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_directive_t.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_directive_t.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache FreeMarker Manual"> + + <!--[if lte IE 9]> + <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div> + <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref.html"><span itemprop="name">Template Language Reference</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_directives.html"><span itemprop="name">Directive Reference</span></a></li><li class="step- 3" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_directive_t.html"><span itemprop="name">t, lt, rt</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","Template Language Reference","Directive Reference","t, lt, rt"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="ref_directive_switch.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_userDefined.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_directive_t" itemprop="headline">t, lt, rt</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#autoid_130" data-menu-target="autoid_130">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_131" data-menu-target="autoid_131">Description</a></li></ul> </div><a name="ref.directive.t"></a><a name="ref.directive.lt"></a><a name="ref.directive.rt"></a> + + + + +<h2 class="content-header header-section2" id="autoid_130">Synopsis</h2> + + + +<pre class="metaTemplate"> +<code class="inline-code"><#t></code> + +<code class="inline-code"><#lt></code> + +<code class="inline-code"><#rt></code></pre> + + + + + + +<h2 class="content-header header-section2" id="autoid_131">Description</h2> + + + <p>These directives, instruct FreeMarker to ignore certain + white-space in the line of the tag:</p> + + <ul> + <li> + <p><code class="inline-code">t</code> (for trim): Ignore all leading and + trailing white-space in this line.</p> + </li> + + <li> + <p><code class="inline-code">lt</code> (for left trim): Ignore all leading + white-space in this line.</p> + </li> + + <li> + <p><code class="inline-code">rt</code> (for right trim): Ignore all + trailing white-space in this line.</p> + </li> + </ul> + + <p>where:</p> + + <ul> + <li> + <p>"leading white-space" means all space and tab + (and other character that are white-space according to <a href="gloss.html#gloss.unicode">UNICODE</a>, except <a href="gloss.html#gloss.lineBreak">line breaks</a>) before the first + non-white-space character of the line.</p> + </li> + + <li> + <p>"trailing white-space" means all space and + tab (and other character that are white-space according to <a href="gloss.html#gloss.unicode">UNICODE</a>, except line breaks) + after the last non-white-space character of the line, + <em>and</em> the line break at the end of the + line.</p> + </li> + </ul> + + <p>It is important to understand that these directives examine + the template itself, and <em>not</em> the output what + the template generates when you merge it with the data-model. + <span class="marked-for-programmers">(That is, the white-space removal + happens on parse time.)</span></p> + + <p>For example this:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template">-- + 1 <#t> + 2<#t> + 3<#lt> + 4 + 5<#rt> + 6 +--</pre></div> + + <p>will output this:</p> + + + +<div class="code-wrapper"><pre class="code-block code-output">-- +1 23 + 4 + 5 6 +--</pre></div> + + <p>The placement of these directives inside the line has no + importance. That is, the effect will be the same regardless if you + put the directive at the beginning of the line, or at the end of the + line, or in the middle of the line.</p> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_switch.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_userDefined.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html> http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/ref_directive_userDefined.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_directive_userDefined.html b/builds/2.3.26-nightly/ref_directive_userDefined.html new file mode 100644 index 0000000..0646397 --- /dev/null +++ b/builds/2.3.26-nightly/ref_directive_userDefined.html @@ -0,0 +1,297 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-section"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>User-defined directive (<@...>) - Apache FreeMarker Manual</title> +<meta http-equiv="X-UA-Compatible" content="IE=edge"> +<meta name="viewport" content="width=device-width,initial-scale=1"> +<meta name="format-detection" content="telephone=no"> +<meta property="og:site_name" content="Apache FreeMarker Manual"> +<meta property="og:title" content="User-defined directive (<@...>)"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_directive_userDefined.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_directive_userDefined.html"> +<link rel="icon" href="favicon.png" type="image/png"> +<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Roboto:500,700,400,300|Droid+Sans+Mono"> +<link rel="stylesheet" type="text/css" href="docgen-resources/docgen.min.css?1489402528979"> +<script> +(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ +(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), +m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) +})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); +ga('create', 'UA-55420501-1', 'auto'); +ga('send', 'pageview'); +</script> +</head> +<body itemscope itemtype="https://schema.org/Code"> + <meta itemprop="url" content="http://freemarker.org/docs/"> + <meta itemprop="name" content="Apache FreeMarker Manual"> + + <!--[if lte IE 9]> + <div style="background-color: #C00; color: #fff; padding: 12px 24px;">Please use a modern browser to view this website.</div> + <![endif]--><div class="header-top-bg"><div class="site-width header-top"><a class="logo" href="http://freemarker.org" role="banner"> <img itemprop="image" src="logo.png" alt="FreeMarker"> +</a><ul class="tabs"><li><a href="http://freemarker.org/">Home</a></li><li class="current"><a href="index.html">Manual</a></li><li><a class="external" href="api/index.html">Java API</a></li></ul><ul class="secondary-tabs"><li><a class="tab icon-heart" href="http://freemarker.org/contribute.html" title="Contribute"><span>Contribute</span></a></li><li><a class="tab icon-bug" href="https://issues.apache.org/jira/browse/FREEMARKER/" title="Report a Bug"><span>Report a Bug</span></a></li><li><a class="tab icon-download" href="http://freemarker.org/freemarkerdownload.html" title="Download"><span>Download</span></a></li></ul></div></div><div class="header-bottom-bg"><div class="site-width search-row"><a href="index.html" class="navigation-header">Manual</a><div class="navigation-header"></div><form method="get" class="search-form" action="search-results.html"><fieldset><legend class="sr-only">Search form</legend><label for="search-field" class="sr-only">Search query</label><input id="searc h-field" name="q" type="search" class="search-input" placeholder="Search" spellcheck="false" autocorrect="off" autocomplete="off"><button type="submit" class="search-btn"><span class="sr-only">Search</span></button></fieldset></form></div><div class="site-width breadcrumb-row"><ul class="breadcrumb" itemscope itemtype="http://schema.org/BreadcrumbList"><li class="step-0" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="index.html"><span itemprop="name">Apache FreeMarker Manual</span></a></li><li class="step-1" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref.html"><span itemprop="name">Template Language Reference</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_directives.html"><span itemprop="name">Directive Reference</span></a></li><li class="step- 3" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="ref_directive_userDefined.html"><span itemprop="name">User-defined directive (<@...>)</span></a></li></ul><div class="bookmarks" title="Bookmarks"><span class="sr-only">Bookmarks:</span><ul class="bookmark-list"><li><a href="alphaidx.html">Alpha. index</a></li><li><a href="gloss.html">Glossary</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions</a></li><li><a href="ref_builtins_alphaidx.html">?builtins</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_specvar.html">.spec_vars</a></li><li><a href="app_faq.html">FAQ</a></li></ul></div></div></div> <div class="main-content site-width"> + <div class="content-wrapper"> + <div id="table-of-contents-wrapper" class="col-left"> + <script>var breadcrumb = ["Apache FreeMarker Manual","Template Language Reference","Directive Reference","User-defined directive (<@...>)"];</script> + <script src="toc.js?1489402528979"></script> + <script src="docgen-resources/main.min.js?1489402528979"></script> + </div> +<div class="col-right"><div class="page-content"><div class="page-title"><div class="pagers top"><a class="paging-arrow previous" href="ref_directive_t.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_visit.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_directive_userDefined" itemprop="headline">User-defined directive (<@...>)</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#autoid_132" data-menu-target="autoid_132">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_133" data-menu-target="autoid_133">Description</a><ul><li><a class="page-menu-link" href="#ref_directive_userDefined_entTag" data-menu-target="ref_directive_userDefined_entTag">End-tag</a></li><li><a class="page-menu-link" href="#ref_directive_userDefined_loopVar" data-menu-target="ref_directive_userDefined_loopVar">Loop variables</a></li><li><a class="page-menu-link" href="#ref_directive_userDefined_positionalParam" data-menu-target="ref_directive_userDefined_positionalParam">Positional parameter passing</a></li></ul></li></ul> </div><a name="ref.directive.userDefined"></a> + + + + +<h2 class="content-header header-section2" id="autoid_132">Synopsis</h2> + + + +<pre class="metaTemplate"> +<code class="inline-code"><@<em class="code-color">user_def_dir_exp</em> <em class="code-color">param1</em>=<em class="code-color">val1</em> <em class="code-color">param2</em>=<em class="code-color">val2</em> <em class="code-color">...</em> <em class="code-color">paramN</em>=<em class="code-color">valN</em>/></code> +(Note the XML-style <code class="inline-code">/</code> before the <code class="inline-code">></code>) +or if you need loop variables (<a href="#ref_directive_userDefined_loopVar">more details...</a>) +<code class="inline-code"><@<em class="code-color">user_def_dir_exp</em> <em class="code-color">param1</em>=<em class="code-color">val1</em> <em class="code-color">param2</em>=<em class="code-color">val2</em> <em class="code-color">...</em> <em class="code-color">paramN</em>=<em class="code-color">valN</em> ; <em class="code-color">lv1</em>, <em class="code-color">lv2</em>, <em class="code-color">...</em>, <em class="code-color">lvN</em>/></code> + +Or the same as the above two but with end-tag (<a href="#ref_directive_userDefined_entTag">more details...</a>): + +<code class="inline-code"><@<em class="code-color">user_def_dir_exp</em> <em class="code-color">...</em>> + ... +</@<em class="code-color">user_def_dir_exp</em>></code> +or +<code class="inline-code"><@<em class="code-color">user_def_dir_exp</em> <em class="code-color">...</em>> + ... +</@></code> + +Or all above but with positional parameter passing (<a href="#ref_directive_userDefined_positionalParam">more details...</a>): + +<code class="inline-code"><@<em class="code-color">user</em> <em class="code-color">val1</em>, <em class="code-color">val2</em>, <em class="code-color">...</em>, <em class="code-color">valN</em>/></code> +...etc. +</pre> + + + <p>Where:</p> + + <ul> + <li> + <code class="inline-code"><em class="code-color">user_def_dir_exp</em></code>: + Expression evaluates to an user-defined directive (for example a + macro), that will be called. + </li> + + <li> + <code class="inline-code"><em class="code-color">param1</em></code>, + <code class="inline-code"><em class="code-color">param2</em></code>, ...etc.: + The name of parameters. They are <em>not</em> + expressions. + </li> + + <li> + <code class="inline-code"><em class="code-color">val1</em></code>, + <code class="inline-code"><em class="code-color">val2</em></code>, ...etc.: The + value of parameters. They <em>are</em> + expressions. + </li> + + <li> + <code class="inline-code"><em class="code-color">lv1</em></code>, + <code class="inline-code"><em class="code-color">lv2</em></code>, ...etc.: The + name of <a href="dgui_misc_var.html">loop variables</a>. + They are <em>not</em> expressions. + </li> + </ul> + + <p>The number of parameters can be 0 (i.e. no parameters).</p> + + <p>The order of parameters is not significant (unless you use + positional parameter passing). The name of parameters must be + unique. Lower- and uppercase letters are considered as different + letters in parameter names (i.e. <code class="inline-code">Color</code> and + <code class="inline-code">color</code> is not the same).</p> + + + + + +<h2 class="content-header header-section2" id="autoid_133">Description</h2> + + + <p>This will call an user-defined directive, for example a macro. + The meaning of parameters, and the set of supported and required + parameters depend on the concrete user-defined directive.</p> + + <p>You may read <a href="dgui_misc_userdefdir.html">the tutorial + about user-defined directives</a>.</p> + + <p>Example 1: Calls the directive that is stored in the variable + <code class="inline-code">html_escape</code>:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><@html_escape> + a < b + Romeo & Juliet +</@html_escape></pre></div> + + <p>Output:</p> + + + +<div class="code-wrapper"><pre class="code-block code-output"> a &lt; b + Romeo &amp; Juliet</pre></div> + + <p>Example 2: Calls a macro with parameters:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><@list items=["mouse", "elephant", "python"] title="Animals"/> +<em>...</em> +<#macro list title items> + <p>${title?cap_first}: + <ul> + <#list items as x> + <li>${x?cap_first} + </#list> + </ul> +</#macro></pre></div> + + <p>Output:</p> + + + +<div class="code-wrapper"><pre class="code-block code-output"> <p>Animals: + <ul> + <li>Mouse + <li>Elephant + <li>Python + </ul> + +<em>...</em></pre></div> + + + + + + +<h3 class="content-header header-section3" id="ref_directive_userDefined_entTag">End-tag</h3> + + + <p>You can omit the + <code class="inline-code"><em class="code-color">user_def_dir_exp</em></code> in + the <a href="gloss.html#gloss.endTag">end-tag</a>. That is, you can + always write <code class="inline-code"></@></code> instead of + <code class="inline-code"></@<em class="code-color">anything</em>></code>. + This rule is mostly useful when the + <code class="inline-code"><em class="code-color">user_def_dir_exp</em></code> + expression is too complex, because you don't have to repeat the + expression in the end-tag. Furthermore, if the expression contains + other than simple variable names and dots, you are not allowed to + repeat the expression. For example, + <code class="inline-code"><@a_hash[a_method()]><em class="code-color">...</em></@a_hash[a_method()]></code> + is an error; you must write + <code class="inline-code"><@a_hash[a_method()]><em class="code-color">...</em></@></code>. + But + <code class="inline-code"><@a_hash.foo><em class="code-color">...</em></@a_hash.foo></code> + is OK.</p> + + + + + + + +<h3 class="content-header header-section3" id="ref_directive_userDefined_loopVar">Loop variables</h3> + + + <p>Some user-defined directives create loop variables + (similarly to <code class="inline-code">list</code> directive). As with the + predefined directives (as <code class="inline-code">list</code>) the + <em>name</em> of loop variables is given when you call + the directive (as <code class="inline-code">foo</code> in <code class="inline-code"><#list + foos as + foo><em class="code-color">...</em></#list></code>), + while the <em>value</em> of the variable is set by the + directive itself. In the case of user-defined directives the + syntax is that the name of loop variables is given after a + semicolon. For example:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><@myRepeatMacro count=4 ; <strong>x, last</strong>> + ${<strong>x</strong>}. Something... <#if <strong>last</strong>> This was the last!</#if> +</@myRepeatMacro></pre></div> + + <p>Note that the number of loop variable created by the + user-defined directive and the number of loop variables specified + after the semicolon need not match. Say, if you are not interested + if the repetition is the last, you can simply write:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><@myRepeatMacro count=4 ; <strong>x</strong>> + ${<strong>x</strong>}. Something... +</@myRepeatMacro></pre></div> + + <p>or you can even:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><@myRepeatMacro count=4> + Something... +</@myRepeatMacro></pre></div> + + <p>Furthermore, it does not cause error if you specify more + loop variables after the semicolon than the user-defined directive + creates, just the last few loop variables will not be created + (i.e. those will be undefined in the nested content). Trying to + use the undefined loop variables, however, will cause error + (unless you use built-ins like <code class="inline-code">?default</code>), since + you try to access a non-existing variable.</p> + + <p>See the <a href="dgui_misc_userdefdir.html">the tutorial + about user-defined directives</a> for more explanation.</p> + + + + + + + +<h3 class="content-header header-section3" id="ref_directive_userDefined_positionalParam">Positional parameter passing</h3> + + + + + <p>Positional parameter passing (as <code class="inline-code"><@heading + "Preface", 1/></code>) is a shorthand form of normal named + parameter passing (as <code class="inline-code"><@heading title="Preface" + level=1/></code>), where you omit the parameter name. This + shorthand form should be used if a user-defined directive has only + one parameter, or if it is easy to remember the order of + parameters for a frequently used user-defined directive. To use + this form, you have to know the order in which the named + parameters are declared (trivial if the directive has only one + parameter). Say, if <code class="inline-code">heading</code> was created as + <code class="inline-code"><#macro heading title + level><em class="code-color">...</em></code>, then + <code class="inline-code"><@heading "Preface", 1/></code> is equivalent + with <code class="inline-code"><@heading title="Preface" level=1/></code> + (or <code class="inline-code"><@heading level=1 title="Preface"/></code>; + if you use parameter names, the order is not important). Note that + positional parameter passing is currently only supported for + macros.</p> + + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_t.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_visit.html"><span>Next</span></a></div></div></div></div> </div> + </div> +<div class="site-footer"><div class="site-width"><div class="footer-top"><div class="col-left sitemap"><div class="column"><h3 class="column-header">Overview</h3><ul><li><a href="http://freemarker.org/">What is FreeMarker?</a></li><li><a href="http://freemarker.org/freemarkerdownload.html">Download</a></li><li><a href="app_versions.html">Version history</a></li><li><a href="http://freemarker.org/history.html">About us</a></li><li><a itemprop="license" href="app_license.html">License</a></li></ul></div><div class="column"><h3 class="column-header">Handy stuff</h3><ul><li><a href="http://freemarker-online.kenshoo.com/">Try template online</a></li><li><a href="dgui_template_exp.html#exp_cheatsheet">Expressions cheatsheet</a></li><li><a href="ref_directive_alphaidx.html">#directives</a></li><li><a href="ref_builtins_alphaidx.html">?built_ins</a></li><li><a href="ref_specvar.html">.special_vars</a></li></ul></div><div class="column"><h3 class="column-header">Community</h3><ul><li><a href ="https://github.com/freemarker/freemarker">FreeMarker on Github</a></li><li><a href="https://twitter.com/freemarker">Follow us on Twitter</a></li><li><a href="https://issues.apache.org/jira/browse/FREEMARKER/">Report a bug</a></li><li><a href="http://stackoverflow.com/questions/ask?tags=freemarker">Ask a question</a></li><li><a href="http://freemarker.org/mailing-lists.html">Mailing lists</a></li></ul></div></div><div class="col-right"><ul class="social-icons"><li><a class="github" href="https://github.com/freemarker/freemarker">Github</a></li><li><a class="twitter" href="https://twitter.com/freemarker">Twitter</a></li><li><a class="stack-overflow" href="http://stackoverflow.com/questions/ask?tags=freemarker">Stack Overflow</a></li></ul><a class="xxe" href="http://www.xmlmind.com/xmleditor/" rel="nofollow" title="Edited with XMLMind XML Editor"><span>Edited with XMLMind XML Editor</span></a></div></div><div class="footer-bottom"> <p class="last-generated"> +Last generated: +<time itemprop="dateModified" datetime="2017-03-13T10:55:28Z" title="Monday, March 13, 2017 10:55:28 AM GMT">2017-03-13 10:55:28 GMT</time>, for Freemarker 2.3.26 </p> +<p class="copyright"> +© <span itemprop="copyrightYear">1999</span>â2017 +<a itemtype="http://schema.org/Organization" itemprop="copyrightHolder" href="http://apache.org/">The Apache Software Foundation</a>. Apache FreeMarker, FreeMarker, Apache Incubator, Apache, the Apache FreeMarker logo are trademarks of The Apache Software Foundation. </p> +</div></div></div></body> +</html>
