changeset 8143:7021753b3797

Datacage: Insert variable values literally into output.
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 26 Aug 2014 17:21:16 +0200
parents 37cdfad302cb
children 8eeb4b717dca
files artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/Builder.java
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/Builder.java	Tue Aug 26 12:09:18 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/Builder.java	Tue Aug 26 17:21:16 2014 +0200
@@ -1172,7 +1172,10 @@
                 result[0] = null;
                 if (frames.getStore(key, result)) {
                     m.appendReplacement(
-                        sb, result[0] != null ? result[0].toString() : "");
+                        sb,
+                        result[0] != null 
+                            ? Matcher.quoteReplacement(result[0].toString())
+                            : "");
                 }
                 else {
                     m.appendReplacement(sb, "\\${" + key + "}");
@@ -1189,7 +1192,9 @@
                 String expr = m.group(1);
                 Object result = evaluateXPath(expr, XPathConstants.STRING);
                 if (result instanceof String) {
-                    m.appendReplacement(sb, (String)result);
+                    m.appendReplacement(
+                        sb,
+                        Matcher.quoteReplacement((String)result));
                 }
                 else {
                     m.appendReplacement(sb, "");

http://dive4elements.wald.intevation.org