You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 10:12:21 UTC

[sling-org-apache-sling-scripting-sightly-testing-content] 02/04: SLING-4546 - Sightly: Improper handling of extension and selectors by data-sly-resource

This is an automated email from the ASF dual-hosted git repository.

rombert pushed a commit to annotated tag org.apache.sling.scripting.sightly.testing-content-1.0.2
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-scripting-sightly-testing-content.git

commit 80fe7a20b7edf1c586a71f17b99fd1b840f358ca
Author: Radu Cotescu <ra...@apache.org>
AuthorDate: Thu Apr 2 08:59:23 2015 +0000

    SLING-4546 - Sightly: Improper handling of extension and selectors by data-sly-resource
    
    * Improved selector extraction for resource path (taking extensions into consideration)
    * Added selectors from path or parent to dispatcher options so they will no longer be ignored
    * Updated testing content and integration tests
    (applied patch from Vlad Băilescu; closes #77)
    
    
    git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/scripting/sightly/testing-content@1670852 13f79535-47bb-0310-9956-ffa450edef68
---
 .../SLING-INF/apps/sightly/scripts/resource/resource.html |  6 ++++--
 .../scripts/{resource/resource.html => text/text.html}    | 15 ++-------------
 src/main/resources/SLING-INF/sightly.json                 |  4 ++++
 3 files changed, 10 insertions(+), 15 deletions(-)

diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/resource/resource.html b/src/main/resources/SLING-INF/apps/sightly/scripts/resource/resource.html
index 2f98a00..40c5224 100644
--- a/src/main/resources/SLING-INF/apps/sightly/scripts/resource/resource.html
+++ b/src/main/resources/SLING-INF/apps/sightly/scripts/resource/resource.html
@@ -23,9 +23,11 @@
 </head>
 <body>
 <div id="selectors" data-sly-resource="${'/sightly/includedresource' @ selectors=['a', 'b']}"></div>
-<div id="selectors-remove-c" data-sly-resource="${'/sightly/includedresource.a.b.c' @ selectors=['a', 'b']}"></div>
-<div id="removeselectors-remove-b" data-sly-resource="${'/sightly/includedresource.a.b.c' @ removeSelectors=['b']}"></div>
+<div id="selectors-remove-c" data-sly-resource="${'/sightly/includedresource.a.b.c.html' @ selectors=['a', 'b']}"></div>
+<div id="removeselectors-remove-b" data-sly-resource="${'/sightly/includedresource.a.b.c.html' @ removeSelectors=['b']}"></div>
 <div id="addselectors" data-sly-resource="${'/sightly/includedresource' @ addSelectors=['a', 'b', 'c']}"></div>
 <div id="dot-include" data-sly-resource="${ '.' @ selectors='dot'}"></div>
+<div id="extension-selectors" data-sly-resource="${'/sightly/text.a.b.txt'}"></div>
+<div id="extension-replaceselectors" data-sly-resource="${'/sightly/text.a.b.txt' @ selectors=['c']}"></div>
 </body>
 </html>
\ No newline at end of file
diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/resource/resource.html b/src/main/resources/SLING-INF/apps/sightly/scripts/text/text.html
similarity index 59%
copy from src/main/resources/SLING-INF/apps/sightly/scripts/resource/resource.html
copy to src/main/resources/SLING-INF/apps/sightly/scripts/text/text.html
index 2f98a00..023dd40 100644
--- a/src/main/resources/SLING-INF/apps/sightly/scripts/resource/resource.html
+++ b/src/main/resources/SLING-INF/apps/sightly/scripts/text/text.html
@@ -16,16 +16,5 @@
   ~ specific language governing permissions and limitations
   ~ under the License.
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
-<!DOCTYPE html>
-<html>
-<head>
-    <title>Sightly data-sly-resource - Sling implementation</title>
-</head>
-<body>
-<div id="selectors" data-sly-resource="${'/sightly/includedresource' @ selectors=['a', 'b']}"></div>
-<div id="selectors-remove-c" data-sly-resource="${'/sightly/includedresource.a.b.c' @ selectors=['a', 'b']}"></div>
-<div id="removeselectors-remove-b" data-sly-resource="${'/sightly/includedresource.a.b.c' @ removeSelectors=['b']}"></div>
-<div id="addselectors" data-sly-resource="${'/sightly/includedresource' @ addSelectors=['a', 'b', 'c']}"></div>
-<div id="dot-include" data-sly-resource="${ '.' @ selectors='dot'}"></div>
-</body>
-</html>
\ No newline at end of file
+<span class="path">path: ${resource.path}</span><br>
+<span class="selectors">selectors: ${request.requestPathInfo.selectorString}</span>
\ No newline at end of file
diff --git a/src/main/resources/SLING-INF/sightly.json b/src/main/resources/SLING-INF/sightly.json
index 29f9f86..6762796 100644
--- a/src/main/resources/SLING-INF/sightly.json
+++ b/src/main/resources/SLING-INF/sightly.json
@@ -16,5 +16,9 @@
     "template": {
       "jcr:primaryType": "nt:unstructured",
       "sling:resourceType": "/apps/sightly/scripts/template"
+    },
+    "text.txt": {
+      "jcr:primaryType": "nt:unstructured",
+      "sling:resourceType": "/apps/sightly/scripts/text"
     }
 }

-- 
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.