You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by bu...@apache.org on 2016/04/15 17:19:47 UTC

svn commit: r985737 - in /websites/staging/sling/trunk/content: ./ documentation/bundles/scripting/scripting-sightly.html

Author: buildbot
Date: Fri Apr 15 15:19:46 2016
New Revision: 985737

Log:
Staging update by buildbot for sling

Added:
    websites/staging/sling/trunk/content/documentation/bundles/scripting/scripting-sightly.html
Modified:
    websites/staging/sling/trunk/content/   (props changed)

Propchange: websites/staging/sling/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Fri Apr 15 15:19:46 2016
@@ -1 +1 @@
-1738907
+1739317

Added: websites/staging/sling/trunk/content/documentation/bundles/scripting/scripting-sightly.html
==============================================================================
--- websites/staging/sling/trunk/content/documentation/bundles/scripting/scripting-sightly.html (added)
+++ websites/staging/sling/trunk/content/documentation/bundles/scripting/scripting-sightly.html Fri Apr 15 15:19:46 2016
@@ -0,0 +1,236 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!--
+
+    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.
+-->
+  <head>
+    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+    <title>Apache Sling - Sightly Scripting Engine</title>
+    <link rel="icon" href="/res/favicon.ico">
+    <link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
+    <link rel="stylesheet" href="/res/codehilite.css" type="text/css" media="all">
+  </head>
+  <body>
+    <div class="title">
+      <div class="logo">
+        <a href="//sling.apache.org/">
+          <img border="0" alt="Apache Sling" src="/res/logo.png">
+        </a>
+      </div>
+      <div class="header">
+        <a href="//www.apache.org/">
+          <img border="0" alt="Apache" src="/res/apache.png">
+        </a>
+      </div>
+    </div>
+    
+    <div class="menu"> 
+      <style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
+<p><strong><a href="/documentation.html">Documentation</a></strong> <br />
+<a href="/documentation/getting-started.html">Getting Started</a> <br />
+<a href="/documentation/the-sling-engine.html">The Sling Engine</a> <br />
+<a href="/documentation/development.html">Development</a> <br />
+<a href="/documentation/bundles.html">Bundles</a> <br />
+<a href="/documentation/tutorials-how-tos.html">Tutorials &amp; How-Tos</a> <br />
+<a href="/documentation/configuration.html">Configuration</a>   </p>
+<p><a href="http://s.apache.org/sling.wiki">Wiki</a> <br />
+<a href="http://s.apache.org/sling.faq">FAQ</a>   </p>
+<p><strong>API Docs</strong>  <br />
+<a href="/apidocs/sling8/index.html">Sling 8</a> <br />
+<a href="/apidocs/sling7/index.html">Sling 7</a> <br />
+<a href="/apidocs/sling6/index.html">Sling 6</a> <br />
+<a href="/apidocs/sling5/index.html">Sling 5</a> <br />
+<a href="/javadoc-io.html">Archive at javadoc.io</a>   </p>
+<p><strong>Project info</strong> <br />
+<a href="/downloads.cgi">Downloads</a> <br />
+<a href="http://www.apache.org/licenses/">License</a> <br />
+<a href="/contributing.html">Contributing</a> <br />
+<a href="/news.html">News</a> <br />
+<a href="/links.html">Links</a> <br />
+<a href="/project-information.html">Project Information</a> <br />
+<a href="https://issues.apache.org/jira/browse/SLING">Issue Tracker</a> <br />
+<a href="http://ci.apache.org/builders/sling-trunk">Build Server</a> <br />
+<a href="/project-information/security.html">Security</a>   </p>
+<p><strong>Source</strong> <br />
+<a href="http://svn.apache.org/viewvc/sling/trunk">Subversion</a> <br />
+<a href="git://git.apache.org/sling.git">Git</a> <br />
+<a href="https://github.com/apache/sling">Github Mirror</a>   </p>
+<p><strong>Sponsorship</strong> <br />
+<a href="http://www.apache.org/foundation/thanks.html">Thanks</a> <br />
+<a href="http://www.apache.org/foundation/sponsorship.html">Become a Sponsor</a> <br />
+<a href="http://www.apache.org/foundation/buy_stuff.html">Buy Stuff</a>   </p>
+<p><strong><a href="/sitemap.html">Site Map</a></strong></p>
+<!-- no valid ads for now, we'll  reactivate this when needed
+<iframe 
+    src="http://www.apache.org/ads/button.html"
+    style="border-width:0; float: left" frameborder="0" 
+    scrolling="no"
+    width="135" 
+    height="135">
+</iframe>
+-->
+    </div>
+    
+    <div class="main">
+      <div class="breadcrump" style="font-size: 80%;">
+        <a href="/">Home</a>&nbsp;&raquo&nbsp;<a href="/documentation.html">Documentation</a>&nbsp;&raquo&nbsp;<a href="/documentation/bundles.html">Bundles</a>&nbsp;&raquo&nbsp;<a href="/documentation/bundles/scripting.html">Sling Scripting</a>
+      </div>
+
+      
+      
+      <h1>Sightly Scripting Engine</h1>
+      <style type="text/css">
+/* The following code is added by mdx_elementid.py
+   It was originally lifted from http://subversion.apache.org/style/site.css */
+/*
+ * Hide class="elementid-permalink", except when an enclosing heading
+ * has the :hover property.
+ */
+.headerlink, .elementid-permalink {
+  visibility: hidden;
+}
+h2:hover > .headerlink, h3:hover > .headerlink, h1:hover > .headerlink, h6:hover > .headerlink, h4:hover > .headerlink, h5:hover > .headerlink, dt:hover > .elementid-permalink { visibility: visible }</style>
+<p>The Apache Sling Sightly Scripting Engine is the Java reference implementation of the <a href="https://github.com/Adobe-Marketing-Cloud/sightly-spec">Sightly HTML Templating Language</a>, passing all the tests defined by the <a href="https://github.com/Adobe-Marketing-Cloud/sightly-tck">Sightly Technology Compatibility Kit</a>.</p>
+<div class="toc">
+<ul>
+<li><a href="#modules">Modules</a></li>
+<li><a href="#the-use-api">The Use-API</a><ul>
+<li><a href="#sling-specific-use-api-extensions">Sling-specific Use-API Extensions</a></li>
+</ul>
+</li>
+</ul>
+</div>
+<h1 id="modules">Modules<a class="headerlink" href="#modules" title="Permanent link">&para;</a></h1>
+<p>The Sling implementation is comprised of the following modules:</p>
+<ol>
+<li><a href="https://github.com/apache/sling/tree/trunk/bundles/scripting/sightly/engine"><code>org.apache.sling.scripting.sightly</code></a> - the core Sightly Scripting Engine bundle</li>
+<li><a href="https://github.com/apache/sling/tree/trunk/bundles/scripting/sightly/js-use-provider"><code>org.apache.sling.scripting.sightly.js.provider</code></a> - the Sightly JavaScript Use Provider, implementing support for the <code>use</code> JavaScript function</li>
+<li><a href="https://github.com/apache/sling/tree/trunk/bundles/scripting/sightly/models-use-provider"><code>org.apache.sling.scripting.sightly.models.provider</code></a> - <a href="https://sling.apache.org/documentation/bundles/models.html">Sling Models</a> Use Provider</li>
+<li><a href="https://github.com/apache/sling/tree/trunk/bundles/scripting/sightly/repl"><code>org.apache.sling.scripting.sightly.repl</code></a> - Sightly Read-Eval-Print Loop Environment (REPL)</li>
+</ol>
+<h1 id="the-use-api">The Use-API<a class="headerlink" href="#the-use-api" title="Permanent link">&para;</a></h1>
+<p>The <a href="https://github.com/Adobe-Marketing-Cloud/sightly-spec/blob/1.2/SPECIFICATION.md#4-use-api">Sightly HTML Templating Language Specification</a> explicitly defines two ways of implementing support for business logic objects:</p>
+<ol>
+<li>
+<p>Java Use-API, through POJOs, that may optionally implement an <code>init</code> method:</p>
+<div class="codehilite"><pre><span class="cm">/**</span>
+<span class="cm"> * Initialises the Use bean.</span>
+<span class="cm"> *</span>
+<span class="cm"> * @param bindings All bindings available to the Sightly scripts.</span>
+<span class="cm"> **/</span> 
+<span class="n">public</span> <span class="k">void</span> <span class="n">init</span><span class="p">(</span><span class="n">javax</span><span class="p">.</span><span class="n">script</span><span class="p">.</span><span class="n">Bindings</span> <span class="n">bindings</span><span class="p">);</span>
+</pre></div>
+
+
+</li>
+<li>
+<p>JavaScript Use-API, by using a standardised use function</p>
+<div class="codehilite"><pre><span class="cm">/**</span>
+<span class="cm"> * In the following example &#39;/libs/dep1.js&#39; and &#39;dep2.js&#39; are optional</span>
+<span class="cm"> * dependencies needed for this script&#39;s execution. Dependencies can</span>
+<span class="cm"> * be specified using an absolute path or a relative path to this</span>
+<span class="cm"> * script&#39;s own path.</span>
+<span class="cm"> *</span>
+<span class="cm"> * If no dependencies are needed the dependencies array can be omitted.</span>
+<span class="cm"> */</span>
+<span class="k">use</span><span class="p">([&#39;</span><span class="n">dep1</span><span class="p">.</span><span class="n">js</span><span class="p">&#39;,</span> <span class="p">&#39;</span><span class="n">dep2</span><span class="p">.</span><span class="n">js</span><span class="p">&#39;],</span> <span class="k">function</span> <span class="p">(</span><span class="n">Dep1</span><span class="p">,</span> <span class="n">Dep2</span><span class="p">)</span> <span class="p">{</span>
+    <span class="c1">// implement processing</span>
+
+    <span class="c1">// define this Use object&#39;s behaviour</span>
+    <span class="k">return</span> <span class="p">{</span>
+        <span class="nl">propertyName:</span> <span class="n">propertyValue</span>
+        <span class="nl">functionName:</span> <span class="k">function</span> <span class="p">()</span> <span class="p">{}</span>
+    <span class="p">}</span>
+<span class="p">});</span>
+</pre></div>
+
+
+</li>
+</ol>
+<p>The Sightly implementation from Sling provides the basic POJO support through the <a href="https://github.com/apache/sling/blob/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/pojo/Use.java"><code>org.apache.sling.scripting.sightly.pojo.Use</code></a> interface and the <a href="https://github.com/apache/sling/blob/trunk/bundles/scripting/sightly/engine/src/main/java/org/apache/sling/scripting/sightly/impl/engine/extension/use/JavaUseProvider.java"><code>org.apache.sling.scripting.sightly.impl.engine.extension.use.JavaUseProvider</code></a>, whereas the <code>use</code> function is implemented by the <code>org.apache.sling.scripting.sightly.js.provider</code> bundle.</p>
+<p>However, the Sling implementation provides a few extensions to the Use-API.</p>
+<h2 id="sling-specific-use-api-extensions">Sling-specific Use-API Extensions<a class="headerlink" href="#sling-specific-use-api-extensions" title="Permanent link">&para;</a></h2>
+<p>A full Sightly installation provides the following Use Providers, in the order of their priority:</p>
+<table class="table">
+<thead>
+<tr>
+<th>Use Provider</th>
+<th>Bundle</th>
+<th>Service Ranking</th>
+<th>Functionality</th>
+<th>Observations</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td><code>org.apache.sling.scripting.sightly.impl.engine.extension.use.RenderUnitProvider</code></td>
+<td><code>org.apache.sling.scripting.sightly</code></td>
+<td>100</td>
+<td>support for loading Sightly templates through <code>data-sly-use</code></td>
+<td></td>
+</tr>
+<tr>
+<td><code>org.apache.sling.scripting.sightly.models.impl.SlingModelsUseProvider</code></td>
+<td><code>org.apache.sling.scripting.sightly.models.provider</code></td>
+<td>95</td>
+<td>support for loading Sling Models</td>
+<td></td>
+</tr>
+<tr>
+<td><code>org.apache.sling.scripting.sightly.impl.engine.extension.use.JavaUseProvider</code></td>
+<td><code>org.apache.sling.scripting.sightly</code></td>
+<td>90</td>
+<td>support for loading Java objects such as: <ol><li>OSGi services</li><li>POJOs adaptable from <code>SlingHttpServletRequest</code> or <code>Resource</code></li><li>POJOs that implement <code>Use</code></li></ol></td>
+<td></td>
+</tr>
+<tr>
+<td><code>org.apache.sling.scripting.sightly.js.impl.JsUseProvider</code></td>
+<td><code>org.apache.sling.scripting.sightly.js.provider</code></td>
+<td>80</td>
+<td>support for loading objects defined in JavaScript</td>
+<td></td>
+</tr>
+<tr>
+<td><code>org.apache.sling.scripting.sightly.impl.engine.extension.use.ScriptUseProvider</code></td>
+<td><code>org.apache.sling.scripting.sightly</code></td>
+<td>0</td>
+<td>support for loading objects returned by scripts interpreted by other Script Engines available on the platform</td>
+<td></td>
+</tr>
+</tbody>
+</table>
+      <div class="timestamp" style="margin-top: 30px; font-size: 80%; text-align: right;">
+        Rev. 1739317 by radu on Fri, 15 Apr 2016 15:19:01 +0000
+      </div>
+      <div class="trademarkFooter"> 
+        Apache Sling, Sling, Apache, the Apache feather logo, and the Apache Sling project
+        logo are trademarks of The Apache Software Foundation. All other marks mentioned
+        may be trademarks or registered trademarks of their respective owners.
+      </div>
+    </div>
+  </body>
+</html>