aboutsummaryrefslogtreecommitdiff
path: root/velocity-engine-core/src/main/java
diff options
context:
space:
mode:
authorClaude Brisson <cbrisson@apache.org>2018-10-08 19:11:47 +0000
committerClaude Brisson <cbrisson@apache.org>2018-10-08 19:11:47 +0000
commitd0ddf90d8af47534d82d7f5b20535e939cdebad0 (patch)
tree3b42b61564f9bf8015c4220588786fd71eb416c6 /velocity-engine-core/src/main/java
parent10545ce849f566961d21de2ed6b51c6a7854a0f6 (diff)
downloadapache-velocity-engine-d0ddf90d8af47534d82d7f5b20535e939cdebad0.tar.gz
[VELOCITY-542] Added a new 'parser.allows.dash.in.identifiers' boolean property (false per default) to (dis)allow '-' in reference identifiers
git-svn-id: https://svn.apache.org/repos/asf/velocity/engine/trunk@1843186 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'velocity-engine-core/src/main/java')
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java5
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java17
-rw-r--r--velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java6
3 files changed, 28 insertions, 0 deletions
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
index b85c51f1..b042d7ab 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeConstants.java
@@ -288,6 +288,11 @@ public interface RuntimeConstants
String PARSER_POOL_SIZE = "parser.pool.size";
/**
+ * Allow dash in identifiers (backward compatibility option)
+ */
+ String PARSER_DASH_ALLOWED = "parser.allows.dash.in.identifiers";
+
+ /**
* Space gobbling mode
*/
String SPACE_GOBBLING = "space.gobbling";
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
index 82cfddde..6b79a827 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeInstance.java
@@ -199,6 +199,11 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
private SpaceGobbling spaceGobbling;
/**
+ * Whether dash is allowed in identifiers
+ */
+ private boolean dashAllowedInIdentifiers;
+
+ /**
* Creates a new RuntimeInstance object.
*/
public RuntimeInstance()
@@ -352,6 +357,9 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
{
spaceGobbling = SpaceGobbling.LINES;
}
+
+ /* init parser behavior */
+ dashAllowedInIdentifiers = getBoolean(PARSER_DASH_ALLOWED, false);
}
/**
@@ -1838,4 +1846,13 @@ public class RuntimeInstance implements RuntimeConstants, RuntimeServices
{
return spaceGobbling;
}
+
+ /**
+ * get whether dashes are allowed in identifiers
+ * @return configured boolean flag
+ */
+ public boolean isDashAllowedInIdentifiers()
+ {
+ return dashAllowedInIdentifiers;
+ }
}
diff --git a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
index 42606022..eadf03a0 100644
--- a/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
+++ b/velocity-engine-core/src/main/java/org/apache/velocity/runtime/RuntimeServices.java
@@ -467,4 +467,10 @@ public interface RuntimeServices
* @return space gobbling mode
*/
SpaceGobbling getSpaceGobbling();
+
+ /**
+ * get whether dashes are allowed in identifiers
+ * @return configured boolean flag
+ */
+ boolean isDashAllowedInIdentifiers();
}