http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/52c070a9/builds/2.3.26-nightly/dgui.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/dgui.html b/builds/2.3.26-nightly/dgui.html new file mode 100644 index 0000000..2a8f38d --- /dev/null +++ b/builds/2.3.26-nightly/dgui.html @@ -0,0 +1,54 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-part"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>Template Author's Guide - 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="Template Author's Guide"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/dgui.html"> +<link rel="canonical" href="http://freemarker.org/docs/dgui.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's Guide</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_templa te_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"];</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="index.html"><span>Previous</span></a><a class="paging-arrow next" href="dgui_quickstart.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-part" id="dgui" itemprop="headline">Template Author's Guide</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Section Contents</div> +<ul><li><a class="page-menu-link" href="dgui_quickstart.html" data-menu-target="dgui_quickstart">Getting Started</a><ul><li><a class="page-menu-link" href="dgui_quickstart_basics.html" data-menu-target="dgui_quickstart_basics">Template + data-model = output</a></li><li><a class="page-menu-link" href="dgui_quickstart_datamodel.html" data-menu-target="dgui_quickstart_datamodel">The data-model at a glance</a></li><li><a class="page-menu-link" href="dgui_quickstart_template.html" data-menu-target="dgui_quickstart_template">The template at a glance</a></li></ul></li><li><a class="page-menu-link" href="dgui_datamodel.html" data-menu-target="dgui_datamodel">Values, Types</a><ul><li><a class="page-menu-link" href="dgui_datamodel_basics.html" data-menu-target="dgui_datamodel_basics">Basics</a></li><li><a class="page-menu-link" href="dgui_datamodel_types.html" data-menu-target="dgui_datamodel_types">The types</a></li></ul></li><li><a class="page-menu-link" href="dgui_template.html" data-menu- target="dgui_template">The Template</a><ul><li><a class="page-menu-link" href="dgui_template_overallstructure.html" data-menu-target="dgui_template_overallstructure">Overall structure</a></li><li><a class="page-menu-link" href="dgui_template_directives.html" data-menu-target="dgui_template_directives">Directives</a></li><li><a class="page-menu-link" href="dgui_template_exp.html" data-menu-target="dgui_template_exp">Expressions</a></li><li><a class="page-menu-link" href="dgui_template_valueinsertion.html" data-menu-target="dgui_template_valueinsertion">Interpolations</a></li></ul></li><li><a class="page-menu-link" href="dgui_misc.html" data-menu-target="dgui_misc">Miscellaneous</a><ul><li><a class="page-menu-link" href="dgui_misc_userdefdir.html" data-menu-target="dgui_misc_userdefdir">Defining your own directives</a></li><li><a class="page-menu-link" href="dgui_misc_var.html" data-menu-target="dgui_misc_var">Defining variables in the template</a></li><li><a class="page-menu-link" hr ef="dgui_misc_namespace.html" data-menu-target="dgui_misc_namespace">Namespaces</a></li><li><a class="page-menu-link" href="dgui_misc_autoescaping.html" data-menu-target="dgui_misc_autoescaping">Auto-escaping and output formats</a></li><li><a class="page-menu-link" href="dgui_misc_whitespace.html" data-menu-target="dgui_misc_whitespace">White-space handling</a></li><li><a class="page-menu-link" href="dgui_misc_alternativesyntax.html" data-menu-target="dgui_misc_alternativesyntax">Alternative (square bracket) syntax</a></li></ul></li></ul> </div><div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="index.html"><span>Previous</span></a><a class="paging-arrow next" href="dgui_quickstart.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/dgui_datamodel.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/dgui_datamodel.html b/builds/2.3.26-nightly/dgui_datamodel.html new file mode 100644 index 0000000..ba980e9 --- /dev/null +++ b/builds/2.3.26-nightly/dgui_datamodel.html @@ -0,0 +1,54 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-chapter"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>Values, Types - 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="Values, Types"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/dgui_datamodel.html"> +<link rel="canonical" href="http://freemarker.org/docs/dgui_datamodel.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's Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="dgui_datamodel.html"><span itemprop="name">Values, Types</span></a></li></ul><div class="book marks" 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","Values, Types"];</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_quickstart_template.html"><span>Previous</span></a><a class="paging-arrow next" href="dgui_datamodel_basics.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-chapter" id="dgui_datamodel" itemprop="headline">Values, Types</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Section Contents</div> +<ul><li><a class="page-menu-link" href="dgui_datamodel_basics.html" data-menu-target="dgui_datamodel_basics">Basics</a></li><li><a class="page-menu-link" href="dgui_datamodel_types.html" data-menu-target="dgui_datamodel_types">The types</a></li></ul> </div><div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="dgui_quickstart_template.html"><span>Previous</span></a><a class="paging-arrow next" href="dgui_datamodel_basics.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/dgui_datamodel_basics.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/dgui_datamodel_basics.html b/builds/2.3.26-nightly/dgui_datamodel_basics.html new file mode 100644 index 0000000..70a9a49 --- /dev/null +++ b/builds/2.3.26-nightly/dgui_datamodel_basics.html @@ -0,0 +1,230 @@ +<!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>Basics - 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="Basics"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/dgui_datamodel_basics.html"> +<link rel="canonical" href="http://freemarker.org/docs/dgui_datamodel_basics.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's Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="dgui_datamodel.html"><span itemprop="name">Values, Types</span></a></li><li class="step-3" it emprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="dgui_datamodel_basics.html"><span itemprop="name">Basics</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","Values, Types","Basics"];</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_datamodel.html"><span>Previous</span></a><a class="paging-arrow next" href="dgui_datamodel_types.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="dgui_datamodel_basics" itemprop="headline">Basics</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#topic.value" data-menu-target="topic.value">What is a value?</a></li><li><a class="page-menu-link" href="#autoid_9" data-menu-target="autoid_9">What is type?</a></li><li><a class="page-menu-link" href="#autoid_10" data-menu-target="autoid_10">The data-model is a hash</a></li></ul> </div> <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>It is assumed that you have already read the <a href="dgui_quickstart.html">Getting Started</a> chapter.</p> + </div> +<p>Understanding the concept of values and types is crucial for the + understanding of data-models. However, the concept of values and types + is not confined to data-models, as you will see.</p> + + + + +<h2 class="content-header header-section2" id="topic.value">What is a value?</h2> + + + + + <p><span class="marked-for-programmers">Real programmers can safely skip + this section.</span></p> + + <p>Examples of <em>values</em> as you know the term + from the everyday math are 16, 0.5, and so on, i.e. numbers. In the + case of computer languages the value term has a wider meaning, as a + value needn't be a number. For example, take this data-model:</p> + + + +<div class="code-wrapper"><pre class="code-block code-data-model"><a name="example.stdDataModel"></a>(root) + | + +- user = "Big Joe" + | + +- today = Jul 6, 2007 + | + +- todayHoliday = false + | + +- lotteryNumbers + | | + | +- (1st) = 20 + | | + | +- (2st) = 14 + | | + | +- (3rd) = 42 + | | + | +- (4th) = 8 + | | + | +- (5th) = 15 + | + +- cargo + | + +- name = "coal" + | + +- weight = 40</pre></div> + + <p>We say that the <em>value</em> of the the + <code class="inline-code">user</code> variable is "Big Joe" (a string), the + <em>value</em> of <code class="inline-code">today</code> is Jul 6, + 2007 (a date), the <em>value</em> of + <code class="inline-code">todayHoliday</code> is false (a boolean, ie. a yes/no + thing). The <em>value</em> of + <code class="inline-code">lotteryNumbers</code> is the sequence that contains 20, + 14, 42, 8, 15. Surely <code class="inline-code">lotteryNumbers</code> is multiple + values in the sense that it <em>contains</em> multiple + values (for example, the 2nd item in it is a the + <em>value</em> 14), but still, + <code class="inline-code">lotteryNumbers</code> itself is a single value. It's + like a box that contains many other items; the whole box can be seen + as a single item. Last not least we also have the + <em>value</em> of <code class="inline-code">cargo</code>, which is a + hash (a box-like thing again).So, a value is something that can be + stored in a variable (e.g., in <code class="inline-code">user</code> or + <code class="inline-code">cargo</code> or <code class="inline-code">cargo.name</code>). But a + value need not be stored in a variable to be called a value, for + example we have the value 100 here:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><#if cargo.weight < <strong>100</strong>>Light cargo</#if></pre></div> + + <p>The temporaly result of a calculations are also called values, + like 20 and 120 when this template is executed (it will print + 120):</p> + + + +<div class="code-wrapper"><pre class="code-block code-template">${cargo.weight / 2 + 100}</pre></div> + + <p>Explanation for this last: As the result of dividing the two + values, 40 (the weight of the cargo) and 2, a new value 20 is + created. Then 100 is added to it, so the value 120 is created. Then + 120 is printed + (<code class="inline-code">${<em class="code-color">...</em>}</code>), and the + template execution goes on and all these values gone.</p> + + <p>Certainly now you feel what the value term means.</p> + + + + + +<h2 class="content-header header-section2" id="autoid_9">What is type?</h2> + + + <p>Values have an important aspect, their type. For example the + type of the value of the <code class="inline-code">user</code> variable is string, + and the type of the value of the <code class="inline-code">lotteryNumbers</code> + variable is sequence. The type of a value is important because it + determines to a large extent how and where you can use the value. + Like <code class="inline-code">${user / 2}</code> is an error, but + <code class="inline-code">${cargo.weight / 2}</code> works and prints 20, since + division only does make sense for a number, but not for a string. + Or, using dot like in <code class="inline-code">cargo.name</code> does make sense + only if <code class="inline-code">cargo</code> is a hash. Or, you can list with + <code class="inline-code"><#list <em class="code-color">...</em>></code> + sequences only. Or, the condition of <code class="inline-code"><#if + ...></code> must be a boolean. And so on.</p> + + <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>A little terminology... Saying "a boolean" or "a boolean + value" or "a value of type boolean" are all the same.</p> + </div> + + + <p><a name="topic.multitype"></a>A value can have multiple types at the same time, + although it's rarely utilized. For example in the data-model below + <code class="inline-code">mouse</code> is both a string and a hash:</p> + + + +<div class="code-wrapper"><pre class="code-block code-data-model">(root) + | + +- mouse = "Yerri" + | + +- age = 12 + | + +- color = "brown"</pre></div> + + <p>If you merge this template with the above data-model:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template">${mouse} <#-- uses mouse as a string --> +${mouse.age} <#-- uses mouse as a hash --> +${mouse.color} <#-- uses mouse as a hash --></pre></div> + + <p>the output will be:</p> + + + +<div class="code-wrapper"><pre class="code-block code-output">Yerri +12 +brown</pre></div> + + + + + +<h2 class="content-header header-section2" id="autoid_10">The data-model is a hash</h2> + + + <p>Looking at the various data-model examples you may already + realized: the thing marked as "(root)" is just a value of type hash. + When you write something like <code class="inline-code">user</code>, that means + that you want the "user" variable stored in the root hash. Like if + you were writing <code class="inline-code">root.user</code>, except that there is + no variable called "root" so that wouldn't work.</p> + + <p>Some may get confused by the fact that our example data-model, + that is, the root hash, contains further hashes and sequences + (<code class="inline-code">lotteryNumbers</code> and <code class="inline-code">cargo</code>). + There is nothing special in that. A hash contains other variables, + and those variables have a value, which can be a string, a number, + etc., and of course it can be a hash or sequence as well. Because, + as it was explained earlier, a sequence or a hash is just a value, + like a string or a number is.</p> + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="dgui_datamodel.html"><span>Previous</span></a><a class="paging-arrow next" href="dgui_datamodel_types.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/dgui_datamodel_types.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/dgui_datamodel_types.html b/builds/2.3.26-nightly/dgui_datamodel_types.html new file mode 100644 index 0000000..348a837 --- /dev/null +++ b/builds/2.3.26-nightly/dgui_datamodel_types.html @@ -0,0 +1,512 @@ +<!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>The types - 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="The types"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/dgui_datamodel_types.html"> +<link rel="canonical" href="http://freemarker.org/docs/dgui_datamodel_types.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's Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="dgui_datamodel.html"><span itemprop="name">Values, Types</span></a></li><li class="step-3" it emprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="dgui_datamodel_types.html"><span itemprop="name">The types</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","Values, Types","The types"];</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_datamodel_basics.html"><span>Previous</span></a><a class="paging-arrow next" href="dgui_template.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="dgui_datamodel_types" itemprop="headline">The types</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Page Contents</div> +<ul><li><a class="page-menu-link" href="#dgui_datamodel_scalar" data-menu-target="dgui_datamodel_scalar">Scalars</a></li><li><a class="page-menu-link" href="#dgui_datamodel_container" data-menu-target="dgui_datamodel_container">Containers</a></li><li><a class="page-menu-link" href="#autoid_11" data-menu-target="autoid_11">Subroutines</a><ul><li><a class="page-menu-link" href="#dgui_datamodel_method" data-menu-target="dgui_datamodel_method">Methods and functions</a></li><li><a class="page-menu-link" href="#dgui_datamodel_userdefdir" data-menu-target="dgui_datamodel_userdefdir">User-defined directives</a></li><li><a class="page-menu-link" href="#autoid_12" data-menu-target="autoid_12">Function/method versus user-defined directive</a></li></ul></li><li><a class="page-menu-link" href="#autoid_13" data-menu-target="autoid_13">Miscellaneous</a><ul><li><a class="page-menu-link" href="#dgui_datamodel_node" data-menu-target="dgui_datamodel_node">Nodes</a></li><li><a class="page-menu-link" hr ef="#dgui_datamodel_markupoutput" data-menu-target="dgui_datamodel_markupoutput">Markup output</a></li></ul></li></ul> </div><p>The suppored types are:</p><ul> + <li> + <a href="#dgui_datamodel_scalar">Scalars:</a> + + <ul> + <li> + String + </li> + + <li> + Number + </li> + + <li> + Boolean + </li> + + <li> + Date-like (date, time, or date-time) + </li> + </ul> + </li> + + <li> + <a href="#dgui_datamodel_container">Containers:</a> + + <ul> + <li> + Hash + </li> + + <li> + Sequence + </li> + + <li> + Collection + </li> + </ul> + </li> + + <li> + Subroutines: + + <ul> + <li> + <a href="#dgui_datamodel_method">Methods and + functions</a> + </li> + + <li> + <a href="#dgui_datamodel_userdefdir">User-defined + directives</a> + </li> + </ul> + </li> + + <li> + Miscellaneous/seldom used: + + <ul> + <li> + <a href="#dgui_datamodel_node">Node</a> + </li> + + <li> + <a href="#dgui_datamodel_markupoutput">Markup + output</a> + </li> + </ul> + </li> + </ul> + + + + +<h2 class="content-header header-section2" id="dgui_datamodel_scalar">Scalars</h2> + + + <a name="topic.designer.scalarVariable"></a> + + <p>These are the basic, simple kind of values. They can + be:</p> + + <ul> + <li> + <p>String: It is simple text, e.g., the name of a + product.</p> + + <p>If you want to give a string value directly in the + template, rather than use a variable that comes from the data + model, you write the text between quotation marks, e.g., + <code class="inline-code">"green mouse"</code> or <code class="inline-code">'green + mouse'</code>. (More details regarding the syntax can be + found <a href="dgui_template_exp.html#dgui_template_exp_direct_string">later</a>.)</p> + </li> + + <li> + <p>Number: For example the price of a product. + <span class="marked-for-programmers">Whole numbers and non-whole + numbers are not distinguished; there is only a single number + type. So for example 3/2 will be always 1.5, and never 1. Just + like if you are using a calculator.</span></p> + + <p>If you want to give a numerical value directly in the + template, then you write for example: <code class="inline-code">150</code> or + <code class="inline-code">-90.05</code> or <code class="inline-code">0.001</code>. (More + details regarding the syntax can be found <a href="dgui_template_exp.html#dgui_template_exp_direct_number">later</a>.)</p> + </li> + + <li> + <p>Boolean: A boolean value represents a logical true + or false (yes or no). For example, if a the visitor has been + logged in or not. Typically you use booleans as the condition of + the <code class="inline-code">if</code> directive, like <code class="inline-code"><#if + loggedIn + ><em class="code-color">...</em></#if></code> or + <code class="inline-code"><#if price == + 0><em class="code-color">...</em></#if></code>; in + the last case the result of the <code class="inline-code">price == 0</code> + part is a boolean value.</p> + + <p>In the templates you can directly specify a boolean with + the reserved words <code class="inline-code">true</code> and + <code class="inline-code">false</code>.</p> + </li> + + <li> + <p>Date: A date-like value stores date/time related + data. It has three variations:</p> + + <ul> + <li> + <p>Date: Like April 4, 2003. Day precision, no time of + day part.</p> + </li> + + <li> + <p>Time: Like 10:19:18 PM. Millisecond precision, no date + part.</p> + </li> + + <li> + <p>Date-time (sometimes called "time stamp") as April 4, + 2003 10:19:18 PM. Both date and time, with millisecond + precision.</p> + </li> + </ul> + + <p>Unfortunately, because of the limitations of the Java + platform, FreeMarker sometimes can't decide which parts of the + date are in use (i.e., if it is date-time, a date or a time). + The solution for this problem is an advanced topic that will be + discussed <a href="ref_builtins_date.html#ref_builtin_date_datetype">later</a>.</p> + + <p>It is possible to define date-like values directly in + templates, but this is an advanced topic that will be explained + <a href="ref_builtins_string.html#ref_builtin_string_date">later</a>.</p> + </li> + </ul> + + <p>Bear in mind that FreeMarker distinguishes strings from + numbers, booleans and date-like values. For example, while the + string <code class="inline-code">"150"</code> looks like the number + <code class="inline-code">150</code>, a string is still just arbitrary sequence of + characters, and you can't do arithmetic with it, can't compare it + with another number, etc.</p> + + + + + +<h2 class="content-header header-section2" id="dgui_datamodel_container">Containers</h2> + + + + + <p>These are the values whose purpose is to contain other + variables; they are just containers. The contained variables are + often referred as <em>sub variables</em>. The container + types are:</p> + + <ul> + <li> + <p>Hash: Associates a unique lookup name with each of + its sub variables. The name is an unrestricted string. A hash + <em>doesn't define an ordering</em> for the sub + variables in it. That is, there is no such thing as the first + subvariable, and the second subvariable, etc.; the variables are + just accessed by name.</p> + </li> + + <li> + <p>Sequence: Associates an integer number with each + of its sub variables. The first subvariable is associated with + 0, the second with 1, the third to 2, and so on; the sub + variables are ordered. These numbers are often called the + <em>indexes</em> of the sub variables. Sequences are + usually dense, i.e., all indexes up to the index of the last + subvariable have an associated subvariable, but it's not + strictly necessary. The type of the subvariable values need not + be the same.</p> + </li> + + <li> + <p>Collection: A collection, from the viewpoint of + the template author, is a restricted sequence. You cannot access + its size or retrieve its sub variables by index, but they can be + still listed with the <a href="ref_directive_list.html#ref.directive.list"><code>list</code> + directive</a>.</p> + </li> + </ul> + + <p>Note that since <a href="dgui_datamodel_basics.html#topic.multitype">a value can + have multiple types</a>, it is possible for a value to be both a + hash and a sequence, in which case it would support index-based + access as well as access by lookup name. However, typically a + container will be either a hash or a sequence, not both.</p> + + <p>As the value of the variables stored in hashes and sequences + (and collections) can be anything, it can be a hash or sequence (or + collection) as well. This way you can build arbitrarily deep + structures.</p> + + <p>The data-model itself (or better said the root of it) is a + hash.</p> + + + + + +<h2 class="content-header header-section2" id="autoid_11">Subroutines</h2> + + + + + + + +<h3 class="content-header header-section3" id="dgui_datamodel_method">Methods and functions</h3> + + + <a name="topic.designer.methodVariable"></a> + + + + <p>A value that is a method or a function is used to calculate + another value, influenced by the parameters you give to it.</p> + + <p><span class="marked-for-programmers">For programmer types: + Methods/functions are first-class values, just like in functional + programming languages. This means that functions/methods can be + the parameters or return values of other functions/methods, you + can assign them to variables, and so on.</span></p> + + <p>Suppose that programmers have put the method variable + <code class="inline-code">avg</code> in the data-model that can be used to + calculate the average of numbers. If you give the 3 and 5 as + parameters when you access <code class="inline-code">avg</code>, then you get + the value 4.</p> + + <p>The usage of methods will be explained <a href="dgui_template_exp.html#dgui_template_exp_methodcall">later</a>, but perhaps + this example helps to understand what methods are:</p> + + + +<div class="code-wrapper"><pre class="code-block code-template">The average of 3 and 5 is: ${avg(3, 5)} +The average of 6 and 10 and 20 is: ${avg(6, 10, 20)} +The average of the price of a python and an elephant is: +${avg(animals.python.price, animals.elephant.price)}</pre></div> + + <p>this will output:</p> + + + +<div class="code-wrapper"><pre class="code-block code-output">The average of 3 and 5 is: 4 +The average of 6 and 10 and 20 is: 12 +The average of the price of a python and an elephant is: +4999.5</pre></div> + + <p>What is the difference between a method and a function? As + far as the template author is concerned, nothing. Well not really + nothing, as methods typically come from the data-model (<span class="marked-for-programmers">as they reflect the methods of Java + objects</span>), and functions are defined in templates (with + the <a href="ref_directive_function.html#ref.directive.function"><code>function</code> + directive</a> -- an advanced topic), but both can be used on + the same way.</p> + + + + + + + +<h3 class="content-header header-section3" id="dgui_datamodel_userdefdir">User-defined directives</h3> + + + + + + + + + <p>A value of this type can be used as user-defined directive + (with other words, as FreeMarker tag). An user-defined directive + is a subroutine, something like a little reusable template + fragment. But this is an advanced topic that will be explained + <a href="dgui_misc_userdefdir.html">later</a> in its own + chapter.</p> + + <p><span class="marked-for-programmers">For programmer types: + user-defined directives (such as macros), are first-class values + too, just like functions/methods are.</span></p> + + <p>Just to get an idea about user-defined directives (so just + ignore this if you won't understand), assume we have a variable, + <code class="inline-code">box</code>, whose value is a user-defined directive + that prints some kind of fancy HTML message box with a title bar + and a message in it. The <code class="inline-code">box</code> variable could be + used in the template like this (for example):</p> + + + +<div class="code-wrapper"><pre class="code-block code-template"><@<strong>box</strong> title="Attention!"> + Too much copy-pasting may leads to + maintenance headaches. +</@<strong>box</strong>></pre></div> + + + + + + + +<h3 class="content-header header-section3" id="autoid_12">Function/method versus user-defined directive</h3> + + + <p>This is for advanced users again (so ignore it if you don't + understand). It's a frequent dilemma if you should use a + function/method or an user-defined directive to implement + something. The rule of thumb is: Implement the facility as + user-defined directive instead of as function/method if:</p> + + <ul> + <li> + <p>... the purpose of it is generating a piece of the + output that's not just a single value, and typically involves + markup. The template language was designed for printing to the + output directly, piece by piece, as it goes though + <code class="inline-code">list</code> loops, <code class="inline-code">if</code>-s, etc. + Building up a string value in a variable then returning it is + much less convenient.</p> + </li> + + <li> + <p>... it's the side-effect that is important and not the + return value. For example, a directive whose purpose is to add + an entry to the server log is like that. (In fact you can't + have a return value for a user-defined directive, but some + kind of feedback is still possible by setting non-local + variables.)</p> + </li> + + <li> + <p>... it will do flow control on the caller side (like for + example <code class="inline-code">list</code> or <code class="inline-code">if</code> + directives do). You just can't do that with a + function/method.</p> + </li> + + <li> + <p>... you are using legacy escaping via the + <code class="inline-code">escape</code> directive (instead of <a href="dgui_misc_autoescaping.html">auto-escaping</a>), and + the result contains markup. When you print the result with + <code class="inline-code">${<em class="code-color">...</em>}</code>, the + markup will be escaped and thus ruined, but if it's printed by + a directive call + (<code class="inline-code"><@<em class="code-color">...</em>></code>), + it won't be.</p> + </li> + </ul> + + <p>The Java methods of FreeMarker-unaware Java objects are + normally visible as methods in templates, regardless of the nature + of the Java method; you have no choice there.</p> + + + + + + +<h2 class="content-header header-section2" id="autoid_13">Miscellaneous</h2> + + + + + + + +<h3 class="content-header header-section3" id="dgui_datamodel_node">Nodes</h3> + + + + + <p>Node variables represent a node in a tree structure, and are + used mostly with <a href="xgui.html">XML processing</a>, which + is an advanced, and specialized topic.</p> + + <p>Still, a quick overview <em>for advanced + users</em>: A node is similar to a sequence that stores + other nodes, which are often referred as the children nodes. A + node stores a reference to its container node, which is often + referred as the parent node. The main point of being a node is the + topological information; other data must be stored by utilizing + that a value can have multiple types. Like, a value may be both a + node and a number, in which case it can store a number as the + "pay-load". Apart from the topological information, a node can + store some metainformation as well: a node name, a node type + (string), and a node namespace (string). For example, if the node + symbolizes a <code class="inline-code">h1</code> element in an XHTML document, + then its name could be <code class="inline-code">"h1"</code>, it's node type + could be <code class="inline-code">"element"</code>, and it's namespace could be + <code class="inline-code">"http://www.w3.org/1999/xhtml"</code>. But it's up to + the designer of the data-model if what meaning these + metainformations have, and if they are used at all. The way of + retrieving the topological and metainformations is described <a href="ref_builtins_node.html">in a later chapter</a> (that you + don't have to understand at this point).</p> + + + + + + + +<h3 class="content-header header-section3" id="dgui_datamodel_markupoutput">Markup output</h3> + + + + + <p>This type is related to <a href="dgui_misc_autoescaping.html">auto-escaping mechanism</a> + introduced FreeMarker 2.3.24; you can <a href="dgui_misc_autoescaping.html#dgui_misc_autoescaping_movalues">read about this type + there</a>. But in short, this is a value that stores text + that's already in the output markup format (like HTML, XML, RTF, + etc.), and hence must not be auto-escaped.</p> + + <p>Values of this type are usually produced inside the + templates (like with <a href="ref_builtins_string.html#ref_builtin_no_esc"><code>no_esc</code> + built-in</a> or <a href="ref_directive_assign.html">output + capturing assignments</a>), but can also be part of the + data-model. Such values in the data-model are useful for example + if you have message resources that sometimes contain the message + in HTML format, rather than in plain text. If the data-model uses + HTML markup output values for those messages instead of strings, + then the template author need not know which messages contain HTML + and which plain text, as double escaping will be avoided + automatically when the message is inserted with + <code class="inline-code">${<em class="code-color">...</em>}</code>.</p> + + <div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="dgui_datamodel_basics.html"><span>Previous</span></a><a class="paging-arrow next" href="dgui_template.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/dgui_misc.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/dgui_misc.html b/builds/2.3.26-nightly/dgui_misc.html new file mode 100644 index 0000000..5964dab --- /dev/null +++ b/builds/2.3.26-nightly/dgui_misc.html @@ -0,0 +1,54 @@ +<!doctype html> +<!-- Generated by FreeMarker/Docgen from DocBook --> +<html lang="en" class="page-type-chapter"> +<head prefix="og: http://ogp.me/ns#"> +<meta charset="utf-8"> +<title>Miscellaneous - 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="Miscellaneous"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/dgui_misc.html"> +<link rel="canonical" href="http://freemarker.org/docs/dgui_misc.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's Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="dgui_misc.html"><span itemprop="name">Miscellaneous</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","Miscellaneous"];</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_valueinsertion.html"><span>Previous</span></a><a class="paging-arrow next" href="dgui_misc_userdefdir.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-chapter" id="dgui_misc" itemprop="headline">Miscellaneous</h1> +</div></div><div class="page-menu"> +<div class="page-menu-title">Section Contents</div> +<ul><li><a class="page-menu-link" href="dgui_misc_userdefdir.html" data-menu-target="dgui_misc_userdefdir">Defining your own directives</a></li><li><a class="page-menu-link" href="dgui_misc_var.html" data-menu-target="dgui_misc_var">Defining variables in the template</a></li><li><a class="page-menu-link" href="dgui_misc_namespace.html" data-menu-target="dgui_misc_namespace">Namespaces</a></li><li><a class="page-menu-link" href="dgui_misc_autoescaping.html" data-menu-target="dgui_misc_autoescaping">Auto-escaping and output formats</a></li><li><a class="page-menu-link" href="dgui_misc_whitespace.html" data-menu-target="dgui_misc_whitespace">White-space handling</a></li><li><a class="page-menu-link" href="dgui_misc_alternativesyntax.html" data-menu-target="dgui_misc_alternativesyntax">Alternative (square bracket) syntax</a></li></ul> </div><div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="dgui_template_valueinsertion.html"><span>Previo us</span></a><a class="paging-arrow next" href="dgui_misc_userdefdir.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/dgui_misc_alternativesyntax.html ---------------------------------------------------------------------- diff --git a/builds/2.3.26-nightly/dgui_misc_alternativesyntax.html b/builds/2.3.26-nightly/dgui_misc_alternativesyntax.html new file mode 100644 index 0000000..1ed87aa --- /dev/null +++ b/builds/2.3.26-nightly/dgui_misc_alternativesyntax.html @@ -0,0 +1,119 @@ +<!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>Alternative (square bracket) syntax - 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="Alternative (square bracket) syntax"> +<meta property="og:locale" content="en_US"> +<meta property="og:url" content="http://freemarker.org/docs/dgui_misc_alternativesyntax.html"> +<link rel="canonical" href="http://freemarker.org/docs/dgui_misc_alternativesyntax.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's Guide</span></a></li><li class="step-2" itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="dgui_misc.html"><span itemprop="name">Miscellaneous</span></a></li><li class="step-3" itempro p="itemListElement" itemscope itemtype="http://schema.org/ListItem"><a class="label" itemprop="item" href="dgui_misc_alternativesyntax.html"><span itemprop="name">Alternative (square bracket) syntax</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","Miscellaneous","Alternative (square bracket) syntax"];</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_misc_whitespace.html"><span>Previous</span></a><a class="paging-arrow next" href="pgui.html"><span>Next</span></a></div><div class="title-wrapper"> +<h1 class="content-header header-section1" id="dgui_misc_alternativesyntax" itemprop="headline">Alternative (square bracket) syntax</h1> +</div></div> <div class="callout note"> + <strong class="callout-label">Note:</strong> + + <p>This feature exists since FreeMarker 2.3.4.</p> + </div> +<p>FreeMarker supports an alternative syntax, where + <code class="inline-code">[</code> and <code class="inline-code">]</code> is used instead of + <code class="inline-code"><</code> and <code class="inline-code">></code> in FreeMarker + directives and comments, for example:</p><ul> + <li> + Calling predefined directive: <code class="inline-code">[#list animals as + animal]<em class="code-color">...</em>[/#list]</code> + </li> + + <li> + Calling user-defined directive: <code class="inline-code">[@myMacro + /]</code> + </li> + + <li> + Comment: <code class="inline-code">[#-- the comment --]</code> + </li> + </ul><p>To use the alternative syntax instead of the default one, start + the template with the <a href="ref_directive_ftl.html"><code>ftl</code> directive</a> + using the alternative syntax. If you don't know what is the + <code class="inline-code">ftl</code> directive, just start the template with + <code class="inline-code">[#ftl]</code>, and remember that it should be the very + first thing in the file (except that <a href="gloss.html#gloss.whiteSpace">white-space</a> can precede it). For + example, this is how the last example of the <a href="dgui_quickstart_template.html">Getting Started</a> looks with + the alternative syntax (assuming it's a complete template, not just a + fragment):</p> + +<div class="code-wrapper"><pre class="code-block code-template"><strong>[#ftl]</strong> +<p>We have these animals: +<table border=1> + <tr><th>Name<th>Price + <strong>[#list animals as animal]</strong> + <tr> + <td> + <strong>[#if animal.size == "large"]</strong><b><strong>[/#if]</strong> + ${animal.name} + <strong>[#if animal.size == "large"]</strong></b><strong>[/#if]</strong> + <td>${animal.price} Euros + <strong>[/#list]</strong> +</table></pre></div><p>The alternative (square bracket) and the default (angle bracket) + syntax are mutually exclusive within a template. That is, either the + whole template uses alternative syntax, or the whole template uses the + default syntax. If the template uses alternative syntax, things like + <code class="inline-code"><#if <em class="code-color">...</em>></code> are + count as static text, not as FTL tags. Similarly, if the template uses + the default syntax, things like <code class="inline-code">[#if + <em class="code-color">...</em>]</code> count as static text, not as + FTL tags.</p><p>If you start the file with <code class="inline-code">[#ftl + <em class="code-color">...</em>]</code> (where the + <code class="inline-code"><em class="code-color">...</em></code> stands for the + optional parameters; of course <code class="inline-code">[#ftl]</code> works too) + the file will surely use the alternative (square bracket) syntax. If + you start the file with <code class="inline-code"><#ftl + <em class="code-color">...</em>></code> the file will surely use + the normal (angle bracket) syntax. If there is no + <code class="inline-code">ftl</code> directive in the file, then the programmer + decides what the syntax will be by configuring FreeMarker <span class="marked-for-programmers">(programmers see + <code class="inline-code">Configuration.setTagSyntax(int)</code> in the API + javadocs)</span>. Most probably the programmers use the factory + default however. The factory default in 2.3.x is using the normal + syntax. The factory default in 2.4.x will be auto-detection, which + means that the first FreeMarker tag determines the syntax (it can be + anything, not just <code class="inline-code">ftl</code>).</p><div class="bottom-pagers-wrapper"><div class="pagers bottom"><a class="paging-arrow previous" href="dgui_misc_whitespace.html"><span>Previous</span></a><a class="paging-arrow next" href="pgui.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>
