freemarker-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ddek...@apache.org
Subject [8/8] incubator-freemarker git commit: Merge remote-tracking branch 'origin/2.3-gae'
Date Sat, 19 Dec 2015 16:53:15 GMT
Merge remote-tracking branch 'origin/2.3-gae'

Conflicts:
	src/main/java/freemarker/template/Template.java


Project: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/commit/8956c684
Tree: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/tree/8956c684
Diff: http://git-wip-us.apache.org/repos/asf/incubator-freemarker/diff/8956c684

Branch: refs/heads/master
Commit: 8956c684d057447d001fb24bfa956f2cff6d9c05
Parents: 3a35d4d 41b6f83
Author: ddekany <ddekany@apache.org>
Authored: Sat Dec 19 17:52:53 2015 +0100
Committer: ddekany <ddekany@apache.org>
Committed: Sat Dec 19 17:52:53 2015 +0100

----------------------------------------------------------------------
 ...ConditionalTemplateConfigurationFactory.java |  76 ++
 .../ConditionalTemplateConfigurerFactory.java   |  75 --
 .../FirstMatchTemplateConfigurationFactory.java | 118 +++
 .../FirstMatchTemplateConfigurerFactory.java    | 118 ---
 .../MergingTemplateConfigurationFactory.java    |  78 ++
 .../cache/MergingTemplateConfigurerFactory.java |  78 --
 .../java/freemarker/cache/TemplateCache.java    |  28 +-
 .../cache/TemplateConfigurationFactory.java     |  91 ++
 .../TemplateConfigurationFactoryException.java  |  36 +
 .../cache/TemplateConfigurerFactory.java        |  91 --
 .../TemplateConfigurerFactoryException.java     |  36 -
 src/main/java/freemarker/core/Configurable.java |  16 +-
 .../java/freemarker/core/CustomAttribute.java   |  12 +-
 src/main/java/freemarker/core/Items.java        |   2 +-
 src/main/java/freemarker/core/Sep.java          |   2 +-
 .../freemarker/core/TemplateConfiguration.java  | 578 +++++++++++++
 .../freemarker/core/TemplateConfigurer.java     | 580 -------------
 .../freemarker/core/UndefinedOutputFormat.java  |   6 +-
 .../core/_ObjectBuilderSettingEvaluator.java    |  14 +-
 .../ext/servlet/FreemarkerServlet.java          |   2 +-
 .../java/freemarker/template/Configuration.java | 102 +--
 src/main/java/freemarker/template/Template.java |  18 +-
 src/manual/book.xml                             | 199 ++---
 src/manual/docgen.cjson                         |   8 +-
 .../cache/TemplateConfigurationFactoryTest.java | 230 +++++
 .../cache/TemplateConfigurerFactoryTest.java    | 230 -----
 .../CustomAttributeInUnboundTemplatesTest.java  |   6 +-
 .../java/freemarker/core/DateFormatTest.java    |   6 +-
 .../java/freemarker/core/NumberFormatTest.java  |   6 +-
 .../java/freemarker/core/OutputFormatTest.java  |  42 +-
 .../core/TemplateConfigurationTest.java         | 846 +++++++++++++++++++
 ...plateConfigurationWithTemplateCacheTest.java | 325 +++++++
 .../freemarker/core/TemplateConfigurerTest.java | 846 -------------------
 ...TemplateConfigurerWithTemplateCacheTest.java | 325 -------
 .../ext/servlet/FreemarkerServletTest.java      |  20 +-
 .../manual/ConfigureOutputFormatExamples.java   |  32 +-
 .../manual/TemplateConfigurationExamples.java   | 186 ++++
 .../manual/TemplateConfigurerExamples.java      | 186 ----
 .../freemarker/template/ConfigurationTest.java  |  41 +-
 .../ConfigureOutputFormatExamples1.properties   |   6 +-
 .../ConfigureOutputFormatExamples2.properties   |  16 +-
 .../TemplateConfigurationExamples1.properties   |   8 +
 .../TemplateConfigurationExamples2.properties   |  15 +
 .../TemplateConfigurationExamples3.properties   |  30 +
 .../TemplateConfigurerExamples1.properties      |   8 -
 .../TemplateConfigurerExamples2.properties      |  15 -
 .../TemplateConfigurerExamples3.properties      |  30 -
 47 files changed, 2911 insertions(+), 2908 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8956c684/src/main/java/freemarker/cache/TemplateCache.java
----------------------------------------------------------------------
diff --cc src/main/java/freemarker/cache/TemplateCache.java
index 5cd258d,4f62d05..a357500
--- a/src/main/java/freemarker/cache/TemplateCache.java
+++ b/src/main/java/freemarker/cache/TemplateCache.java
@@@ -520,14 -520,14 +520,14 @@@ public class TemplateCache 
      }
  
      private Template loadTemplate(
 -            final TemplateLoader templateLoader, final Object source,
 +            final Object source,
              final String name, final String sourceName, Locale locale, final Object customLookupCondition,
              String initialEncoding, final boolean parseAsFTL) throws IOException {
-         final TemplateConfigurer tc;
+         final TemplateConfiguration tc;
          try {
-             tc = templateConfigurers != null ? templateConfigurers.get(sourceName, source)
: null;
-         } catch (TemplateConfigurerFactoryException e) {
-             throw newIOException("Error while getting TemplateConfigurer; see cause exception.",
e);
+             tc = templateConfigurations != null ? templateConfigurations.get(sourceName,
source) : null;
+         } catch (TemplateConfigurationFactoryException e) {
+             throw newIOException("Error while getting TemplateConfiguration; see cause exception.",
e);
          }
          if (tc != null) {
              // TC.{encoding,locale} is stronger than the cfg.getTemplate arguments by design.

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8956c684/src/main/java/freemarker/core/Configurable.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8956c684/src/main/java/freemarker/template/Configuration.java
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8956c684/src/main/java/freemarker/template/Template.java
----------------------------------------------------------------------
diff --cc src/main/java/freemarker/template/Template.java
index da55d06,f785768..91ee466
--- a/src/main/java/freemarker/template/Template.java
+++ b/src/main/java/freemarker/template/Template.java
@@@ -39,9 -48,10 +39,9 @@@ import freemarker.core.Macro
  import freemarker.core.OutputFormat;
  import freemarker.core.ParseException;
  import freemarker.core.ParserConfiguration;
- import freemarker.core.TemplateConfigurer;
+ import freemarker.core.TemplateConfiguration;
  import freemarker.core.TemplateElement;
 -import freemarker.core.TextBlock;
 -import freemarker.core.TokenMgrError;
 +import freemarker.core.UnboundTemplate;
  import freemarker.core._CoreAPI;
  import freemarker.debug.impl.DebuggerService;
  
@@@ -178,33 -199,33 +178,33 @@@ public class Template extends Configura
       * 
       * @since 2.3.22
       */
 -   @Deprecated
 -   public Template(
 -           String name, String sourceName, Reader reader, Configuration cfg, String encoding)
throws IOException {
 -       this(name, sourceName, reader, cfg, null, encoding);
 -   }
 -   
 +    @Deprecated
 +    public Template(
 +            String name, String sourceName, Reader reader, Configuration cfg, String encoding)
throws IOException {
 +        this(name, sourceName, reader, cfg, null, encoding);
 +    }
 +
      /**
       * Same as {@link #Template(String, String, Reader, Configuration, String)}, but also
specifies a
-      * {@link TemplateConfigurer}. This is mostly meant to be used by FreeMarker internally,
but advanced users might
+      * {@link TemplateConfiguration}. This is mostly meant to be used by FreeMarker internally,
but advanced users might
       * still find this useful.
       * 
 -     * @param customParserConfiguration
 +     * @param customParserCfg
       *            Overrides the parsing related configuration settings of the {@link Configuration}
parameter; can be
       *            {@code null}. This is useful as the {@link Configuration} is normally
a singleton shared by all
 -     *            templates, and so it's not good for specifying template-specific settings.
(While {@link Template}
 -     *            itself has methods to specify settings just for that template, those don't
influence the parsing, and
 -     *            you only have opportunity to call them after the parsing anyway.) This
objects is often a
 -     *            {@link TemplateConfiguration} whose parent is the {@link Configuration}
parameter, and then it
 +     *            templates, and so it's not good for specifying template-specific settings.
(While
 +     *            {@link Template} itself has methods to specify settings just for that
template, those don't influence
 +     *            the parsing, and you only have opportunity to call them after the parsing
anyway.) This objects is
-      *            often a {@link TemplateConfigurer} whose parent is the {@link Configuration}
parameter, and then it
++     *            often a {@link TemplateConfiguration} whose parent is the {@link Configuration}
parameter, and then it
       *            practically just overrides some of the parser settings, as the others
are inherited from the
-      *            {@link Configuration}. Note that if this is a {@link TemplateConfigurer},
you will also want to call
-      *            {@link TemplateConfigurer#configure(Template)} on the resulting {@link
Template} so that
 -     *            {@link Configuration}. Note that if this is a {@link TemplateConfiguration},
you will also want to
 -     *            call {@link TemplateConfiguration#apply(Template)} on the resulting {@link
Template} so that
++     *            {@link Configuration}. Note that if this is a {@link TemplateConfiguration},
you will also want to call
++     *            {@link TemplateConfiguration#apply(Template)} on the resulting {@link
Template} so that
       *            {@link Configurable} settings will be set too, because this constructor
only uses it as a
 -     *            {@link ParserConfiguration}.
 +     *            {@link ParserConfiguration}.  
       * @param encoding
       *            Same as in {@link #Template(String, String, Reader, Configuration, String)}.
When it's non-{@code
-      *            null}, it overrides the value coming from the {@code TemplateConfigurer#getEncoding()}
method of the
 -     *            null}, it overrides the value coming from the {@link TemplateConfiguration#getEncoding()}
method of
 -     *            the {@code templateConfiguration} parameter.
++     *            null}, it overrides the value coming from the {@code TemplateConfiguration#getEncoding()}
method of the
 +     *            {@code templateConfigurer} parameter.
       * 
       * @since 2.3.24
       */

http://git-wip-us.apache.org/repos/asf/incubator-freemarker/blob/8956c684/src/test/java/freemarker/core/CustomAttributeInUnboundTemplatesTest.java
----------------------------------------------------------------------
diff --cc src/test/java/freemarker/core/CustomAttributeInUnboundTemplatesTest.java
index 4cc3ed1,0000000..4452dcd
mode 100644,000000..100644
--- a/src/test/java/freemarker/core/CustomAttributeInUnboundTemplatesTest.java
+++ b/src/test/java/freemarker/core/CustomAttributeInUnboundTemplatesTest.java
@@@ -1,62 -1,0 +1,62 @@@
 +/*
 + * Licensed to the Apache Software Foundation (ASF) under one
 + * or more contributor license agreements.  See the NOTICE file
 + * distributed with this work for additional information
 + * regarding copyright ownership.  The ASF licenses this file
 + * to you under the Apache License, Version 2.0 (the
 + * "License"); you may not use this file except in compliance
 + * with the License.  You may obtain a copy of the License at
 + * 
 + *   http://www.apache.org/licenses/LICENSE-2.0
 + * 
 + * Unless required by applicable law or agreed to in writing,
 + * software distributed under the License is distributed on an
 + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 + * KIND, either express or implied.  See the License for the
 + * specific language governing permissions and limitations
 + * under the License.
 + */
 +package freemarker.core;
 +
 +import static org.junit.Assert.*;
 +
 +import java.io.IOException;
 +import java.io.StringReader;
 +
 +import org.junit.Test;
 +
 +import com.google.common.collect.ImmutableMap;
 +
 +import freemarker.template.Configuration;
 +import freemarker.template.Template;
 +
 +@SuppressWarnings("boxing")
 +public class CustomAttributeInUnboundTemplatesTest {
 +
 +    @Test
 +    public void inFtlHeaderTest() throws IOException {
 +        Template t = new Template(null, "<#ftl attributes={'a': 1?int}>", new Configuration(Configuration.VERSION_2_3_23));
 +        t.setCustomAttribute("b", 2);
 +        assertEquals(1, t.getCustomAttribute("a"));
 +        assertEquals(2, t.getCustomAttribute("b"));
 +        assertEquals(ImmutableMap.of("a", 1), t.getUnboundTemplate().getCustomAttributes());
 +    }
 +    
 +    @Test
-     public void inTemplateConfigurerTest() throws IOException {
++    public void inTemplateConfigurationTest() throws IOException {
 +        Configuration cfg = new Configuration(Configuration.VERSION_2_3_23);
 +        
-         TemplateConfigurer tc = new TemplateConfigurer();
++        TemplateConfiguration tc = new TemplateConfiguration();
 +        tc.setCustomAttribute("a", 1);
 +        tc.setParentConfiguration(cfg);
 +        
 +        Template t = new Template(null, null, new StringReader(""), cfg, tc, null);
 +        t.setCustomAttribute("b", 2);
 +        assertNull(t.getCustomAttribute("a"));
-         tc.configure(t);
++        tc.apply(t);
 +        assertEquals(1, t.getCustomAttribute("a"));
 +        assertEquals(2, t.getCustomAttribute("b"));
 +        assertNull(t.getUnboundTemplate().getCustomAttributes());
 +    }
 +
 +}


Mime
View raw message