freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [21/50] incubator-freemarker-site git commit: 2.3.26-nightly docs preview
Date Mon, 13 Mar 2017 10:57:57 GMT
http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/ref_directive_if.html
----------------------------------------------------------------------
diff --git a/builds/2.3.26-nightly/ref_directive_if.html b/builds/2.3.26-nightly/ref_directive_if.html
new file mode 100644
index 0000000..99de82d
--- /dev/null
+++ b/builds/2.3.26-nightly/ref_directive_if.html
@@ -0,0 +1,196 @@
+<!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>if, else, elseif - 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="if, else, elseif">
+<meta property="og:locale" content="en_US">
+<meta property="og:url" content="http://freemarker.org/docs/ref_directive_if.html">
+<link rel="canonical" href="http://freemarker.org/docs/ref_directive_if.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_if.html"><span itemprop="name">if, else, elseif</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","if, else, elseif"];</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_global.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_import.html"><span>Next</span></a></div><div class="title-wrapper">
+<h1 class="content-header header-section1" id="ref_directive_if" itemprop="headline">if, else, elseif</h1>
+</div></div><div class="page-menu">
+<div class="page-menu-title">Page Contents</div>
+<ul><li><a class="page-menu-link" href="#autoid_94" data-menu-target="autoid_94">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_95" data-menu-target="autoid_95">Description</a></li></ul> </div><a name="ref.directive.if"></a><a name="ref.directive.else"></a><a name="ref.directive.elseif"></a>
+          
+
+
+
+<h2 class="content-header header-section2" id="autoid_94">Synopsis</h2>
+
+
+          
+<pre class="metaTemplate">
+<code class="inline-code">&lt;#if <em class="code-color">condition</em>&gt;
+  <em class="code-color">...</em>
+&lt;#elseif <em class="code-color">condition2</em>&gt;
+  <em class="code-color">...</em>
+&lt;#elseif <em class="code-color">condition3</em>&gt;
+  <em class="code-color">...</em>
+<em class="code-color">...</em>
+&lt;#else&gt;
+  <em class="code-color">...</em>
+&lt;/#if&gt;</code>
+</pre>
+
+
+          <p>Where:</p>
+
+          <ul>
+            <li>
+              <code class="inline-code"><em class="code-color">condition</em></code>,
+              <code class="inline-code"><em class="code-color">condition2</em></code>,
+              ...etc.: Expression evaluates to a boolean value.
+            </li>
+          </ul>
+
+          <p>The <code class="inline-code">elseif</code>-s and the
+          <code class="inline-code">else</code> are optional.</p>
+
+          <p>Camel case name variant: <code class="inline-code">elseIf</code></p>
+        
+          
+
+
+
+<h2 class="content-header header-section2" id="autoid_95">Description</h2>
+
+
+          <p>You can use <code class="inline-code">if</code>, <code class="inline-code">elseif</code>
+          and <code class="inline-code">else</code> directives to conditionally skip a
+          section of the template. The
+          <code class="inline-code"><em class="code-color">condition</em></code>-s must
+          evaluate to a boolean value, or else an error will abort template
+          processing. The <code class="inline-code">elseif</code>-s and
+          <code class="inline-code">else</code>-s must occur inside <code class="inline-code">if</code>
+          (that is, between the <code class="inline-code">if</code> start-tag and end-tag).
+          The <code class="inline-code">if</code> can contain any number of
+          <code class="inline-code">elseif</code>-s (including 0) and at the end optionally
+          one <code class="inline-code">else</code>. Examples:</p>
+
+          <p><code class="inline-code">if</code> with 0 <code class="inline-code">elseif</code> and no
+          <code class="inline-code">else</code>:</p>
+
+          
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#if x == 1&gt;
+  x is 1
+&lt;/#if&gt;</pre></div>
+
+          <p><code class="inline-code">if</code> with 0 <code class="inline-code">elseif</code> and
+          <code class="inline-code">else</code>:</p>
+
+          
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#if x == 1&gt;
+  x is 1
+&lt;#else&gt;
+  x is not 1
+&lt;/#if&gt;</pre></div>
+
+          <p><code class="inline-code">if</code> with 2 <code class="inline-code">elseif</code> and no
+          <code class="inline-code">else</code>:</p>
+
+          
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#if x == 1&gt;
+  x is 1
+&lt;#elseif x == 2&gt;
+  x is 2
+&lt;#elseif x == 3&gt;
+  x is 3
+&lt;/#if&gt;</pre></div>
+
+          <p><code class="inline-code">if</code> with 3 <code class="inline-code">elseif</code> and
+          <code class="inline-code">else</code>:</p>
+
+          
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#if x == 1&gt;
+  x is 1
+&lt;#elseif x == 2&gt;
+  x is 2
+&lt;#elseif x == 3&gt;
+  x is 3
+&lt;#elseif x == 4&gt;
+  x is 4
+&lt;#else&gt;
+  x is not 1 nor 2 nor 3 nor 4
+&lt;/#if&gt;</pre></div>
+
+          <p>To see more about boolean expressions, see: <a href="dgui_template_exp.html">Template Author&#39;s Guide/The Template/Expressions</a>.</p>
+
+          <p>You can nest <code class="inline-code">if</code> directives (of
+          course):</p>
+
+          
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#if x == 1&gt;
+  x is 1
+  &lt;#if y == 1&gt;
+    and y is 1 too
+  &lt;#else&gt;
+    but y is not
+  &lt;/#if&gt;
+&lt;#else&gt;
+  x is not 1
+  &lt;#if y &lt; 0&gt;
+    and y is less than 0
+  &lt;/#if&gt;
+&lt;/#if&gt;</pre></div>
+
+            <div class="callout note">
+    <strong class="callout-label">Note:</strong>
+
+            <p>When you want to test if <code class="inline-code">x &gt; 0</code> or
+            <code class="inline-code">x &gt;= 0</code>, writing <code class="inline-code">&lt;#if x &gt;
+            0&gt;</code> and <code class="inline-code">&lt;#if x &gt;= 0&gt;</code> is
+            WRONG, as the first <code class="inline-code">&gt;</code> will close the
+            <code class="inline-code">#if</code> tag. To work that around, write
+            <code class="inline-code">&lt;#if x gt 0&gt;</code> or <code class="inline-code">&lt;#if gte
+            0&gt;</code>. Also note that if the comparison occurs inside
+            parentheses, you will have no such problem, like <code class="inline-code">&lt;#if
+            foo.bar(x &gt; 0)&gt;</code> works as expected.</p>
+            </div>
+
+        <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_global.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_import.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_import.html
----------------------------------------------------------------------
diff --git a/builds/2.3.26-nightly/ref_directive_import.html b/builds/2.3.26-nightly/ref_directive_import.html
new file mode 100644
index 0000000..965f033
--- /dev/null
+++ b/builds/2.3.26-nightly/ref_directive_import.html
@@ -0,0 +1,153 @@
+<!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>import - 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="import">
+<meta property="og:locale" content="en_US">
+<meta property="og:url" content="http://freemarker.org/docs/ref_directive_import.html">
+<link rel="canonical" href="http://freemarker.org/docs/ref_directive_import.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_import.html"><span itemprop="name">import</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","import"];</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_if.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_include.html"><span>Next</span></a></div><div class="title-wrapper">
+<h1 class="content-header header-section1" id="ref_directive_import" itemprop="headline">import</h1>
+</div></div><div class="page-menu">
+<div class="page-menu-title">Page Contents</div>
+<ul><li><a class="page-menu-link" href="#autoid_96" data-menu-target="autoid_96">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_97" data-menu-target="autoid_97">Description</a></li></ul> </div><a name="ref.directive.import"></a>
+          
+
+
+
+<h2 class="content-header header-section2" id="autoid_96">Synopsis</h2>
+
+
+          
+<pre class="metaTemplate"><code class="inline-code">&lt;#import <em class="code-color">path</em> as <em class="code-color">hash</em>&gt;</code>
+</pre>
+
+
+          <p>Where:</p>
+
+          <ul>
+            <li>
+              <code class="inline-code"><em class="code-color">path</em></code>: The
+              path of a template. This is an expression that evaluates to a
+              string. (With other words, it doesn&#39;t have to be a fixed string,
+              it can also be something like, for example,
+              <code class="inline-code">profile.baseDir + &quot;/menu.ftl&quot;</code>.)
+            </li>
+
+            <li>
+              <code class="inline-code"><em class="code-color">hash</em></code>: The
+              unquoted name of hash variable by which you can access the
+              namespace. Not an expression. (If you have to import into a
+              dynamically constructed name, you have to use <a href="app_faq.html#faq_assign_to_dynamic_variable_name">this
+              trick</a>.)
+            </li>
+          </ul>
+        
+          
+
+
+
+<h2 class="content-header header-section2" id="autoid_97">Description</h2>
+
+
+          <p>Imports a library. That is, it creates a new empty namespace,
+          and then executes the template given with
+          <code class="inline-code"><em class="code-color">path</em></code> parameter in that
+          namespace so the template populates the namespace with variables
+          (macros, functions, ...etc.). Then it makes the newly created
+          namespace available to the caller with a hash variable. The hash
+          variable will be created as a plain variable in the namespace used
+          by the caller of <code class="inline-code">import</code> (as if you would create
+          it with <code class="inline-code">assign</code> directive), with the name given
+          with the <code class="inline-code"><em class="code-color">hash</em></code>
+          parameter. If the import happens in the namespace of the main
+          template, the hash variable is also created in the global
+          namespace.</p>
+
+          <p>If you call <code class="inline-code">import</code> with the same
+          <code class="inline-code"><em class="code-color">path</em></code> for multiple
+          times, it will create the namespace and run the template for the
+          very first call of <code class="inline-code">import</code> only. The later calls
+          will just create a hash by which you can access the
+          <em>same</em> namespace.</p>
+
+          <p>The output printed by the imported template will be ignored
+          (will not be inserted at the place of importing). The template is
+          executed to populate the namespace with variables, and not to write
+          to the output.</p>
+
+          <p>Example:</p>
+
+          
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#import &quot;/libs/mylib.ftl&quot; as my&gt;
+
+&lt;@my.copyright date=&quot;1999-2002&quot;/&gt;</pre></div>
+
+          <p>The <code class="inline-code"><em class="code-color">path</em></code>
+          parameter can be a relative path like <code class="inline-code">&quot;foo.ftl&quot;</code>
+          and <code class="inline-code">&quot;../foo.ftl&quot;</code>, or an absolute like
+          <code class="inline-code">&quot;/foo.ftl&quot;</code>. Relative paths are relative to the
+          directory of the template that uses the <code class="inline-code">import</code>
+          directive. Absolute paths are relative to a base (often referred as
+          the &#39;&#39;root directory of the templates&#39;&#39;) that the programmer defines
+          when he configures FreeMarker.</p>
+
+          <p>Always use <code class="inline-code">/</code> (slash) to separate path
+          components, never <code class="inline-code">\</code> (backslash). If you are
+          loading templates from your local file system and it uses
+          backslashes (like under. Windows), FreeMarker will convert them
+          automatically.</p>
+
+          <p>Like with the <code class="inline-code">include</code> directive, <a href="ref_directive_include.html#ref_directive_include_acquisition">acquisition</a> and
+          <a href="ref_directive_include.html#ref_directive_include_localized">localized
+          lookup</a> may be used for resolving the path.</p>
+
+          <p><span class="marked-for-programmers">Note, that it is possible to
+          automatically do the commonly used imports for all templates, with
+          the &quot;auto imports&quot; setting of
+          <code class="inline-code">Configuration</code>.</span></p>
+
+          <p>If you are new to namespaces, you should read: <a href="dgui_misc_namespace.html">Template Author&#39;s Guide/Miscellaneous/Namespaces</a></p>
+        <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_if.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_include.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_include.html
----------------------------------------------------------------------
diff --git a/builds/2.3.26-nightly/ref_directive_include.html b/builds/2.3.26-nightly/ref_directive_include.html
new file mode 100644
index 0000000..ebfb785
--- /dev/null
+++ b/builds/2.3.26-nightly/ref_directive_include.html
@@ -0,0 +1,449 @@
+<!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>include - 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="include">
+<meta property="og:locale" content="en_US">
+<meta property="og:url" content="http://freemarker.org/docs/ref_directive_include.html">
+<link rel="canonical" href="http://freemarker.org/docs/ref_directive_include.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_include.html"><span itemprop="name">include</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","include"];</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_import.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_list.html"><span>Next</span></a></div><div class="title-wrapper">
+<h1 class="content-header header-section1" id="ref_directive_include" itemprop="headline">include</h1>
+</div></div><div class="page-menu">
+<div class="page-menu-title">Page Contents</div>
+<ul><li><a class="page-menu-link" href="#autoid_98" data-menu-target="autoid_98">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_99" data-menu-target="autoid_99">Description</a><ul><li><a class="page-menu-link" href="#ref_directive_include_acquisition" data-menu-target="ref_directive_include_acquisition">Using acquisition</a></li><li><a class="page-menu-link" href="#ref_directive_include_localized" data-menu-target="ref_directive_include_localized">Localized lookup</a></li></ul></li></ul> </div><a name="ref.directive.include"></a>
+          
+
+
+
+<h2 class="content-header header-section2" id="autoid_98">Synopsis</h2>
+
+
+          
+<pre class="metaTemplate">
+<code class="inline-code">&lt;#include <em class="code-color">path</em>&gt;</code>
+or
+<code class="inline-code">&lt;#include <em class="code-color">path</em> <em class="code-color">options</em>&gt;</code>
+</pre>
+
+
+          <p>Where:</p>
+
+          <ul>
+            <li>
+              <code class="inline-code"><em class="code-color">path</em></code>: The
+              path of the file to include; an expression that evaluates to a
+              string. (With other words, it doesn&#39;t have to be a fixed string,
+              it can also be something like, for example,
+              <code class="inline-code">profile.baseDir + &quot;/menu.ftl&quot;</code>.)
+            </li>
+
+            <li>
+              <code class="inline-code"><em class="code-color">options</em></code>: One
+              or more of these:
+              <code class="inline-code">encoding=<em class="code-color">encoding</em></code>,
+              <code class="inline-code">parse=<em class="code-color">parse</em></code>
+
+              <ul>
+                <li>
+                  <code class="inline-code"><em class="code-color">encoding</em></code>:
+                  Expression evaluates to string
+                </li>
+
+                <li>
+                  <code class="inline-code"><em class="code-color">parse</em></code>:
+                  Expression evaluates to boolean (also accepts a few string
+                  values for backward compatibility)
+                </li>
+
+                <li>
+                  <code class="inline-code"><em class="code-color">ignore_missing</em></code>:
+                  Expression evaluates to boolean
+                </li>
+              </ul>
+            </li>
+          </ul>
+        
+          
+
+
+
+<h2 class="content-header header-section2" id="autoid_99">Description</h2>
+
+
+          <p>You can use it to insert another FreeMarker template file
+          (specified by the <code class="inline-code"><em class="code-color">path</em></code>
+          parameter) into your template. The output from the included template
+          is inserted at the point where the <code class="inline-code">include</code> tag
+          occurs. The included file shares the variables with the including
+          template, similarly like if it was copy-pasted into it. The
+          <code class="inline-code">include</code> directive is not really replaced by the
+          content of the included file, instead it processes the included file
+          each time when FreeMarker reaches the <code class="inline-code">include</code>
+          directive in the course of template processing. So for example if
+          the <code class="inline-code">include</code> is inside a <code class="inline-code">list</code>
+          loop, you can specify different file names in each cycle.</p>
+
+            <div class="callout note">
+    <strong class="callout-label">Note:</strong>
+
+            <p>This directive is not be confused with the JSP (Servlet)
+            include, as it doesn&#39;t involve the Servlet container at all, just
+            processes another FreeMarker template, without &quot;leaving&quot;
+            FreeMarker. Regarding how to do a &quot;JSP include&quot; <a href="app_faq.html#faq_servlet_include">read this...</a></p>
+            </div>
+
+
+          <p>The <code class="inline-code"><em class="code-color">path</em></code>
+          parameter can be a relative path like <code class="inline-code">&quot;foo.ftl&quot;</code>
+          and <code class="inline-code">&quot;../foo.ftl&quot;</code>, or an absolute like
+          <code class="inline-code">&quot;/foo.ftl&quot;</code>. Relative paths are relative to the
+          directory of the template that contains the
+          <code class="inline-code">import</code> directive. Absolute paths are relative to
+          a base (often referred as the &#39;root directory of the templates&#39;)
+          that the programmer defines when he configures FreeMarker.</p>
+
+            <div class="callout note">
+    <strong class="callout-label">Note:</strong>
+
+            <p>This is different than the way it worked prior FreeMarker
+            2.1, where the path was always absolute. To preserve the old
+            behavior, enable the classic compatible mode in the
+            <code class="inline-code">Configuration</code> object.</p>
+            </div>
+
+
+          <p>Always use <code class="inline-code">/</code> (slash) to separate path
+          components, never <code class="inline-code">\</code> (backslash). Even if you are
+          loading templates from your local file system and it uses
+          backslashes (like under. Windows), use <code class="inline-code">/</code>.</p>
+
+          <p>Example:</p>
+
+          <p>Assume /common/copyright.ftl contains:</p>
+
+          
+
+<div class="code-wrapper"><pre class="code-block code-template">Copyright 2001-2002 ${me}&lt;br&gt;
+All rights reserved.</pre></div>
+
+          <p>Then this:</p>
+
+          
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#assign me = &quot;Juila Smith&quot;&gt;
+&lt;h1&gt;Some test&lt;/h1&gt;
+&lt;p&gt;Yeah.
+&lt;hr&gt;
+<strong>&lt;#include &quot;/common/copyright.ftl&quot;&gt;</strong></pre></div>
+
+          <p>will output this:</p>
+
+          
+
+<div class="code-wrapper"><pre class="code-block code-output">&lt;h1&gt;Some test&lt;/h1&gt;
+&lt;p&gt;Yeah.
+&lt;hr&gt;
+<strong>Copyright 2001-2002 Juila Smith
+All rights reserved.</strong></pre></div>
+
+          <p>The supported
+          <code class="inline-code"><em class="code-color">options</em></code> are:</p>
+
+          <ul>
+            <li>
+              <p><code class="inline-code">parse</code>: If it is
+              <code class="inline-code">true</code>, then the included file will be parsed
+              as FTL, otherwise the whole file will be considered as simple
+              text (i.e, no FreeMarker constructs will be searched in it). If
+              you omit this option, then it defaults to
+              <code class="inline-code">true</code>.</p>
+            </li>
+
+            <li>
+              <p><code class="inline-code">encoding</code>: The encoding (charset) of the
+              included template. You shouldn&#39;t use this option anymore; if
+              different template use different encodings, then the programmers
+              should associated the encoding to the templates via
+              <code class="inline-code">Configuration.setTemplateConfigurations(<em class="code-color">...</em>)</code>-s
+              (which also overrides that you specify here). If
+              <code class="inline-code">Configuration.setTemplateConfigurations(<em class="code-color">...</em>)</code>
+              doesn&#39;t specify an encoding for the included template, then the
+              included file inherits the encoding (the charset) of the
+              top-level template, unless you specify an encoding with this
+              option. Examples of valid names: UTF-8, ISO-8859-1, ISO-8859-2,
+              Shift_JIS, Big5, EUC-KR, GB2312. <span class="marked-for-programmers">Encoding names are the same as the ones
+              supported be java.io.InputStreamReader (as of Java API 1.3:
+              MIME-preferred charset names from the IANA Charset
+              Registry)</span></p>
+            </li>
+
+            <li>
+              <p><code class="inline-code">ignore_missing</code>: When
+              <code class="inline-code">true</code>, suppresses the error when the template
+              to include is missing, instead <code class="inline-code">&lt;#include
+              ...&gt;</code> will print nothing. When
+              <code class="inline-code">false</code>, the template processing will stop with
+              error if the template is missing. If you omit this option, then
+              it defaults to <code class="inline-code">false</code>.</p>
+            </li>
+          </ul>
+
+          <p>Example:</p>
+
+          
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#include &quot;/common/navbar.html&quot; parse=false encoding=&quot;Shift_JIS&quot;&gt;</pre></div>
+
+          <p><span class="marked-for-programmers">Note, that it is possible to
+          automatically do the commonly used inclusions for all templates,
+          with the &quot;auto includes&quot; setting of
+          <code class="inline-code">Configuration</code>.</span></p>
+
+          
+            
+
+
+
+<h3 class="content-header header-section3" id="ref_directive_include_acquisition">Using acquisition</h3>
+
+
+            
+
+            <p>There&#39;s a special path component represented by an asterisk
+            (<code class="inline-code">*</code>). It is interpreted as &quot;this directory or
+            any of its parents&quot;. Therefore, if the template located in
+            <code class="inline-code">/foo/bar/template.ftl</code> has the following
+            line:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#include &quot;*/footer.ftl&quot;&gt;</pre></div>
+
+            <p>then the engine will look for the template in following
+            locations, in this order:</p>
+
+            <ul>
+              <li>
+                <code class="inline-code">/foo/bar/footer.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/foo/footer.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/footer.ftl</code>
+              </li>
+            </ul>
+
+            <p>This mechanism is called <strong>acquisition</strong> and allows the designers to
+            place commonly included files in a parent directory, and redefine
+            them on a per-subdirectory basis as needed. We say that the
+            including template acquires the template to include from the first
+            parent directory that has it. Note that you can specify not only a
+            template name to the right of the asterisk, but a subpath as well.
+            I.e. if the previous template instead read:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#include &quot;*/commons/footer.ftl&quot;&gt;</pre></div>
+
+            <p>then the engine would look for the template in following
+            locations, in this order:</p>
+
+            <ul>
+              <li>
+                <code class="inline-code">/foo/bar/commons/footer.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/foo/commons/footer.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/commons/footer.ftl</code>
+              </li>
+            </ul>
+
+            <p>Finally, the asterisk needn&#39;t be the first element of the
+            path:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#include &quot;commons/*/footer.ftl&quot;&gt;</pre></div>
+
+            <p>would cause the engine to look for the template in following
+            locations, in this order:</p>
+
+            <ul>
+              <li>
+                <code class="inline-code">/foo/bar/commons/footer.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/foo/bar/footer.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/foo/footer.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/footer.ftl</code>
+              </li>
+            </ul>
+
+            <p>However, there can be at most one asterisk in the path. If
+            you specifying more asterisks, the template won&#39;t be found.</p>
+          
+
+          
+            
+
+
+
+<h3 class="content-header header-section3" id="ref_directive_include_localized">Localized lookup</h3>
+
+
+            
+
+            <p>A locale is a language and an optional country or dialect
+            identifier (plus also maybe a further variant identifier, like
+            "MAC"). Whenever a template is requested, a desired
+            locale is always specified (explicitly or implicitly), and
+            FreeMarke will try to find a variant of the template that matches
+            that locale. When a template includes or imports another template,
+            internally that will also be requested for a locale, for the
+            locale that the <code class="inline-code">locale</code> setting is set to, and
+            that&#39;s usually for the locale of the top-level template.</p>
+
+            <p>Suppose your template was loaded with locale
+            <code class="inline-code">en_US</code>, which means U.S. English. When you
+            include another template:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#include &quot;footer.ftl&quot;&gt;</pre></div>
+
+            <p>the engine will in fact look for several templates, in this
+            order:</p>
+
+            <ul>
+              <li>
+                <code class="inline-code">footer_en_US.ftl</code>,
+              </li>
+
+              <li>
+                <code class="inline-code">footer_en.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">footer.ftl</code>
+              </li>
+            </ul>
+
+            <p>and it will use the first one that exists.</p>
+
+            <p>Note that if how (and if) FreeMarker searches the localized
+            variations is configurable by the programmers, so we are just
+            describing the default behavior here.<span class="marked-for-programmers"> You can disable localized lookup with the
+            <code class="inline-code">localized_lookup</code> setting
+            (<code class="inline-code">Configuration.setLocalizedLookup(boolean)</code>).
+            Also, you can define your own sequence of deduced template names
+            with the <code class="inline-code">template_lookup_strategy</code> setting
+            (<code class="inline-code">Configuration.setTemplateLookupStrategy(TemplateLookupStrategy)</code>).</span></p>
+
+            <p>When you use both acquisition (i.e., <code class="inline-code">*</code>
+            step in the path) and localized template lookup, the template with
+            more specific locale in a parent directory takes precedence over
+            template with less specific locale in a child directory. Suppose
+            you use the following include from
+            <code class="inline-code">/foo/bar/template.ftl</code>:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#include &quot;*/footer.ftl&quot;&gt;</pre></div>
+
+            <p>the engine will look for these templates, in this
+            order:</p>
+
+            <ul>
+              <li>
+                <code class="inline-code">/foo/bar/footer_en_US.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/foo/footer_en_US.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/footer_en_US.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/foo/bar/footer_en.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/foo/footer_en.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/footer_en.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/foo/bar/footer.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/foo/footer.ftl</code>
+              </li>
+
+              <li>
+                <code class="inline-code">/footer.ftl</code>
+              </li>
+            </ul>
+          
+        <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_import.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_list.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_list.html
----------------------------------------------------------------------
diff --git a/builds/2.3.26-nightly/ref_directive_list.html b/builds/2.3.26-nightly/ref_directive_list.html
new file mode 100644
index 0000000..f2e0cbc
--- /dev/null
+++ b/builds/2.3.26-nightly/ref_directive_list.html
@@ -0,0 +1,638 @@
+<!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>list, else, items, sep, 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="list, else, items, sep, break">
+<meta property="og:locale" content="en_US">
+<meta property="og:url" content="http://freemarker.org/docs/ref_directive_list.html">
+<link rel="canonical" href="http://freemarker.org/docs/ref_directive_list.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_list.html"><span itemprop="name">list, else, items, sep, 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","list, else, items, sep, 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_include.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_local.html"><span>Next</span></a></div><div class="title-wrapper">
+<h1 class="content-header header-section1" id="ref_directive_list" itemprop="headline">list, else, items, sep, 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_100" data-menu-target="autoid_100">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_101" data-menu-target="autoid_101">Description</a><ul><li><a class="page-menu-link" href="#autoid_102" data-menu-target="autoid_102">Simplest form</a></li><li><a class="page-menu-link" href="#autoid_103" data-menu-target="autoid_103">else directive</a></li><li><a class="page-menu-link" href="#autoid_104" data-menu-target="autoid_104">items directive</a></li><li><a class="page-menu-link" href="#autoid_105" data-menu-target="autoid_105">sep directive</a></li><li><a class="page-menu-link" href="#autoid_106" data-menu-target="autoid_106">break directive</a></li><li><a class="page-menu-link" href="#autoid_107" data-menu-target="autoid_107">Accessing iteration state</a></li><li><a class="page-menu-link" href="#autoid_108" data-menu-target="autoid_108">Nesting loops into each other</a></li><li><a class="page-menu-link" href="#autoid_109" data-menu-
 target="autoid_109">Notes for Java programmers</a></li></ul></li></ul> </div><a name="ref.directive.list"></a>
+          
+
+
+
+<h2 class="content-header header-section2" id="autoid_100">Synopsis</h2>
+
+
+          <p>The simplest form for listing a sequence (or collection)
+          is:</p>
+
+          
+<pre class="metaTemplate"><code class="inline-code">&lt;#list <em class="code-color">sequence</em> as <em class="code-color">item</em>&gt;
+    <em class="code-color">Part repeated for each item</em>
+&lt;/#list&gt;</code></pre>
+
+
+          <p>and to list the key-value pairs of a hash (since
+          2.3.25):</p>
+
+          
+<pre class="metaTemplate"><code class="inline-code">&lt;#list <em class="code-color">hash</em> as <em class="code-color">key</em>, <em class="code-color">value</em>&gt;
+    <em class="code-color">Part repeated for each key-value pair</em>
+&lt;/#list&gt;</code></pre>
+
+
+          <p>But these are just cases of the generic forms, which are shown
+          below. Note that for simplicity we only show the generic forms for
+          sequence listing; simply replace "<code class="inline-code">as
+          <em class="code-color">item</em></code>" with
+          "<code class="inline-code">as <em class="code-color">key</em>,
+          <em class="code-color">value</em></code>" to get the
+          generic form for hash listing.</p>
+
+          <p>Generic form 1:</p>
+
+          
+<pre class="metaTemplate"><code class="inline-code">&lt;#list <em class="code-color">sequence</em> as <em class="code-color">item</em>&gt;
+    <em class="code-color">Part repeated for each item</em>
+&lt;#else&gt;
+    <em class="code-color">Part executed when there are 0 items</em>
+&lt;/#list&gt;</code></pre>
+
+
+          <p>Where:</p>
+
+          <ul>
+            <li>
+              The <code class="inline-code">else</code> part is optional, and is only
+              supported since FreeMarker 2.3.23.
+            </li>
+
+            <li>
+              <code class="inline-code"><em class="code-color">sequence</em></code>:
+              Expressions evaluates to a sequence or collection of the items
+              we want to iterate through
+            </li>
+
+            <li>
+              <code class="inline-code"><em class="code-color">item</em></code>: Name
+              of the <a href="dgui_misc_var.html">loop variable</a> (not
+              an expression)
+            </li>
+
+            <li>
+              The various "parts" between the tags can
+              contain arbitrary FTL (including nested
+              <code class="inline-code">list</code>-s)
+            </li>
+          </ul>
+
+          <p>Generic form 2 (since FreeMarker 2.3.23):</p>
+
+          
+<pre class="metaTemplate"><code class="inline-code">&lt;#list <em class="code-color">sequence</em>&gt;
+    <em class="code-color">Part executed once if we have more than 0 items</em>
+    &lt;#items as <em class="code-color">item</em>&gt;
+    <em class="code-color">    Part repeated for each item</em>
+    &lt;/#items&gt;
+    <em class="code-color">Part executed once if we have more than 0 items</em>
+&lt;#else&gt;
+    <em class="code-color">Part executed when there are 0 items</em>
+&lt;/#list&gt;</code></pre>
+
+
+          <p>Where: see the "Where" section of Form 1 above
+          (and thus the <code class="inline-code">else</code> part is optional here
+          too).</p>
+        
+          
+
+
+
+<h2 class="content-header header-section2" id="autoid_101">Description</h2>
+
+
+          
+            
+
+
+
+<h3 class="content-header header-section3" id="autoid_102">Simplest form</h3>
+
+
+            <p>Assuming <code class="inline-code">users</code> contains the
+            <code class="inline-code">[&#39;Joe&#39;, &#39;Kate&#39;, &#39;Fred&#39;]</code> sequence:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#list users as user&gt;
+  &lt;p&gt;${user}
+&lt;/#list&gt;</pre></div>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-output">  &lt;p&gt;Joe
+  &lt;p&gt;Kate
+  &lt;p&gt;Fred</pre></div>
+
+            <p>The <code class="inline-code">list</code> directive executes the code
+            between the <code class="inline-code">list</code> start-tag and
+            <code class="inline-code">list</code> end-tag (the body of
+            <code class="inline-code">list</code> from now on) for each value in the
+            sequence (or collection) specified as its first parameter. For
+            each such iteration the loop variable (<code class="inline-code">user</code> in
+            this example) will store the value of the current item.</p>
+
+            <p>The loop variable (<code class="inline-code">user</code>) only exists
+            inside the <code class="inline-code">list</code> body. Also, macros/functions
+            called from within the loop won&#39;t see it (as if it were a local
+            variable).</p>
+
+            <p>Listing hashes is very similar, but you need to provide two
+            variable names after the <code class="inline-code">as</code>; one for the hash
+            key, and another for the associated value. Assuming
+            <code class="inline-code">products</code> is <code class="inline-code">{ &quot;apple&quot;: 5, &quot;banana&quot;:
+            10, &quot;kiwi&quot;: 15 }</code>:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#list products as name, price&gt;
+  &lt;p&gt;${name}: ${price}
+&lt;/#list&gt;</pre></div>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-output">  &lt;p&gt;apple: 5
+  &lt;p&gt;banan: 10
+  &lt;p&gt;kiwi: 15</pre></div>
+
+            <p>Note that not all hash variables can be listed, because some
+            of them isn&#39;t able to enumerate its keys. It&#39;s practically safe to
+            assume though that hashes that stand for Java
+            <code class="inline-code">Map</code> objects can be listed.</p>
+          
+
+          
+            
+
+
+
+<h3 class="content-header header-section3" id="autoid_103">else directive</h3>
+
+
+            <a name="ref.directive.list.else"></a>
+
+            
+
+              <div class="callout note">
+    <strong class="callout-label">Note:</strong>
+
+              <p><code class="inline-code">else</code> inside <code class="inline-code">list</code> is
+              only supported since FreeMarker 2.3.23</p>
+              </div>
+
+
+            <p>The <code class="inline-code">else</code> directive is used if when there
+            are 0 items, you have to print something special instead of just
+            printing nothing:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#list users as user&gt;
+  &lt;p&gt;${user}
+&lt;#else&gt;
+  &lt;p&gt;No users
+&lt;/#list&gt;</pre></div>
+
+            <p>This outputs the same as the earlier example, except when
+            <code class="inline-code">users</code> contains 0 items:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-output">  &lt;p&gt;No users</pre></div>
+
+            <p>Note that the loop variable (<code class="inline-code">user</code>)
+            doesn&#39;t exist between the <code class="inline-code">else</code> tag and the
+            <code class="inline-code">list</code> end-tag, since that part is not part of
+            the loop.</p>
+
+            <p><code class="inline-code">else</code> must be literally (means, in the
+            source code) inside the body of the <code class="inline-code">list</code>
+            directive. That is, you can&#39;t moved it out into a macro or
+            included template.</p>
+          
+
+          
+            
+
+
+
+<h3 class="content-header header-section3" id="autoid_104">items directive</h3>
+
+
+            <a name="ref.directive.items"></a>
+
+            
+
+              <div class="callout note">
+    <strong class="callout-label">Note:</strong>
+
+              <p><code class="inline-code">items</code> exists since FreeMarker
+              2.3.23</p>
+              </div>
+
+
+            <p>The <code class="inline-code">items</code> directive is used if you have
+            to print (or do) something before the first list item, and after
+            the last list item, as far as there&#39;s at least 1 item. A typical
+            example:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#list users&gt;
+  &lt;ul&gt;
+    &lt;#items as user&gt;
+      &lt;li&gt;${user}&lt;/li&gt;
+    &lt;/#items&gt;
+  &lt;/ul&gt;
+&lt;/#list&gt;</pre></div>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-output">  &lt;ul&gt;
+      &lt;li&gt;Joe&lt;/li&gt;
+      &lt;li&gt;Kate&lt;/li&gt;
+      &lt;li&gt;Fred&lt;/li&gt;
+  &lt;/ul&gt;</pre></div>
+
+            <p>If there are 0 items, the above won&#39;t print anything, thus
+            you don&#39;t end up with an empty
+            <code class="inline-code">&lt;ul&gt;&lt;/ul&gt;</code>.</p>
+
+            <p>That is, when the <code class="inline-code">list</code> directive has no
+            <code class="inline-code">as <em class="code-color">item</em></code> parameter,
+            the body of its is executed exactly once if there&#39;s at least one
+            item, or not at all otherwise. It&#39;s the body of the mandatory
+            nested <code class="inline-code">items</code> directive that will be run for
+            each item, and hence it&#39;s also the <code class="inline-code">items</code>
+            directive that defines the loop variable with <code class="inline-code">as
+            <em class="code-color">item</em></code>, not
+            <code class="inline-code">list</code>.</p>
+
+            <p>A <code class="inline-code">list</code> directive with
+            <code class="inline-code">items</code> also can have an <code class="inline-code">else</code>
+            directive:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#list users&gt;
+  &lt;ul&gt;
+    &lt;#items as user&gt;
+      &lt;li&gt;${user}&lt;/li&gt;
+    &lt;/#items&gt;
+  &lt;/ul&gt;
+&lt;#else&gt;
+  &lt;p&gt;No users
+&lt;/#list&gt;</pre></div>
+
+            <p>Some further details:</p>
+
+            <ul>
+              <li>
+                <p>The parser will check that a <code class="inline-code">list</code>
+                without <code class="inline-code">as <em class="code-color">item</em></code>
+                parameter always has a nested <code class="inline-code">items</code>
+                directive, and that an <code class="inline-code">items</code> directive
+                always has an enclosing <code class="inline-code">list</code> which has no
+                <code class="inline-code">as <em class="code-color">item</em></code>
+                parameter. This is checked when the template is parsed, not
+                when the template is executed. Thus, these rules apply on the
+                FTL source code itself, so you can&#39;t move
+                <code class="inline-code">items</code> out into a macro or included
+                template.</p>
+              </li>
+
+              <li>
+                <p>A <code class="inline-code">list</code> can have multiple
+                <code class="inline-code">items</code> directives, but only one of them will
+                be allowed to run (as far as you don&#39;t leave and re-enter the
+                enclosing <code class="inline-code">list</code> directive); and further
+                attempts to call <code class="inline-code">items</code> will cause error. So
+                multiple <code class="inline-code">items</code> can be utilized on different
+                <code class="inline-code">if</code>-<code class="inline-code">else</code> branches for
+                example, but not for iterating twice.</p>
+              </li>
+
+              <li>
+                <p><code class="inline-code">items</code> directive can&#39;t have its own
+                nested <code class="inline-code">else</code> directive, only the enclosing
+                <code class="inline-code">list</code> can have</p>
+              </li>
+
+              <li>
+                <p>The loop variable (<code class="inline-code">user</code>) only exists
+                inside the body of the <code class="inline-code">items</code>
+                directive.</p>
+              </li>
+            </ul>
+          
+
+          
+            
+
+
+
+<h3 class="content-header header-section3" id="autoid_105">sep directive</h3>
+
+
+            <a name="ref.directive.sep"></a>
+
+            
+
+              <div class="callout note">
+    <strong class="callout-label">Note:</strong>
+
+              <p><code class="inline-code">sep</code> exists since FreeMarker
+              2.3.23</p>
+              </div>
+
+
+            <p><code class="inline-code">sep</code> is used when you have to display
+            something between each item (but not before the first item or
+            after the last item). For example:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#list users as user&gt;${user}<strong>&lt;#sep&gt;, </strong>&lt;/#list&gt;</pre></div>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-output">Joe, Kate, Fred</pre></div>
+
+            <p>Above, <code class="inline-code">&lt;#sep&gt;, &lt;/#list&gt;</code> is a
+            shorthand for <code class="inline-code">&lt;#sep&gt;,
+            &lt;/#sep&gt;&lt;/#list&gt;</code>; the <code class="inline-code">sep</code>
+            end-tag can be omitted if you would put it where the enclosing
+            directive is closed anyway. In the next example, you couldn&#39;t use
+            such abbreviation (HTML tags close nothing, as they are just raw
+            text to output for FreeMarker):</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#list users as user&gt;
+  &lt;div&gt;
+    ${user}<strong>&lt;#sep&gt;, &lt;/#sep&gt;</strong>
+  &lt;/div&gt;
+&lt;/#list&gt;</pre></div>
+
+            <p><code class="inline-code">sep</code> is just a shorthand for
+            <code class="inline-code">&lt;#if
+            <em class="code-color">item</em>?has_next&gt;...&lt;/#if&gt;</code>.
+            Thus, it can be used anywhere where there&#39;s a
+            <code class="inline-code">list</code> or <code class="inline-code">items</code> loop variable
+            available, it can occur for multiple times, and it can have
+            arbitrary nested content.</p>
+
+            <p>The parser ensures that <code class="inline-code">sep</code> is only used
+            on a place where there&#39;s a visible loop variable. This happens
+            earlier than the actual execution of the template. Thus, you can&#39;t
+            move <code class="inline-code">sep</code> from inside the associated
+            <code class="inline-code">list</code> or <code class="inline-code">items</code> directive into
+            a macro or included template (the parser can&#39;t know where those
+            will be called from).</p>
+          
+
+          
+            
+
+
+
+<h3 class="content-header header-section3" id="autoid_106">break directive</h3>
+
+
+            <a name="ref.directive.list.break"></a>
+
+            
+
+            <p>You can exit the iteration at any point with the
+            <code class="inline-code">break</code> directive. For example:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#list 1..10 as x&gt;
+  ${x}
+  &lt;#if x == 3&gt;
+    <strong>&lt;#break&gt;</strong>
+  &lt;/#if&gt;
+&lt;/#list&gt;</pre></div>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-output">  1
+  2
+  3</pre></div>
+
+            <p>The <code class="inline-code">break</code> directives can be placed
+            anywhere inside <code class="inline-code">list</code> as far as it has
+            <code class="inline-code">as <em class="code-color">item</em></code> parameter,
+            otherwise it can be placed anywhere inside the
+            <code class="inline-code">items</code> directive. If the
+            <code class="inline-code">break</code> is inside <code class="inline-code">items</code>, it
+            will only exit from <code class="inline-code">items</code>, not from
+            <code class="inline-code">list</code>. In general, <code class="inline-code">break</code> will
+            only exit from the directive whose body is called for each item,
+            and can only be placed inside such directive. So for example can&#39;t
+            use <code class="inline-code">break</code> inside <code class="inline-code">list</code>&#39;s
+            <code class="inline-code">else</code> section, unless there&#39;s the
+            <code class="inline-code">list</code> is nested into another
+            <code class="inline-code">break</code>-able directive.</p>
+
+            <p>Just like <code class="inline-code">else</code> and
+            <code class="inline-code">items</code>, <code class="inline-code">break</code> must be
+            literally inside body of the directive to break out from, and
+            can&#39;t be moved out into a macro or included template.</p>
+          
+
+          
+            
+
+
+
+<h3 class="content-header header-section3" id="autoid_107">Accessing iteration state</h3>
+
+
+            
+
+            
+
+            <p>Starting from 2.3.23, <a href="ref_builtins_loop_var.html">loop variable built-ins</a> is
+            the preferred way of accessing current state of the iteration. For
+            example, here we use the <code class="inline-code">counter</code> and
+            <code class="inline-code">item_parity</code> loop variable built-ins (see all of
+            them <a href="ref_builtins_loop_var.html">in the
+            Reference</a>):</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#list users&gt;
+  &lt;table&gt;
+    &lt;#items as user&gt;
+      &lt;tr class=&quot;${user<strong>?item_parity</strong>}Row&quot;&gt;
+        &lt;td&gt;${user<strong>?counter</strong>}
+        &lt;td&gt;${user}
+    &lt;/#items&gt;
+  &lt;/table&gt;
+&lt;/#list&gt;</pre></div>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-output">  &lt;table&gt;
+      &lt;tr class=&quot;<strong>odd</strong>Row&quot;&gt;
+        &lt;td&gt;<strong>1</strong>
+        &lt;td&gt;Joe
+      &lt;tr class=&quot;<strong>even</strong>Row&quot;&gt;
+        &lt;td&gt;<strong>2</strong>
+        &lt;td&gt;Kate
+      &lt;tr class=&quot;<strong>odd</strong>Row&quot;&gt;
+        &lt;td&gt;<strong>3</strong>
+        &lt;td&gt;Fred
+  &lt;/table&gt;</pre></div>
+
+            <p>In 2.3.22 and earlier, there were two extra loop variables
+            to retrieve the iteration state instead (and they still exist for
+            backward compatibility):</p>
+
+            <ul>
+              <li>
+                <p><code class="inline-code"><em class="code-color">item</em>_index</code>
+                (<em>deprecated</em> by
+                <code class="inline-code"><em class="code-color">item</em>?index</code>): The
+                index (0-based number) of the current item in the loop.</p>
+              </li>
+
+              <li>
+                <p><code class="inline-code"><em class="code-color">item</em>_has_next</code>
+                (<em>deprecated</em> by
+                <code class="inline-code"><em class="code-color">item</em>?has_next</code>):
+                Boolean value that tells if the current item is the last in
+                the sequence or not.</p>
+              </li>
+            </ul>
+
+            <p>so in the above example, you could replace
+            <code class="inline-code">${user?counter}</code> with <code class="inline-code">${user_index +
+            1}</code>.</p>
+          
+
+          
+            
+
+
+
+<h3 class="content-header header-section3" id="autoid_108">Nesting loops into each other</h3>
+
+
+            <p>Naturally, <code class="inline-code">list</code> or
+            <code class="inline-code">items</code> can contain further
+            <code class="inline-code">list</code>-s:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#list 1..2 as i&gt;
+  &lt;#list 1..3 as j&gt;
+    i = ${i}, j = ${j}
+  &lt;/#list&gt;
+&lt;/#list&gt;</pre></div>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-output">    i = 1, j = 1
+    i = 1, j = 2
+    i = 1, j = 3
+    i = 2, j = 1
+    i = 2, j = 2
+    i = 2, j = 3</pre></div>
+
+            <p>It&#39;s also allowed to use clashing loop variable names
+            like:</p>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;#list 1..2 as i&gt;
+  Outer: ${i}
+  &lt;#list 10..12 as i&gt;
+    Inner: ${i}
+  &lt;/#list&gt;
+  Outer again: ${i}
+&lt;/#list&gt;</pre></div>
+
+            
+
+<div class="code-wrapper"><pre class="code-block code-output">  Outer: 1
+    Inner: 10
+    Inner: 11
+    Inner: 12
+  Outer again: 1
+  Outer: 2
+    Inner: 10
+    Inner: 11
+    Inner: 12
+  Outer again: 2</pre></div>
+          
+
+          
+            
+
+
+
+<h3 class="content-header header-section3" id="autoid_109">Notes for Java programmers</h3>
+
+
+            <p><span class="marked-for-programmers">If classic compatible mode
+            <code class="inline-code">list</code> accepts a scalar too and treats it as a
+            single-element sequence.</span></p>
+
+            <p><span class="marked-for-programmers">If you pass an collection that
+            wraps an <code class="inline-code">java.util.Iterator</code> to the
+            <code class="inline-code">list</code>, you can iterate over its elements only
+            once, since <code class="inline-code">Iterator</code>s are by their nature
+            one-off objects. When you try to list a such collection variable
+            for the second time, an error will abort template
+            processing.</span></p>
+          
+        <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_include.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_local.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>


Mime
View raw message