You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ra...@apache.org on 2018/06/15 13:00:46 UTC
[sling-org-apache-sling-scripting-sightly-compiler] branch
issue/SLING-7681 updated: SLING-7740 - [HTL] Extend the list of attributes
for which the 'uri' context is automatically applied
This is an automated email from the ASF dual-hosted git repository.
radu pushed a commit to branch issue/SLING-7681
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-compiler.git
The following commit(s) were added to refs/heads/issue/SLING-7681 by this push:
new cded4ad SLING-7740 - [HTL] Extend the list of attributes for which the 'uri' context is automatically applied
cded4ad is described below
commit cded4ad2a0f844a45adf83da7e7024ac89bc4011
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Fri Jun 15 15:00:20 2018 +0200
SLING-7740 - [HTL] Extend the list of attributes for which the 'uri' context is automatically applied
---
.../sling/scripting/sightly/impl/html/dom/MarkupHandler.java | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/main/java/org/apache/sling/scripting/sightly/impl/html/dom/MarkupHandler.java b/src/main/java/org/apache/sling/scripting/sightly/impl/html/dom/MarkupHandler.java
index 0e41724..38b1289 100644
--- a/src/main/java/org/apache/sling/scripting/sightly/impl/html/dom/MarkupHandler.java
+++ b/src/main/java/org/apache/sling/scripting/sightly/impl/html/dom/MarkupHandler.java
@@ -19,8 +19,12 @@
package org.apache.sling.scripting.sightly.impl.html.dom;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.Stack;
import org.apache.commons.lang3.StringUtils;
@@ -69,6 +73,8 @@ public class MarkupHandler {
private final ExpressionWrapper expressionWrapper;
private final Stack<ElementContext> elementStack = new Stack<>();
+ private static final Set<String> URI_ATTRIBUTES = Collections.unmodifiableSet(new HashSet<>(Arrays.asList("action", "cite",
+ "data", "formaction", "href", "manifest", "poster", "src")));
public MarkupHandler(PushStream stream, Map<String, Plugin> pluginRegistry, List<Filter> filters) {
this.stream = stream;
@@ -449,9 +455,9 @@ public class MarkupHandler {
}
private MarkupContext getAttributeMarkupContext(String attributeName) {
- if ("src".equalsIgnoreCase(attributeName) || "href".equalsIgnoreCase(attributeName)) {
- return MarkupContext.URI;
- }
+ if (URI_ATTRIBUTES.contains(attributeName.toLowerCase())) {
+ return MarkupContext.URI;
+ }
return MarkupContext.ATTRIBUTE;
}
--
To stop receiving notification emails like this one, please contact
radu@apache.org.