comparison artifacts/src/main/java/org/dive4elements/river/artifacts/datacage/templating/Builder.java @ 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 fbab10c21e0b
children 7bc675e4e6e0
comparison
equal deleted inserted replaced
8141:37cdfad302cb 8143:7021753b3797
1170 while (m.find()) { 1170 while (m.find()) {
1171 String key = m.group(1); 1171 String key = m.group(1);
1172 result[0] = null; 1172 result[0] = null;
1173 if (frames.getStore(key, result)) { 1173 if (frames.getStore(key, result)) {
1174 m.appendReplacement( 1174 m.appendReplacement(
1175 sb, result[0] != null ? result[0].toString() : ""); 1175 sb,
1176 result[0] != null
1177 ? Matcher.quoteReplacement(result[0].toString())
1178 : "");
1176 } 1179 }
1177 else { 1180 else {
1178 m.appendReplacement(sb, "\\${" + key + "}"); 1181 m.appendReplacement(sb, "\\${" + key + "}");
1179 } 1182 }
1180 } 1183 }
1187 Matcher m = BRACKET_XPATH.matcher(value); 1190 Matcher m = BRACKET_XPATH.matcher(value);
1188 while (m.find()) { 1191 while (m.find()) {
1189 String expr = m.group(1); 1192 String expr = m.group(1);
1190 Object result = evaluateXPath(expr, XPathConstants.STRING); 1193 Object result = evaluateXPath(expr, XPathConstants.STRING);
1191 if (result instanceof String) { 1194 if (result instanceof String) {
1192 m.appendReplacement(sb, (String)result); 1195 m.appendReplacement(
1196 sb,
1197 Matcher.quoteReplacement((String)result));
1193 } 1198 }
1194 else { 1199 else {
1195 m.appendReplacement(sb, ""); 1200 m.appendReplacement(sb, "");
1196 } 1201 }
1197 } 1202 }

http://dive4elements.wald.intevation.org