You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (JIRA)" <ji...@apache.org> on 2007/11/29 10:57:43 UTC

[jira] Created: (SLING-114) ECT - Ecmascript Client Templates

ECT - Ecmascript Client Templates
---------------------------------

                 Key: SLING-114
                 URL: https://issues.apache.org/jira/browse/SLING-114
             Project: Sling
          Issue Type: Improvement
          Components: microsling
            Reporter: Bertrand Delacretaz


To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.

A template such as

  <p class="<%= item.color %>"><%= item.text %></p>

Will be processed server-side to generate javascript client code such as

  document.write("<p class=");
  document.write(item.color);
  document.write("\">");
  document.write(item.text);
  document.write("</p>\n");

which executes on the client to render the content.

Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Nov 29, 2007 2:45 PM, Michael Marth <mm...@day.com> wrote:

> ...2. Having the same templating language on client and server is nice, but
> maybe different delimiters would be a good idea. If the same ones are used
> we cannot combine server-side and client-side parts in one script....

> ...btw: reminded me of the TrimPath stuff now at
> http://code.google.com/p/trimpath/wiki/JavaScriptTemplates...

That library might be the best choice for people who want to combine
client-side with server-side templating: use microsling-provided stuff
server-side, and use JavaScriptTemplates (or any other library)
client-side.

In this way we don't have to reimplement that, and people are free to combine.

The aim of SLING-114 (just committed a first version, revision 600516)
is a bit different, as it provides in one HTTP request  a default HTML
rendering (for search engines), a javascript variable intialized via
our JSON rendering, and a conversion of the ECT template into
client-side rendering code. This is experimental, feedback is welcome
of course.

-Bertrand

Re: [jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by Bertrand Delacretaz <bd...@apache.org>.
On Nov 29, 2007 5:32 PM, Michael Marth <mm...@day.com> wrote:

> ....I meant  to covert just the stuff within the <%%> brackets into
> document.write() and leave the rest untouched. So, your example would
> produce sthg like:
>
> <p class="<script>document.write(item.color)</script>">...

Which is not valid I'm afraid - doing so would require a client-side
library to process stuff like

  <p class="{item.color)">

That's not too hard though, that might be an option.

> >... Do you have an example use case for mixing server-side and client-side
> > templating? ...

> From the ever-popular blog example:
> A blog where the posts are filtered on the server-side (using some criteria
> like date, author, etc) but sorting is done on the client (so that a change
> of sorting criteria does not result in another request)....

Ok, I see the idea then.

-Bertrand

Re: [jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by Michael Marth <mm...@day.com>.
Hi Bertrand,

> ...1. would it be better to produce output like:
> > <p class="
> > document.write(item.color);
> > "\">"
> > document.write(item.text);
> > </p>
> > So that e.g. search engines could index the static parts?...
>
> Can you give a more complete example? The above is not valid
> html/javascript code, I see what you mean but I'm not sure exactly how
> you envision it.


I meant  to covert just the stuff within the <%%> brackets into
document.write() and leave the rest untouched. So, your example would
produce sthg like:

<p class="<script>document.write(item.color)</script>"><script>
document.write(item.text)</script></p>

I am not sure if this is a good idea, but on first glance it seems more
natural to me.


> ...2. Having the same templating language on client and server is nice,
> but
> > maybe different delimiters would be a good idea. If the same ones are
> used
> > we cannot combine server-side and client-side parts in one script....
>
> Do you have an example use case for mixing server-side and client-side
> templating? I agree that that might be cool, but the downside is the
> possible confusion with different sets of delimiters. So I'd like to
> make sure this is not YAGNI.


>From the ever-popular blog example:
A blog where the posts are filtered on the server-side (using some criteria
like date, author, etc) but sorting is done on the client (so that a change
of sorting criteria does not result in another request).

Re: [jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by Bertrand Delacretaz <bd...@apache.org>.
Hi Michael,

On Nov 29, 2007 2:45 PM, Michael Marth <mm...@day.com> wrote:

> ...1. would it be better to produce output like:
> <p class="
> document.write(item.color);
> "\">"
> document.write(item.text);
> </p>
> So that e.g. search engines could index the static parts?...

Can you give a more complete example? The above is not valid
html/javascript code, I see what you mean but I'm not sure exactly how
you envision it.

> ...2. Having the same templating language on client and server is nice, but
> maybe different delimiters would be a good idea. If the same ones are used
> we cannot combine server-side and client-side parts in one script....

Do you have an example use case for mixing server-side and client-side
templating? I agree that that might be cool, but the downside is the
possible confusion with different sets of delimiters. So I'd like to
make sure this is not YAGNI.

> ...btw: reminded me of the TrimPath stuff now at
> http://code.google.com/p/trimpath/wiki/JavaScriptTemplates...

Interesting, thanks.

-Bertrand

Re: [jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by Michael Marth <mm...@day.com>.
Bertrand,

2 things I wonder about:

1. would it be better to produce output like:
<p class="
document.write(item.color);
"\">"
document.write(item.text);
</p>
So that e.g. search engines could index the static parts?

2. Having the same templating language on client and server is nice, but
maybe different delimiters would be a good idea. If the same ones are used
we cannot combine server-side and client-side parts in one script. This
seems like an unnecessary limitation to me.

btw: reminded me of the TrimPath stuff now at
http://code.google.com/p/trimpath/wiki/JavaScriptTemplates

Cheers
Michael

On 11/29/07, Bertrand Delacretaz (JIRA) <ji...@apache.org> wrote:
>
>
>     [
> https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546652]
>
> Bertrand Delacretaz commented on SLING-114:
> -------------------------------------------
>
> Thanks for the hint, didn't know about that. I guess it's cool to have the
> same templating language on both sides, we'll see how this works.
>
> > ECT - Ecmascript Client Templates
> > ---------------------------------
> >
> >                 Key: SLING-114
> >                 URL: https://issues.apache.org/jira/browse/SLING-114
> >             Project: Sling
> >          Issue Type: Improvement
> >          Components: microsling
> >            Reporter: Bertrand Delacretaz
> >
> > To complete the javascript scripting features for microsling, I'd like
> to implement a client-side version of the ESP templates.
> > A template such as
> >   <p class="<%= item.color %>"><%= item.text %></p>
> > Will be processed server-side to generate javascript client code such as
> >   document.write("<p class=");
> >   document.write(item.color);
> >   document.write("\">");
> >   document.write(item.text);
> >   document.write("</p>\n");
> > which executes on the client to render the content.
> > Combined with a richer XHTML default rendering of data than what we have
> now, this creates interesting possibilities for ajaxish apps based on
> microsling/microjax (SLING-92).
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>

Re: [jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by David Nuescheler <da...@day.com>.
> Don't know and IMHO doesn't matter. The question is whether there would
> be a possibility of mixing the two when talking of "jst files" ...
since i think there is no such thing like a "jstl file" i think the two
concepts are distant enough. i don't see someone getting them mixed up.

as a matter of fact "jst" is already used as a short form for
"JavaScript Template"
in various other javascript templating projects...

regards,
david

Re: [jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by Felix Meschberger <fm...@gmail.com>.
Don't know and IMHO doesn't matter. The question is whether there would
be a possibility of mixing the two when talking of "jst files" ...

Regards
Felix

Am Dienstag, den 04.12.2007, 12:51 +0100 schrieb David Nuescheler:
> > Isn't this too close to JSTL ?
> is there a .jstl extension?
> 
> regards,
> david


Re: [jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by David Nuescheler <da...@day.com>.
> Isn't this too close to JSTL ?
is there a .jstl extension?

regards,
david

[jira] Assigned: (SLING-114) Sling Javascript Client Templates (was: Ecmascript Client Templates)

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bertrand Delacretaz reassigned SLING-114:
-----------------------------------------

    Assignee: Bertrand Delacretaz

> Sling Javascript Client Templates (was: Ecmascript Client Templates)
> --------------------------------------------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>            Assignee: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bertrand Delacretaz updated SLING-114:
--------------------------------------

    Attachment: SLING-114.patch

The attached patch implements a rough prototype of the client-side rendering.

If an *.ect script is found, microsling outputs an HTML page with:

-A "currentNode" javascript variable, initialized using our JSON renderer

-The javascript code, converted from the ECT template, that renders the content

-A simple HTML rendering, based on the DefaultHtmlRenderer class (which will need to be improved)

That means that in one HTTP request, the client gets all it needs for dynamic rendering (using the client's CPU), and a page that is indexable by search engines.

To test this:

-Apply this patch (tested with revision 599839)

-Start microsling, go to http://localhost:8080/content-creation-forms.html and create a node using the supplied form

-The created node should be displayed with the default rendering

-Mount the repository via WebDAV and add the template shown below as file sling/scripts/microsling/example/html.ect 

The ectOnLoad() stuff in the template needs to be better integrated.

Here's the template:
<p>
  currentNode.title = <b> <%= currentNode.title %> </b>
</p>
<p>
  currentNode.text = <em> <%= currentNode.text %> </em>
</p>

<%
  function ectOnLoad() {
    var defaultDisplay = document.getElementById("EctDefaultRendering");
    if(defaultDisplay) {
      defaultDisplay.setAttribute("style","display:none");
    }

    var title = document.getElementById("title");
    if(title) {
      title.innerHTML = currentNode.title;
    }
  }
%>


> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547205 ] 

Bertrand Delacretaz commented on SLING-114:
-------------------------------------------

Forgot something, after "The created node should be displayed with the default rendering ", you have to add the .html extension at the end of URL that display the created node.

> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547828 ] 

Bertrand Delacretaz commented on SLING-114:
-------------------------------------------

I haved committed the patch of this morning in revision 600511.

The EctScriptEngine is currently under the "org.apache.sling.microsling.experimental" package to indicate its experimental status - this allows people to play with it and comment on its usefulness.

> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547833 ] 

Bertrand Delacretaz commented on SLING-114:
-------------------------------------------

Previous commit was broken, revision 600516 works.

> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12548225 ] 

Felix Meschberger commented on SLING-114:
-----------------------------------------

> extension would then be jst, which is not used for similar things yet.

Isn't this too close to JSTL ?

> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12548221 ] 

Bertrand Delacretaz commented on SLING-114:
-------------------------------------------

As these templates are meant for clients which run javascript, "Sling Javascript Templates" seems to be a better name, and the extension would then be jst, which is not used for similar things yet.

> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549973 ] 

Bertrand Delacretaz commented on SLING-114:
-------------------------------------------

Browsers seem to choke if a </script> tag is present in a javascript string like

  out.write("</script>");

There's probably nothing we can do about this, except breaking such strings in two:

  out.write("</scr");
  out.write("ipt>");

And breaking up the <script> opening tag might be a good idea as well


> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550012 ] 

Bertrand Delacretaz commented on SLING-114:
-------------------------------------------

</script> tag filtering implemented in revision 602860.

This is done by post-processing the output of the EspReader in a simple way - a cleaner solution would be to include this special treatment of </script> tags in the ESP reader itself, but that's much more complicated. If ECT is promoted to more than experimental status, it might be worth having a closer look.

> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550051 ] 

Bertrand Delacretaz commented on SLING-114:
-------------------------------------------

Revision 602834 has been reverted in sling/scripting/javascript, as it breaks the sync in line numbers between the template and generated source code.

The special <script> tag handling for ECT still basically works, but can be broken by constructs like

<% for(i=0; i< 10; i++) {
} %><script>more scripting</script><% for(i=0; i< 10; i++) {
} %>

The SlingResourceTypeRenderingTest.testEctHtmlScriptTagB test shows the problem, I'll leave it disabled until this is fixed. 

I'm planning to make the "put each out.write on its own line" feature an option in the EspReader (using overridable pre- and postfix Strings for these out.write statements) , and activate it iwhen the reader is used in the EctScriptEngine.

> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Alexander Klimetschek (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546650 ] 

Alexander Klimetschek commented on SLING-114:
---------------------------------------------

FYI: Dojo for example has a similar concept with simple string replacement. They use ${myvar} placeholders inside strings. But having the same syntax on both client and server side is probably easier - at least if you don't get confused what you currently develop ;-)

> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) Sling Javascript Client Templates (was: Ecmascript Client Templates)

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12569548#action_12569548 ] 

Felix Meschberger commented on SLING-114:
-----------------------------------------

Can this be closed ?

> Sling Javascript Client Templates (was: Ecmascript Client Templates)
> --------------------------------------------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>            Assignee: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) Sling Javascript Client Templates (was: Ecmascript Client Templates)

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12550420 ] 

Bertrand Delacretaz commented on SLING-114:
-------------------------------------------

Name change implemented in revision 603221, the ScriptEngine is now JstScriptEngine and uses the jst extension.

> Sling Javascript Client Templates (was: Ecmascript Client Templates)
> --------------------------------------------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>            Assignee: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12549972 ] 

Bertrand Delacretaz commented on SLING-114:
-------------------------------------------

>> extension would then be jst, which is not used for similar things yet.
> Isn't this too close to JSTL ?

I don't think that's really a problem, JSTL and our jst templates are fairly different in scope

> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (SLING-114) Sling Javascript Client Templates (was: Ecmascript Client Templates)

Posted by "Felix Meschberger (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Meschberger closed SLING-114.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.0.0

In the meantime the JST engine has been ported into Sling (see SLING-192), so I close this issue.

> Sling Javascript Client Templates (was: Ecmascript Client Templates)
> --------------------------------------------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>            Assignee: Bertrand Delacretaz
>             Fix For: 2.0.0
>
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12546652 ] 

Bertrand Delacretaz commented on SLING-114:
-------------------------------------------

Thanks for the hint, didn't know about that. I guess it's cool to have the same templating language on both sides, we'll see how this works.

> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-114) Sling Javascript Client Templates (was: Ecmascript Client Templates)

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bertrand Delacretaz updated SLING-114:
--------------------------------------

    Summary: Sling Javascript Client Templates (was: Ecmascript Client Templates)  (was: ECT - Ecmascript Client Templates)

Renaming this issue to "Sling Javascript Client Templates" as discussed, suggest using that as the official name.

I'll rename things in code as well, and change to use the jst extension - (as in "jst do it" maybe ;-)

> Sling Javascript Client Templates (was: Ecmascript Client Templates)
> --------------------------------------------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bertrand Delacretaz updated SLING-114:
--------------------------------------

    Attachment: SLING-114.patch

Slightly improved patch, default rendering is turned off automatically if javascript is present, and onLoad() function is called by body.onLoad if present in template.

> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (SLING-114) ECT - Ecmascript Client Templates

Posted by "Bertrand Delacretaz (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SLING-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12547788 ] 

Bertrand Delacretaz commented on SLING-114:
-------------------------------------------

Here's a simple example template that works with the revised patch that I just uploaded:

<p>
  currentNode.title = <b> <%= currentNode.title %> </b>
</p>
<p>
  currentNode.text = <em> <%= currentNode.text %> </em> (changed)
</p>

<%
  // if present, this function is called by body.onLoad
  function onLoad() {
    document.title = currentNode.title;
  }
%>


> ECT - Ecmascript Client Templates
> ---------------------------------
>
>                 Key: SLING-114
>                 URL: https://issues.apache.org/jira/browse/SLING-114
>             Project: Sling
>          Issue Type: Improvement
>          Components: microsling
>            Reporter: Bertrand Delacretaz
>         Attachments: SLING-114.patch, SLING-114.patch
>
>
> To complete the javascript scripting features for microsling, I'd like to implement a client-side version of the ESP templates.
> A template such as
>   <p class="<%= item.color %>"><%= item.text %></p>
> Will be processed server-side to generate javascript client code such as
>   document.write("<p class=");
>   document.write(item.color);
>   document.write("\">");
>   document.write(item.text);
>   document.write("</p>\n");
> which executes on the client to render the content.
> Combined with a richer XHTML default rendering of data than what we have now, this creates interesting possibilities for ajaxish apps based on microsling/microjax (SLING-92).

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.