http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/dgui_template_directives.html
----------------------------------------------------------------------
diff --git a/builds/2.3.26-nightly/dgui_template_directives.html 
b/builds/2.3.26-nightly/dgui_template_directives.html
new file mode 100644
index 0000000..cbd5bcd
--- /dev/null
+++ b/builds/2.3.26-nightly/dgui_template_directives.html
@@ -0,0 +1,136 @@
+<!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>Directives - 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="Directives">
+<meta property="og:locale" content="en_US">
+<meta property="og:url" 
content="http://freemarker.org/docs/dgui_template_directives.html";>
+<link rel="canonical" 
href="http://freemarker.org/docs/dgui_template_directives.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="dgui.html"><span itemprop="name">Template Author&#39;s 
Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope 
itemtype="http://schema.org/ListItem";><a class="label" itemprop="item" 
href="dgui_template.html"><span itemprop="name">The Template</span></a></li><li 
class="step-3" item
 prop="itemListElement" itemscope itemtype="http://schema.org/ListItem";><a 
class="label" itemprop="item" href="dgui_template_directives.html"><span 
itemprop="name">Directives</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 Author\'s 
Guide","The Template","Directives"];</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="dgui_template_overallstructure.html"><span>Previous</span></a><a 
class="paging-arrow next" 
href="dgui_template_exp.html"><span>Next</span></a></div><div 
class="title-wrapper">
+<h1 class="content-header header-section1" id="dgui_template_directives" 
itemprop="headline">Directives</h1>
+</div></div><a name="term.designer.directive"></a><p>You use FTL tags to call 
<strong>directives</strong>. In the example you have called the
+        <code class="inline-code">list</code> directive. Syntactically you 
have done it with
+        two tags: <code class="inline-code">&lt;#list animals as 
animal&gt;</code> and
+        <code class="inline-code">&lt;/#list&gt;</code>.</p><p>There are two 
kind of FTL tags:</p><ul>
+          <li>
+            <p>Start-tag:
+            <code class="inline-code">&lt;#<em 
class="code-color">directivename</em>
+            <em class="code-color">parameters</em>&gt;</code></p>
+          </li>
+
+          <li>
+            <p>End-tag:
+            <code class="inline-code">&lt;/#<em 
class="code-color">directivename</em>&gt;</code></p>
+          </li>
+        </ul><p>This is similar to HTML or XML syntax, except that the tag name
+        starts with <code class="inline-code">#</code>. If the directive 
doesn&#39;t have nested
+        content (content between the start-tag and the end-tag), you must use
+        the start-tag with no end-tag. For example you write <code 
class="inline-code">&lt;#if
+        <em class="code-color">something</em>&gt;<em 
class="code-color">...</em>&lt;/#if&gt;</code>,
+        but just <code class="inline-code">&lt;#include
+        <em class="code-color">something</em>&gt;</code> as FreeMarker knows
+        that the <code class="inline-code">include</code> directive can&#39;t 
have nested
+        content.</p><p>The format of the
+        <code class="inline-code"><em 
class="code-color">parameters</em></code> depends on
+        the
+        <code class="inline-code"><em 
class="code-color">directivename</em></code>.</p><p>In fact there are two types 
of directives: <a href="gloss.html#gloss.predefinedDirective">predefined 
directives</a> and
+        <a href="gloss.html#gloss.userDefinedDirective">user-defined
+        directives</a>. For user-defined directives you use
+        <code class="inline-code">@</code> instead of <code 
class="inline-code">#</code>, for example
+        <code class="inline-code">&lt;@mydirective
+        <em class="code-color">parameters</em>&gt;<em 
class="code-color">...</em>&lt;/@mydirective&gt;</code>.
+        Further difference is that if the directive has no nested content, you
+        must use a tag like <code class="inline-code">&lt;@mydirective
+        <em class="code-color">parameters</em> /&gt;</code>, similarly as in
+        XML (e.g. <code class="inline-code">&lt;img <em 
class="code-color">...</em>
+        /&gt;</code>). But user-defined directives is an advanced topic
+        that will be discussed <a 
href="dgui_misc_userdefdir.html">later</a>.</p><p>FTL tags, like HTML tags, 
must be properly nested. So the code
+        below is wrong, as the <code class="inline-code">if</code> directive 
is both inside
+        and outside of the nested content of the <code 
class="inline-code">list</code>
+        directive:</p>
+
+<div class="code-wrapper"><pre class="code-block code-template">&lt;ul&gt;
+<strong>&lt;#list animals as animal&gt;</strong>
+  &lt;li&gt;${animal.name} for ${animal.price} Euros
+  <strong>&lt;#if user == &quot;Big Joe&quot;&gt;</strong>
+     (except for you)
+<strong>&lt;/#list&gt;</strong> &lt;#-- WRONG! The &quot;if&quot; has to be 
closed first. --&gt;
+<strong>&lt;/#if&gt;</strong>
+&lt;/ul&gt;</pre></div><p>Note that FreeMarker doesn&#39;t care about the 
nesting of HTML
+        tags, only about the nesting of FTL tags. It just sees HTML as flat
+        text, it doesn&#39;t interpret it in any way.</p><p>If you try to use 
a non-existing directive (e.g., you mistype
+        the directive name), FreeMarker will decline to use the template and
+        produce an error message.</p><p>FreeMarker ignores superfluous <a 
href="gloss.html#gloss.whiteSpace">white-space</a> inside FTL tags. So you
+        can write this:</p>
+
+<div class="code-wrapper"><pre class="code-block code-template"><span 
class="marked-text"><span class="marked-ftl-tag">&lt;#list<em><span 
class="marked-invisible-text">[BR]</span></em>
+  animals       as<em><span 
class="marked-invisible-text">[BR]</span></em>
+     animal<em><span class="marked-invisible-text">[BR]</span></em>
+&gt;</span><em><span class="marked-invisible-text">[BR]</span></em>
+<span class="marked-interpolation">${animal.name}</span> for <span 
class="marked-interpolation">${animal.price}</span> Euros<em><span 
class="marked-invisible-text">[BR]</span></em>
+<span class="marked-ftl-tag">&lt;/#list    
&gt;</span></span></pre></div><p>You may not, however, insert white-space 
between the
+        <code class="inline-code">&lt;</code> or <code 
class="inline-code">&lt;/</code> and the directive
+        name.</p><p>The complete list and description of all directives can be 
found
+        in the <a href="ref_directives.html">Template Language 
Reference/Directive Reference</a> (but I recommend that you look
+        at the chapter about expressions first).</p>  <div class="callout 
note">
+    <strong class="callout-label">Note:</strong>
+
+          <p>FreeMarker can be configured to use <code 
class="inline-code">[</code> and
+          <code class="inline-code">]</code> instead of <code 
class="inline-code">&lt;</code> and
+          <code class="inline-code">&gt;</code> in the FTL tags and FTL 
comments, like
+          <code class="inline-code">[#if user == &quot;Big
+          Joe&quot;]<em class="code-color">...</em>[/#if]</code>. For more
+          information read: <a 
href="dgui_misc_alternativesyntax.html">Miscellaneous/Alternative (square 
bracket) syntax</a>.</p>
+          </div>
+  <div class="callout note">
+    <strong class="callout-label">Note:</strong>
+
+          <p>FreeMarker can be configured so that it understands predefined
+          directives without <code class="inline-code">#</code> (like <code 
class="inline-code">&lt;if user
+          == &quot;Big
+          Joe&quot;&gt;<em class="code-color">...</em>&lt;/if&gt;</code>).
+          However we don&#39;t recommend the usage of this mode. For more
+          information read: <a href="ref_depr_oldsyntax.html">Template 
Language Reference/Deprecated FTL constructs/Old FTL syntax</a></p>
+          </div>
+<div class="bottom-pagers-wrapper"><div class="pagers bottom"><a 
class="paging-arrow previous" 
href="dgui_template_overallstructure.html"><span>Previous</span></a><a 
class="paging-arrow next" 
href="dgui_template_exp.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>

Reply via email to