http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/ref_directive_compress.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_directive_compress.html b/builds/2.3.26-nightly/ref_directive_compress.html new file mode 100644 index 0000000..3c59d01 --- /dev/null +++ b/builds/2.3.26-nightly/ref_directive_compress.html @@ -0,0 +1,107 @@ +<!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>compress - 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="compress"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_directive_compress.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_directive_compress.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_compress.html"><span itemprop="name">compress</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","compress"];</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_autoesc.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_escape.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_directive_compress" itemprop="headline">compress</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#autoid_82" data-menu-target="autoid_82">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_83" data-menu-target="autoid_83">Description</a></li></ul> </div><a name="ref.directive.compress"></a> + + + + +<h2 class="content-header header-section2" id="autoid_82">Synopsis</h2> + + + +<pre class="metaTemplate"> +<code class="inline-code"><#compress> + <em class="code-color">...</em> +</#compress></code> +</pre> + + + + + + +<h2 class="content-header header-section2" id="autoid_83">Description</h2> + + + <p>The compress directive is useful for removing superfluous + <a href="gloss.html#gloss.whiteSpace">white-space</a> when you use a + white-space insensitive format (e.g. HTML or XML). It captures the + output generated inside its body (i.e. between its start-tag and + end-tag), and reduces all unbroken white-space sequences to a single + white-space character. The inserted character will be a <a href="gloss.html#gloss.lineBreak">line break</a> if the replaced sequence + contains line breaks, or a space otherwise. The very first and very + last unbroken white-space sequences will be completely + removed.</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#assign x = " moo \n\n "> +(<#compress> + 1 2 3 4 5 + ${moo} + test only + + I said, test only + +</#compress>)</pre></div> + + <p>will output:</p> + + + +<div class="code-wrapper"><pre class="code-block code-output">(1 2 3 4 5 +moo +test only +I said, test only)</pre></div> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_autoesc.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_escape.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_escape.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_directive_escape.html b/builds/2.3.26-nightly/ref_directive_escape.html new file mode 100644 index 0000000..ebd956b --- /dev/null +++ b/builds/2.3.26-nightly/ref_directive_escape.html @@ -0,0 +1,232 @@ +<!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>escape, noescape (deprecated) - 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="escape, noescape (deprecated)"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_directive_escape.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_directive_escape.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_escape.html"><span itemprop="name">escape, noescape (deprecated)</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","escape, noescape (deprecated)"];</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_compress.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_flush.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_directive_escape" itemprop="headline">escape, noescape (deprecated)</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#autoid_84" data-menu-target="autoid_84">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_85" data-menu-target="autoid_85">Description</a></li></ul> </div><a name="ref.directive.escape"></a><a name="ref.directive.noescape"></a> + + + + +<h2 class="content-header header-section2" id="autoid_84">Synopsis</h2> + + + +<pre class="metaTemplate"> +<code class="inline-code"><#escape <em class="code-color">identifier</em> as <em class="code-color">expression</em>> + <em class="code-color">...</em> + <#noescape><em class="code-color">...</em></#noescape> + <em class="code-color">...</em> +</#escape></code> +</pre> + + + <p>Camel case name variant: <code class="inline-code">noEscape</code></p> + + + + + +<h2 class="content-header header-section2" id="autoid_85">Description</h2> + + + <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>These directives are <em>deprecated</em> by + <a href="dgui_misc_autoescaping.html">output-format-based + auto-escaping</a> since 2.3.24. Furthermore, on places that use + auto-escaping (with an output format that actually does escaping) + you aren't allowed to use the <code class="inline-code">escape</code> directive + (as you will find out from the parsing error message + anyway).</p> + </div> + + + <p>When you surround a part of the template with an escape + directive, interpolations + (<code class="inline-code">${<em class="code-color">...</em>}</code>) that occur + inside the block are combined with the escaping expression + automatically. This is a convenience method for avoiding writing + similar expressions all over. It does not affect interpolations in + string literals (as in <code class="inline-code"><#assign x = + "Hello ${user}!"></code>). Also, it does not affect numerical + interpolations + (<code class="inline-code">#{<em class="code-color">...</em>}</code>).</p> + + <p>Example:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><strong><#escape x as x?html></strong> + First name: ${firstName} + Last name: ${lastName} + Maiden name: ${maidenName} +<strong></#escape></strong></pre></div> + + <p>is actually equivalent to:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"> First name: ${firstName<strong>?html</strong>} + Last name: ${lastName<strong>?html</strong>} + Maiden name: ${maidenName<strong>?html</strong>}</pre></div> + + <p>Note that it is irrelevant what identifier you use in the + directive - it just serves as a formal parameter to the escaping + expression.</p> + + <p>When you are calling macros or the <code class="inline-code">include</code> + directive, it is important to understand that escape has effect only + on interpolations that occur between the <code class="inline-code"><#escape + <em class="code-color">...</em>></code> and + <code class="inline-code"></#escape></code> <em>in the template + text</em>. That is, it will not escape anything that is before + <code class="inline-code"><#escape <em class="code-color">...</em>></code> in + the text, or after the <code class="inline-code"></#escape></code> in the + text, not even if that part is called from inside the + <code class="inline-code">escape</code>-d section.</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#assign x = "<test>"> +<#macro m1> + m1: ${x} +</#macro> +<#escape x as x?html> + <#macro m2>m2: ${x}</#macro> + ${x} + <@m1/> +</#escape> +${x} +<@m2/></pre></div> + + <p>the output will be:</p> + + + +<div class="code-wrapper"><pre class="code-block code-output"> &lt;test&gt; + m1: <test> +<test> +m2: &lt;test&gt;</pre></div> + + <p><span class="marked-for-programmers">More technically, the effects of + <code class="inline-code">escape</code> directive are applied at template parsing + time rather than at template processing time. This means that if you + call a macro or include another template from within an escape + block, it won't affect the interpolations in the macro/included + template, since macro calls and template includes are evaluated at + template processing time. On the other hand, if you surround one or + more macro declarations (which are evaluated at template parsing + time, as opposed to macro calls) with an escape block, the + interpolations in those macros will be combined with the escaping + expression.</span></p> + + <p>Sometimes there is a need to temporarily turn off escaping for + one or two interpolations in an escape block. You can achieve this + by closing and later reopening the escape block, but then you have + to write the escaping expression twice. You can instead use the + noescape directive:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#escape x as x?html> + From: ${mailMessage.From} + Subject: ${mailMessage.Subject} + <strong><#noescape></strong>Message: ${mailMessage.htmlFormattedBody}<strong></#noescape></strong> + <em>...</em> +</#escape></pre></div> + + <p>is equivalent to:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"> From: ${mailMessage.From?html} + Subject: ${mailMessage.Subject?html} + Message: ${mailMessage.htmlFormattedBody} + ...</pre></div> + + <p>Escapes can be nested (although you will do it only in rare + circumstances). Therefore, you can write something like the below + code (the example is admittedly a bit stretched, as you'd probably + place item codes in a sequence and use <code class="inline-code">list</code> to + iterate over them, but we're now doing it this way just to + illustrate the point):</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><strong><#escape x as x?html></strong> + Customer Name: ${customerName} + Items to ship: + <strong><#escape x as itemCodeToNameMap[x]></strong> + ${itemCode1} + ${itemCode2} + ${itemCode3} + ${itemCode4} + <strong></#escape></strong> +<strong></#escape></strong></pre></div> + + <p>is actually equivalent to:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"> Customer Name: ${customerName?html} + Items to ship: + ${itemCodeToNameMap[itemCode1]?html} + ${itemCodeToNameMap[itemCode2]?html} + ${itemCodeToNameMap[itemCode3]?html} + ${itemCodeToNameMap[itemCode4]?html}</pre></div> + + <p>When you use the noescape directive in a nested escape block, + it undoes only a single level of escaping. Therefore, to completely + turn off escaping in a two-level deep escaped block, you need to use + two nested noescape directives as well.</p> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_compress.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_flush.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_flush.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_directive_flush.html b/builds/2.3.26-nightly/ref_directive_flush.html new file mode 100644 index 0000000..6dc6106 --- /dev/null +++ b/builds/2.3.26-nightly/ref_directive_flush.html @@ -0,0 +1,96 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-section"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>flush - 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="flush"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_directive_flush.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_directive_flush.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_flush.html"><span itemprop="name">flush</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","flush"];</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_escape.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_ftl.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_directive_flush" itemprop="headline">flush</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#autoid_86" data-menu-target="autoid_86">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_87" data-menu-target="autoid_87">Description</a></li></ul> </div><a name="ref.directive.flush"></a> + + + + +<h2 class="content-header header-section2" id="autoid_86">Synopsis</h2> + + + +<pre class="metaTemplate"><code class="inline-code"><#flush></code></pre> + + + + + + +<h2 class="content-header header-section2" id="autoid_87">Description</h2> + + + <p>When FreeMarker generates the output, it's usually not sent + immediately to the final receiving party (like a web browser or a + destination file), but is accumulated in a buffer, then it's sent + out in bigger chunks. The exact rules of the buffering is not + decided by FreeMarker, but by the embedding software. Sending out + the content accumulated in the buffer is called flushing. Although + flushing happens automatically, sometimes you want to force it on + certain points of the template processing, and this is what the + <code class="inline-code">flush</code> directive does. Whether it's needed at + certain points should be decided by a programmer, not a + designer.</p> + + <p>Note that while <code class="inline-code">flush</code> tells the embedding + software that we want to flush, that might as well decides to ignore + this request. It's not in the hands of FreeMarker.</p> + + <p><span class="marked-for-programmers">Flush simply calls the + <code class="inline-code">flush()</code> method of the currently used + <code class="inline-code">java.io.Writer</code> instance. The whole buffering and + flushing mechanism is implemented in the <code class="inline-code">Writer</code> + (that you have passed as the parameter of the + <code class="inline-code">Template.process</code> method); FreeMarker does not + deal with it.</span></p> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_escape.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_ftl.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_ftl.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_directive_ftl.html b/builds/2.3.26-nightly/ref_directive_ftl.html new file mode 100644 index 0000000..0683402 --- /dev/null +++ b/builds/2.3.26-nightly/ref_directive_ftl.html @@ -0,0 +1,285 @@ +<!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>ftl - 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="ftl"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_directive_ftl.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_directive_ftl.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_ftl.html"><span itemprop="name">ftl</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","ftl"];</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_flush.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_function.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_directive_ftl" itemprop="headline">ftl</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#autoid_88" data-menu-target="autoid_88">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_89" data-menu-target="autoid_89">Description</a></li></ul> </div><a name="ref.directive.ftl"></a> + + + + +<h2 class="content-header header-section2" id="autoid_88">Synopsis</h2> + + + +<pre class="metaTemplate"> +<code class="inline-code"><#ftl <em class="code-color">param1</em>=<em class="code-color">value1</em> <em class="code-color">param2</em>=<em class="code-color">value2</em> <em class="code-color">...</em> <em class="code-color">paramN</em>=<em class="code-color">valueN</em>></code> +</pre> + + + <p>Where:</p> + + <ul> + <li> + <code class="inline-code"><em class="code-color">param1</em></code>, + <code class="inline-code"><em class="code-color">param2</em></code>, ...etc.: + Name of the parameter. Not an expression. Allowed parameters + are: <code class="inline-code">encoding</code>, + <code class="inline-code">strip_whitespace</code>, + <code class="inline-code">strip_text</code>, ...etc. See below. + </li> + + <li> + <code class="inline-code"><em class="code-color">value1</em></code>, + <code class="inline-code"><em class="code-color">value2</em></code>, ...etc.: + The value of parameter. This must be a constant expression (as + <code class="inline-code">true</code>, or <code class="inline-code">"ISO-8859-5"</code>, or + <code class="inline-code">{x:1, y:2}</code>). It can't use variables. + </li> + </ul> + + + + + +<h2 class="content-header header-section2" id="autoid_89">Description</h2> + + + <p>Tells information about the template for FreeMarker and for + other tools, also helps programs to automatically detect if a text + file is an FTL file. This directive, if present, must be the very + first thing in the template. Any <a href="gloss.html#gloss.whiteSpace">white-space</a> before this directive + will be ignored. The old-syntax (<code class="inline-code">#</code>-less) format + of this directive is not supported.</p> + + <p>The settings (encoding, white-space stripping, etc.) given + here has the highest precedence, that is, they will be used for the + template regardless of any FreeMarker configuration settings.</p> + + <p>Possible parameters:</p> + + <ul> + <li> + <p><code class="inline-code">attributes</code>: This is a hash that + associates arbitrary attributes (name-value pairs) to the + template. The values of the attributes can be of any type + (string, number, sequence... etc.). FreeMarker doesn't try to + understand the meaning of the attributes. It's up to the + application that encapsulates FreeMarker (as a Web application + framework). Thus, the set of allowed attributes and their + semantic is application (Web application framework) dependent. + <span class="marked-for-programmers">Programmers: you can get the + attributes associated with a <code class="inline-code">Template</code> object + with its <code class="inline-code">getCustomAttributeNames</code> and + <code class="inline-code">getCustomAttribute</code> methods (inherited from + <code class="inline-code">freemarker.core.Configurable</code>). As the + template attributes are associated with the + <code class="inline-code">Template</code> object when the template is parsed, + the attributes can be read anytime, the template need not be + executed. The methods mentioned return the attribute values + unwrapped, that is, with FreeMarker independent type as + <code class="inline-code">java.util.List</code>.</span></p> + </li> + + <li> + <p><code class="inline-code">auto_esc</code>: A boolean constant to turn + <a href="dgui_misc_autoescaping.html">auto-escaping</a> on + or off. It depends on the + <code class="inline-code">auto_escaping_policy</code> of the FreeMarker + configuration, but usually auto-escaping will be by default on, + if the current <a href="dgui_misc_autoescaping.html#dgui_misc_autoescaping_outputformat">output + format</a> uses auto-escaping by default. So you mostly use + this to disable auto-escaping (<code class="inline-code">false</code> value). + An attempt to use <code class="inline-code">true</code> value when the current + output format is a <a href="dgui_misc_autoescaping.html#dgui_misc_autoescaping_nonmarkupof">non-markup output + format</a> (which hence can't escape) will cause <a href="gloss.html#gloss.parseTimeError">parse-time error</a>. Note + that you can turn auto-escaping on/off for only a part of the + template with the <a href="ref_directive_autoesc.html"><code>autoesc</code></a> + and <a href="ref_directive_noautoesc.html"><code>noautoesc</code> + directives</a>.</p> + </li> + + <li> + <p><code class="inline-code">encoding</code>: With this you can specify the + encoding (charset) of the template in the template file itself. + <span class="marked-for-programmers">(That is, this will be the + <code class="inline-code">encoding</code> setting of the newly created + <code class="inline-code">Template</code>, and not even the + <code class="inline-code">encoding</code> parameter to + <code class="inline-code">Configuration.getTemplate</code> can override + it)</span>. Note however, that FreeMarker will try to find and + interpret the <code class="inline-code">ftl</code> directive first with the + automatically guessed encoding (which depends on the FreeMarker + configuration set by the programmers), and only then realizes if + the <code class="inline-code">ftl</code> directive dictates something + different, and re-read the template with the new encoding. Thus, + the template must be valid FTL until the end of + <code class="inline-code">ftl</code> tag with the encoding tried first. The + valid values of this parameter are MIME-preferred charset names + from the IANA Charset Registry, like ISO-8859-5, UTF-8 or + Shift_JIS.</p> + </li> + + <li> + <p><code class="inline-code">ns_prefixes</code>: This is a hash that + associates prefixes with node namespaces. For example: + <code class="inline-code">{"e":"http://example.com/ebook", + "vg":"http://example.com/vektorGraphics"}</code>. This is + mostly used with XML processing where the prefixes can be used + in XML queries, but it also influences the working of <a href="ref_directive_visit.html">directives + <code>visit</code> and <code>recurse</code></a>. + Only one prefix can be registered for the same node namespace + (otherwise an error will occur), so there is one-to-one relation + between prefixes and node namespaces. Prefixes + <code class="inline-code">D</code> and <code class="inline-code">N</code> are reserved. If + you register prefix <code class="inline-code">D</code>, then other than you + associate the node namespace with prefix <code class="inline-code">D</code>, + you also set the default node namespace. Prefix + <code class="inline-code">N</code> can't be registered; it is used to denote + nodes with no node namespace in certain places, when (and only + when) prefix <code class="inline-code">D</code> is registered. (To see the + usage of default node namespace, <code class="inline-code">N</code>, and + prefixes in general, see the part about <a href="xgui.html">XML + processing</a> and <a href="ref_directive_visit.html"><code>visit</code> and + <code>recurse</code></a> in the reference.) The effect + of <code class="inline-code">ns_prefixes</code> is limited to a single <a href="dgui_misc_namespace.html">FTL namespace</a>, namely, to + the FTL namespace that was created for the template. This also + means that <code class="inline-code">ns_prefixes</code> has effect only when + an FTL namespace is created for the template that contains it, + otherwise the <code class="inline-code">ns_prefixes</code> parameter has no + effect. An FTL namespace is made for a template when: (a) the + template is the "main" template, that is, it is not + invoked as a result of an <code class="inline-code"><#include + ...></code>, but it is directly invoked (<span class="marked-for-programmers">with the <code class="inline-code">process</code> Java + method of class <code class="inline-code">Template</code> or + <code class="inline-code">Environment</code></span>); (b) the template is + invoked directly with <code class="inline-code"><#import + ...></code>.</p> + </li> + + <li> + <p><code class="inline-code">output_format</code>: Specifies the <a href="dgui_misc_autoescaping.html#dgui_misc_autoescaping_outputformat">output + format</a> of this template. This must be a string literal, + which refers to the name of the output format. See the <a href="dgui_misc_autoescaping.html#topic.predefinedOutputFormats">table of predefined + output formats here</a>. Other names can exist if the + programmers has added them via the + <code class="inline-code">registered_custom_output_formats</code> + configuration setting + (<code class="inline-code">Configuration.setRegisteredCustomOutputFormats(<em class="code-color">...</em>)</code>). + The referred output format must be known by the + <code class="inline-code">Configuration</code>, or else a <a href="gloss.html#gloss.parseTimeError">parse-time error </a>will + occur. The name can also refer to a so called combined output + format as + <code class="inline-code">"<em class="code-color">outerFormatName</em>{<em class="code-color">innerFormatName</em>}"</code>; + <a href="ref_directive_outputformat.html#topic.combinedOutputFormats">see more about + combined output formats here</a>.</p> + </li> + + <li> + <p><code class="inline-code">strict_syntax</code>: This turns on/off + "strict syntax", which is the standard syntax after + FreeMarker 2.1. Valid values are the boolean constants + <code class="inline-code">true</code> and <code class="inline-code">false</code>. (And for + backward compatibility, strings <code class="inline-code">"yes"</code>, + <code class="inline-code">"no"</code>, <code class="inline-code">"true"</code>, + <code class="inline-code">"false"</code>). The default value (i.e., when you + don't use this parameter) depends on the FreeMarker + configuration set by the programmers, but it's most certainly + set to <code class="inline-code">true</code>. For more information read: <a href="ref_depr_oldsyntax.html">Deprecated FTL constructs/Old FTL syntax</a></p> + </li> + + <li> + <p><code class="inline-code">strip_text</code>: When enabled, all top-level + text in a template is removed when the template is parsed. This + does not affect text within macros, directives, or + interpolations. Valid values are the boolean constants + <code class="inline-code">true</code> and <code class="inline-code">false</code>. (And for + backward compatibility, strings <code class="inline-code">"yes"</code>, + <code class="inline-code">"no"</code>, <code class="inline-code">"true"</code>, + <code class="inline-code">"false"</code>). The default value (i.e. when you + don't use this parameter) is <code class="inline-code">false</code>.</p> + </li> + + <li> + <p><code class="inline-code">strip_whitespace</code>: This enables/disables + <a href="dgui_misc_whitespace.html#dgui_misc_whitespace_stripping">white-space + stripping</a>. Valid values are the boolean constants + <code class="inline-code">true</code> and <code class="inline-code">false</code>. (And for + backward compatibility, strings <code class="inline-code">"yes"</code>, + <code class="inline-code">"no"</code>, <code class="inline-code">"true"</code>, + <code class="inline-code">"false"</code>). The default value (i.e. when you + don't use this parameter) depends on the FreeMarker + configuration set by the programmers, but it should be + <code class="inline-code">true</code> for new projects.</p> + </li> + </ul> + + <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>As of FreeMarker 2.3.23, you can use camel case instead of + snake case for parameter names, like + <code class="inline-code">outputFormat</code> instead of + <code class="inline-code">output_format</code>. But know that then within the + same template, FreeMarker will enforce the usage of camel case for + all identifiers that are part of the template language (user + defined names are not affected).</p> + </div> + + + <p>This directive also determines if the template uses angle + bracket syntax (e.g. <code class="inline-code"><#include 'foo.ftl'></code>) + or <a href="dgui_misc_alternativesyntax.html">square bracket + syntax</a> (e.g. <code class="inline-code">[#include 'foo.ftl']</code>). + Simply, the syntax used for this directive will be the syntax used + for the whole template, regardless of the FreeMarker configuration + settings.</p> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_flush.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_function.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_function.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_directive_function.html b/builds/2.3.26-nightly/ref_directive_function.html new file mode 100644 index 0000000..22e00bc --- /dev/null +++ b/builds/2.3.26-nightly/ref_directive_function.html @@ -0,0 +1,173 @@ +<!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>function, return - 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="function, return"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_directive_function.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_directive_function.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_function.html"><span itemprop="name">function, return</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","function, return"];</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_ftl.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_global.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_directive_function" itemprop="headline">function, return</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#autoid_90" data-menu-target="autoid_90">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_91" data-menu-target="autoid_91">Description</a></li></ul> </div><a name="ref.directive.function"></a><a name="ref.directive.function.return"></a> + + + + +<h2 class="content-header header-section2" id="autoid_90">Synopsis</h2> + + + +<pre class="metaTemplate"> +<code class="inline-code"><#function <em class="code-color">name</em> <em class="code-color">param1</em> <em class="code-color">param2</em> <em class="code-color">... paramN</em>> + <em class="code-color">...</em> + <#return <em class="code-color">returnValue</em>> + <em class="code-color">...</em> +</#function></code> +</pre> + + + <p>Where:</p> + + <ul> + <li> + <code class="inline-code"><em class="code-color">name</em></code>: name + of method variable (not expression) + </li> + + <li> + <code class="inline-code"><em class="code-color">param1</em></code>, + <code class="inline-code"><em class="code-color">param2</em></code>, ...etc.: + the name of the <a href="dgui_misc_var.html">local + variables</a> store the parameter values (not expression), + optionally followed by <code class="inline-code">=</code> and the default + value (that's an expression). + </li> + + <li> + <code class="inline-code"><em class="code-color">paramN</em></code>, the + last parameter, may optionally include a trailing ellipsis + (<code class="inline-code">...</code>), which indicates the macro takes a + variable number of parameters. Local variable + <code class="inline-code"><em class="code-color">paramN</em></code> will be a + sequence of the extra parameters. + </li> + + <li> + <code class="inline-code"><em class="code-color">returnValue</em></code>: + the expression that calculates the value of the method + call. + </li> + </ul> + + <p>The <code class="inline-code">return</code> directive can be used anywhere + and for any times between the <code class="inline-code"><#function + <em class="code-color">...</em>></code> and + <code class="inline-code"></#function></code>.</p> + + <p>Parameters without default value must precede parameters with + default value + (<code class="inline-code"><em class="code-color">paramName</em>=<em class="code-color">defaultValue</em></code>).</p> + + + + + +<h2 class="content-header header-section2" id="autoid_91">Description</h2> + + + <p>Creates a method variable (in the current namespace, if you + know namespace feature). This directive works in the same way as the + <a href="ref_directive_macro.html#ref.directive.macro"><code>macro</code> + directive</a>, except that <code class="inline-code">return</code> directive + <em>must</em> have a parameter that specifies the return + value of the method, and that attempts to write to the output will + be ignored. If the <code class="inline-code"></#function></code> is reached + (i.e. there was no <code class="inline-code">return + <em class="code-color">returnValue</em></code>), then the return + value of the method is an undefined variable.</p> + + <p>Example 1: Creating a method that calculates the average of + two numbers:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#function avg x y> + <#return (x + y) / 2> +</#function> +${avg(10, 20)}</pre></div> + + <p>will print:</p> + + + +<div class="code-wrapper"><pre class="code-block code-output">15</pre></div> + + <p>Example 2: Creating a method that calculates the average of + multiple numbers:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#function avg nums...> + <#local sum = 0> + <#list nums as num> + <#local sum += num> + </#list> + <#if nums?size != 0> + <#return sum / nums?size> + </#if> +</#function> +${avg(10, 20)} +${avg(10, 20, 30, 40)} +${avg()!"N/A"}</pre></div> + + <p>will print:</p> + + + +<div class="code-wrapper"><pre class="code-block code-output">15 +25 +N/A</pre></div> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_ftl.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_global.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_global.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/ref_directive_global.html b/builds/2.3.26-nightly/ref_directive_global.html new file mode 100644 index 0000000..e0a4a1d --- /dev/null +++ b/builds/2.3.26-nightly/ref_directive_global.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>global - 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="global"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/ref_directive_global.html"> +<link rel="canonical" href="http://freemarker.org/docs/ref_directive_global.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_global.html"><span itemprop="name">global</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","global"];</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_function.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_if.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="ref_directive_global" itemprop="headline">global</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#autoid_92" data-menu-target="autoid_92">Synopsis</a></li><li><a class="page-menu-link" href="#autoid_93" data-menu-target="autoid_93">Description</a></li></ul> </div><a name="ref.directive.global"></a> + + + + +<h2 class="content-header header-section2" id="autoid_92">Synopsis</h2> + + + +<pre class="metaTemplate"> +<code class="inline-code"><#global <em class="code-color">name</em>=<em class="code-color">value</em>></code> +or +<code class="inline-code"><#global <em class="code-color">name1</em>=<em class="code-color">value1</em> <em class="code-color">name2</em>=<em class="code-color">value2</em> <em class="code-color">... nameN</em>=<em class="code-color">valueN</em>></code> +or +<code class="inline-code"><#global <em class="code-color">name</em>> + <em class="code-color">capture this</em> +</#global></code> +</pre> + + + <p>Where:</p> + + <ul> + <li> + <code class="inline-code"><em class="code-color">name</em></code>: name + of the variable. It is not expression. However, it can be + written as a string literal, which is useful if the variable + name contains reserved characters, for example + <code class="inline-code"><#global "foo-bar" = 1></code>. Note that this + string literal does not expand interpolations (as + <code class="inline-code">"${foo}"</code>). + </li> + + <li> + <code class="inline-code">=</code>: Assignment operator, which can also + be one of the shorthand assignment operators + (<code class="inline-code">++</code>, <code class="inline-code">+=</code>, etc.), just like + with <a href="ref_directive_assign.html">the + <code>assign</code> directive</a>, + </li> + + <li> + <code class="inline-code"><em class="code-color">value</em></code>: the + value to store. Expression. + </li> + </ul> + + + + + +<h2 class="content-header header-section2" id="autoid_93">Description</h2> + + + <p>This directive is similar to <a href="ref_directive_assign.html#ref.directive.assign"><code>assign</code></a>, but + the variable created will be visible in all <a href="dgui_misc_namespace.html">namespaces</a>, and will not be + inside any namespace. Exactly as if you would create (or replace) a + variable of the data-model. Hence, the variable is global. If a + variable with the same name already exists in the data-model, it + will be hidden by the variable created with this directive. If a + variable with the same name already exists in the current namespace, + that will hide the variable created with <code class="inline-code">global</code> + directive.</p> + + <p>For example, with <code class="inline-code"><#global x = 1></code> you + create a variable that is visible as <code class="inline-code">x</code> in all + namespaces, unless another variable called <code class="inline-code">x</code> + hides it (for example a variable what you have created as + <code class="inline-code"><#assign x = 2></code>). In this case, you can use + <a href="dgui_template_exp.html#dgui_template_exp_var_special">special + variable</a> <code class="inline-code">globals</code>, like + <code class="inline-code">${.globals.x}</code>. Note that with + <code class="inline-code">globals</code> you see all globally accessible + variables; not only the variables that were created with + <code class="inline-code">global</code> directive, but also the variables of the + data-model.</p> + + <p>Note for custom JSP tag users: The set of variables created + with this directive corresponds to the JSP page-scope. This means, + that if a custom JSP tag wants to get a page-scope attribute + (page-scope bean), a variable with the same name in the current + namespace will not hide it from the viewpoint of the JSP tag.</p> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="ref_directive_function.html"><span>Previous</span></a><a class="paging-arrow next" href="ref_directive_if.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>
