SLING-6476 - [HTL] data-sly-resource transforms resources with dots in their paths to SyntheticResources

* check if the resource identified by the path exists so that we don’t run path analysis which on it, which might
transform it into a SyntheticResource

git-svn-id: https://svn.apache.org/repos/asf/sling/trunk@1779585 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/renderer/renderer.html b/src/main/resources/SLING-INF/apps/sightly/scripts/renderer/renderer.html
new file mode 100644
index 0000000..6981f7d
--- /dev/null
+++ b/src/main/resources/SLING-INF/apps/sightly/scripts/renderer/renderer.html
@@ -0,0 +1,21 @@
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
+<div data-sly-use.renderer="renderer.js" id="${renderer.id}">
+    <span class="name">${renderer.name}</span>
+    <span class="path">${renderer.path}</span>
+    <span class="synthetic">${renderer.synthetic}</span>
+</div>
diff --git a/src/main/resources/SLING-INF/apps/sightly/scripts/renderer/renderer.js b/src/main/resources/SLING-INF/apps/sightly/scripts/renderer/renderer.js
new file mode 100644
index 0000000..99efbc3
--- /dev/null
+++ b/src/main/resources/SLING-INF/apps/sightly/scripts/renderer/renderer.js
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ ******************************************************************************/
+/* globals use, Packages, resource */
+use(function() {
+    var path = resource.path;
+    return {
+        "synthetic": Packages.org.apache.sling.api.resource.ResourceUtil.isSyntheticResource(resource),
+        "name": resource.name,
+        "path": path,
+        "id": path.split('/').join('_').split('.').join('_')
+    }
+});
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 48910ec..23f5a82 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
@@ -1,4 +1,4 @@
-<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+<!--/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   ~ Licensed to the Apache Software Foundation (ASF) under one
   ~ or more contributor license agreements.  See the NOTICE file
   ~ distributed with this work for additional information
@@ -15,7 +15,7 @@
   ~ KIND, either express or implied.  See the License for the
   ~ specific language governing permissions and limitations
   ~ under the License.
-  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
+  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/-->
 <!DOCTYPE html>
 <html>
 <head>
@@ -29,5 +29,8 @@
 <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>
+<sly data-sly-resource="${'/sightly/resource.with.dots.in.path' @ resourceType='sightly/scripts/renderer'}"/>
+<sly data-sly-resource="${'/sightly/nonexistingresource' @ resourceType='sightly/scripts/renderer'}"/>
+<sly data-sly-resource="${@ resourceType='sightly/scripts/renderer'}"/>
 </body>
 </html>
diff --git a/src/main/resources/SLING-INF/sightly.json b/src/main/resources/SLING-INF/sightly.json
index dc5441e..6588dcd 100644
--- a/src/main/resources/SLING-INF/sightly.json
+++ b/src/main/resources/SLING-INF/sightly.json
@@ -64,5 +64,8 @@
     "whitespace": {
         "jcr:primaryType": "nt:unstructured",
         "sling:resourceType": "/apps/sightly/scripts/whitespace"
+    },
+    "resource.with.dots.in.path": {
+        "jcr:primaryType": "nt:unstructured"
     }
 }