Return-Path:
X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io
Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io
Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183])
by cust-asf2.ponee.io (Postfix) with ESMTP id B305D200D42
for ; Fri, 3 Nov 2017 02:39:20 +0100 (CET)
Received: by cust-asf.ponee.io (Postfix)
id B1927160BFC; Fri, 3 Nov 2017 01:39:20 +0000 (UTC)
Delivered-To: archive-asf-public@cust-asf.ponee.io
Received: from mail.apache.org (hermes.apache.org [140.211.11.3])
by cust-asf.ponee.io (Postfix) with SMTP id 36285160BE6
for ; Fri, 3 Nov 2017 02:39:18 +0100 (CET)
Received: (qmail 50251 invoked by uid 500); 3 Nov 2017 01:39:17 -0000
Mailing-List: contact notifications-help@freemarker.incubator.apache.org; run by ezmlm
Precedence: bulk
List-Help:
List-Unsubscribe:
List-Post:
List-Id:
Reply-To: dev@freemarker.incubator.apache.org
Delivered-To: mailing list notifications@freemarker.incubator.apache.org
Received: (qmail 50241 invoked by uid 99); 3 Nov 2017 01:39:17 -0000
Received: from pnap-us-west-generic-nat.apache.org (HELO spamd3-us-west.apache.org) (209.188.14.142)
by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Nov 2017 01:39:17 +0000
Received: from localhost (localhost [127.0.0.1])
by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id 54BB21808EF
for ; Fri, 3 Nov 2017 01:39:16 +0000 (UTC)
X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org
X-Spam-Flag: NO
X-Spam-Score: -4.222
X-Spam-Level:
X-Spam-Status: No, score=-4.222 tagged_above=-999 required=6.31
tests=[KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_HI=-5,
RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01,
RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001] autolearn=disabled
Received: from mx1-lw-us.apache.org ([10.40.0.8])
by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024)
with ESMTP id PHBYNhZDXdOp for ;
Fri, 3 Nov 2017 01:38:50 +0000 (UTC)
Received: from mail.apache.org (hermes.apache.org [140.211.11.3])
by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with SMTP id A81746112D
for ; Fri, 3 Nov 2017 01:38:47 +0000 (UTC)
Received: (qmail 49470 invoked by uid 99); 3 Nov 2017 01:38:47 -0000
Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23)
by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 03 Nov 2017 01:38:47 +0000
Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33)
id 8EA2BE0823; Fri, 3 Nov 2017 01:38:44 +0000 (UTC)
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
From: woonsan@apache.org
To: notifications@freemarker.incubator.apache.org
Date: Fri, 03 Nov 2017 01:38:55 -0000
Message-Id:
In-Reply-To:
References:
X-Mailer: ASF-Git Admin Mailer
Subject: [13/16] incubator-freemarker-site git commit: Uploading new manual
(2.3.27) to asf-site
archived-at: Fri, 03 Nov 2017 01:39:20 -0000
http://git-wip-us.apache.org/repos/asf/incubator-freemarker-site/blob/5decc99a/docs/dgui_template_exp.html
----------------------------------------------------------------------
diff --git a/docs/dgui_template_exp.html b/docs/dgui_template_exp.html
index 60bec1b..1d6a9cd 100644
--- a/docs/dgui_template_exp.html
+++ b/docs/dgui_template_exp.html
@@ -14,7 +14,7 @@
-
+
-
-
+
+
When you supply values for interpolations or directive
parameters you can use variables or more complex expressions. For
example, if x is the number 8 and y is 5, the value of (x +
y)/2 resolves to the numerical value 6.5.
Before we go into details, let's see some concrete
@@ -874,7 +874,7 @@ baz
book[test]. More examples; these are all
equivalent: book.author.name,
book["author"].name,
- book.author.["name"],
+ book.author["name"],
book["author"]["name"].
When you use the dot syntax, the same restrictions apply
@@ -1112,7 +1112,7 @@ J
-
You can a slice a string in the same way as you slice a
+
@@ -1129,7 +1129,8 @@ J
multi-typed value), then slicing will slice the sequence
instead of the string. When you are processing XML, such
values are common. In such cases you can use
- someXMLnode?string[range].
+ someXMLnode?string[range]
+ to fore string slicing.
@@ -1437,8 +1438,6 @@ Slicing with right-unlimited ranges:
${-12 % -5} <#-- Prints -2 -->
${-12 % 5} <#-- Prints -2 -->
${12 % -5} <#-- Prints 2 -->
+
+
About the precision of the operations:
+ By default FreeMarker uses BigDecimal-s for all
+ arithmetical calculations, to avoid rounding and overflow/underflow
+ artifacts, and also keeps the result as
+ BigDecimal-s. So + (addition),
+ - (subtraction) and *
+ (multiplication) are "lossless". Again by default,
+ / (division) results are calculated to 12
+ decimals with half-up rounding (unless some operands have even more
+ decimals, in which case it's calculated with that much decimals).
+ All this behavior depends on the
+ arithmetic_engine configuration setting
+ (Configurable.setArithmericEngine(ArithmericEngine))
+ though, and some application might use a different value than the
+ default, although that's highly uncommon.
@@ -1606,33 +1621,29 @@ ${12 % -5} <#-- Prints 2 -->
<#if (x > y)>, although it's considered
to be less elegant.
-
- Note:
-
-
FreeMarker supports some other alternatives too, but these
- are deprecated:
+
FreeMarker supports some more syntactical alternatives:
-
-
-
Writing > and
- < on the place of the problematic
- relation marks, like in: <#if x >
- y> or <#if x >=
- y> . Note that in general FTL does not support
- entity references (the
- &...;
- things) in FTL tags; it's just an exception with the
- arithmetical comparisons.
-
-
-
-
\lt, \lte,
- \gt and \gte which are
- the same as the ones without the backslash
-
-
-
+
+
+
> and
+ < can also be used, like in:
+ <#if x > y> or <#if
+ x >= y>. This isn't meant to be entered
+ manually; it's to work around cases where the template gets
+ XML/HTML escaped and the user can't easily prevent that
+ happening. Note that in general FTL does not support entity
+ references (the
+ &...; things)
+ in FTL tags; it's just an exception with these operators.
+
+
+
Deprecated forms: \lt,
+ \lte, \gt and
+ \gte. These are the same as the ones without
+ the backslash.
+
+
@@ -1680,6 +1691,38 @@ ${12 % -5} <#-- Prints 2 -->
<#if !hot> <#-- here hot must be a boolean -->
It's not hot.
</#if>
+
+
FreeMarker supports some more syntactical alternatives:
+
+
+
+
\and (since FreeMarker 2.3.27): In some
+ applications using && causes problems
+ as it's not valid in XML or HTML. While FreeMarker templates was
+ never intended to be valid XML/HTML, only their output should be
+ that, in reality there are some applications that expect the
+ template itself to be valid XML/HTML regardless. This syntax is
+ a workaround for such cases. Also note that unlike with the
+ comparison operators, and without
+ \ is not supported due to backward
+ compatibility restrictions.
+
+
+
+
&& (since FreeMarker
+ 2.3.27): This isn't meant to be entered manually; it's to work
+ around cases where the template gets XML/HTML escaped and the
+ user can't easily prevent that happening. Note that in general
+ FTL does not support entity references (the
+ &...; things)
+ in FTL tags; it's just an exception with these operators.
+
+
+
+
Deprecated forms: & and
+ |. Don't use them anymore.
Expression may contain comments anywhere where they can
+ contain ignored white-space (see above). Comments
+ look like <#-- ... --> or as [#--
+ ... --]. Example:
+
+
+
+
<#assign x <#-- A comment --> = 123 <#-- A comment -->>
+<#function f(x <#-- A comment -->, y <#-- A comment -->)>
+ <#return <#-- A comment --> 1 <#-- A comment -->>
+</#function>
+<#assign someHash = {
+ "foo": 123, <#-- A comment -->
+ "bar": x <#-- A comment --> + 1,
+ <#-- A comment -->
+ "baaz": f(1 <#-- A comment -->, 2 <#-- A comment -->)
+} <#-- A comment -->>