[xwiki-devs] [Proposal] Change script macro to return JSR223's eval value
Hi devs, I’ve implemented http://jira.xwiki.org/browse/XWIKI-11961 However it’s causing several tests to fail, proving that it’s changing the script behaviors. For example if you have: {{groovy}} var = "toto" {{/groovy}} {{velocity}} $var {{/velocity}} Then you’ll see “toto” printed twice. Once for the groovy macro. The right way to not output content is to use output=false as in: {{groovy output="false"}} var = "toto" {{/groovy}} {{velocity}} $var {{/velocity}} So we need to decide if we’re ok to go with this even though it changes the behavior. I don’t completely master the full gamut of consequences this will have but I have the feeling that from a logical point of view, it’s the best thing to have. WDYT? Thanks -Vincent
BTW and FYI the following: {{groovy}} class MyClass {} {{/groovy}} {{groovy}} def var = new MyClass() {{/groovy}} Returns: MyClass MyClass@5519a693 Note: the reason for "MyClass@5519a693” is because we don’t have a converter from MyClass to String. We could improve my change to not display anything if there’s no converter available if we wanted but I’m not sure it’s the best thing to do. Thanks -Vincent On 25 Mar 2015 at 15:10:21, [email protected] ([email protected](mailto:[email protected])) wrote:
Hi devs,
I’ve implemented http://jira.xwiki.org/browse/XWIKI-11961
However it’s causing several tests to fail, proving that it’s changing the script behaviors. For example if you have:
{{groovy}} var = "toto" {{/groovy}}
{{velocity}} $var {{/velocity}}
Then you’ll see “toto” printed twice. Once for the groovy macro.
The right way to not output content is to use output=false as in:
{{groovy output="false"}} var = "toto" {{/groovy}}
{{velocity}} $var {{/velocity}}
So we need to decide if we’re ok to go with this even though it changes the behavior.
I don’t completely master the full gamut of consequences this will have but I have the feeling that from a logical point of view, it’s the best thing to have.
WDYT?
Thanks -Vincent
On Wed, Mar 25, 2015 at 4:09 PM, [email protected] <[email protected]> wrote:
Hi devs,
I’ve implemented http://jira.xwiki.org/browse/XWIKI-11961
However it’s causing several tests to fail, proving that it’s changing the script behaviors. For example if you have:
{{groovy}} var = "toto" {{/groovy}}
{{velocity}} $var {{/velocity}}
Then you’ll see “toto” printed twice. Once for the groovy macro.
The right way to not output content is to use output=false as in:
This makes sense. But if you call print the macro won't print anything else besides the printed message right? +0 Thanks, Marius
{{groovy output="false"}} var = "toto" {{/groovy}}
{{velocity}} $var {{/velocity}}
So we need to decide if we’re ok to go with this even though it changes the behavior.
I don’t completely master the full gamut of consequences this will have but I have the feeling that from a logical point of view, it’s the best thing to have.
WDYT?
Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Ok for the change. On Wed, Mar 25, 2015 at 3:09 PM, [email protected] <[email protected]> wrote:
Hi devs,
I’ve implemented http://jira.xwiki.org/browse/XWIKI-11961
However it’s causing several tests to fail, proving that it’s changing the script behaviors. For example if you have:
{{groovy}} var = "toto" {{/groovy}}
{{velocity}} $var {{/velocity}}
Then you’ll see “toto” printed twice. Once for the groovy macro.
The right way to not output content is to use output=false as in:
{{groovy output="false"}} var = "toto" {{/groovy}}
{{velocity}} $var {{/velocity}}
So we need to decide if we’re ok to go with this even though it changes the behavior.
I don’t completely master the full gamut of consequences this will have but I have the feeling that from a logical point of view, it’s the best thing to have.
WDYT?
Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
On Wed, Mar 25, 2015 at 5:14 PM, Thomas Mortagne <[email protected]> wrote:
Ok for the change.
On Wed, Mar 25, 2015 at 3:09 PM, [email protected] <[email protected]> wrote:
Hi devs,
I’ve implemented http://jira.xwiki.org/browse/XWIKI-11961
However it’s causing several tests to fail, proving that it’s changing the script behaviors. For example if you have:
{{groovy}} var = "toto" {{/groovy}}
{{velocity}} $var {{/velocity}}
Then you’ll see “toto” printed twice. Once for the groovy macro.
The right way to not output content is to use output=false as in:
{{groovy output="false"}} var = "toto" {{/groovy}}
{{velocity}} $var {{/velocity}}
So we need to decide if we’re ok to go with this even though it changes the behavior.
I don’t completely master the full gamut of consequences this will have but I have the feeling that from a logical point of view, it’s the best thing to have.
WDYT?
Well, I do not really see the benefit, but more the potential inconveniences it could cause to existing code. There is maybe a midway. IIRC, the script macros are not accepting to be inlined. For your sample, it looks to me that it would be the intended purpose. So, what we could do is allow script macro to be inlined, and in that case, we do not provide any writer, and we simply parse the eval return. Another way could also to have an eval macro, and keep the script one as it is now. I am -0 for this change as is, and +1 for any of the above proposal.
Thanks -Vincent _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Denis Gervalle SOFTEC sa - CEO
participants (4)
-
Denis Gervalle -
Marius Dumitru Florea -
Thomas Mortagne -
vincent@massol.net