[xwiki-devs] [Proposal] New macro: {{current}}
Hi devs, I'd like to propose a new macro (not sure how to call it): {{current}} Usage: {{current document="wiki:space.page"}} .... nested blocks.... {{/current}} What it does: * Execute the nested blocks in the context of the passed document, i.e. it sets the passed document as the current document in the execution context. Rationale: * We have several use cases: ** When we have an include and we want to use relative references (links, images) in the included document ** On the Features page of enterprise.xwiki.org I query extensions.xwiki.org and get the data from one object field which has the format: "attach:...." (or "url:....", etc). I need to make this an image that is resolved based on the page where the information was taken from. WDYT? Thanks -Vincent
On Thu, Dec 16, 2010 at 11:42, Vincent Massol <[email protected]> wrote:
Hi devs,
I'd like to propose a new macro (not sure how to call it): {{current}}
Usage:
{{current document="wiki:space.page"}} .... nested blocks.... {{/current}}
What it does:
* Execute the nested blocks in the context of the passed document, i.e. it sets the passed document as the current document in the execution context.
So that means "current" macro will execute itself the transformations for its content ? What would be the priority of "current" macro in this case ?
Rationale:
* We have several use cases: ** When we have an include and we want to use relative references (links, images) in the included document ** On the Features page of enterprise.xwiki.org I query extensions.xwiki.org and get the data from one object field which has the format: "attach:...." (or "url:....", etc). I need to make this an image that is resolved based on the page where the information was taken from.
WDYT?
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
Not sure what we are talking about, but can't we use http://extensions.xwiki.org/xwiki/bin/view/Extension/Include+Macro with context=current? or make the {{current}} macro a new parameters for the {{include}} ? Thanks, Caty On Thu, Dec 16, 2010 at 12:51, Thomas Mortagne <[email protected]>wrote:
On Thu, Dec 16, 2010 at 11:42, Vincent Massol <[email protected]> wrote:
Hi devs,
I'd like to propose a new macro (not sure how to call it): {{current}}
Usage:
{{current document="wiki:space.page"}} .... nested blocks.... {{/current}}
What it does:
* Execute the nested blocks in the context of the passed document, i.e. it sets the passed document as the current document in the execution context.
So that means "current" macro will execute itself the transformations for its content ? What would be the priority of "current" macro in this case ?
Rationale:
* We have several use cases: ** When we have an include and we want to use relative references (links,
images) in the included document
** On the Features page of enterprise.xwiki.org I query extensions.xwiki.org and get the data from one object field which has the format: "attach:...." (or "url:....", etc). I need to make this an image that is resolved based on the page where the information was taken from.
WDYT?
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
I second that, I was expecting {{include context="new"}} to be applied on the wiki syntax, is this parameter only taken into account for script macros ? JV. On Thu, Dec 16, 2010 at 11:56 AM, Ecaterina Moraru (Valica) <[email protected]> wrote:
Not sure what we are talking about, but can't we use http://extensions.xwiki.org/xwiki/bin/view/Extension/Include+Macro
with context=current?
or make the {{current}} macro a new parameters for the {{include}} ?
Thanks, Caty
On Thu, Dec 16, 2010 at 12:51, Thomas Mortagne <[email protected]>wrote:
On Thu, Dec 16, 2010 at 11:42, Vincent Massol <[email protected]> wrote:
Hi devs,
I'd like to propose a new macro (not sure how to call it): {{current}}
Usage:
{{current document="wiki:space.page"}} .... nested blocks.... {{/current}}
What it does:
* Execute the nested blocks in the context of the passed document, i.e. it sets the passed document as the current document in the execution context.
So that means "current" macro will execute itself the transformations for its content ? What would be the priority of "current" macro in this case ?
Rationale:
* We have several use cases: ** When we have an include and we want to use relative references (links,
images) in the included document
** On the Features page of enterprise.xwiki.org I query extensions.xwiki.org and get the data from one object field which has the format: "attach:...." (or "url:....", etc). I need to make this an image that is resolved based on the page where the information was taken from.
WDYT?
Thanks -Vincent
On Thu, Dec 16, 2010 at 12:03, Jean-Vincent Drean <[email protected]> wrote:
I second that, I was expecting {{include context="new"}} to be applied on the wiki syntax, is this parameter only taken into account for script macros ?
It is since include macro inside included document are based on current document for example. The problem with context=new is that it completely isolate the included document and don't only change the current document which is not what we wants here.
JV.
On Thu, Dec 16, 2010 at 11:56 AM, Ecaterina Moraru (Valica) <[email protected]> wrote:
Not sure what we are talking about, but can't we use http://extensions.xwiki.org/xwiki/bin/view/Extension/Include+Macro
with context=current?
or make the {{current}} macro a new parameters for the {{include}} ?
Thanks, Caty
On Thu, Dec 16, 2010 at 12:51, Thomas Mortagne <[email protected]>wrote:
On Thu, Dec 16, 2010 at 11:42, Vincent Massol <[email protected]> wrote:
Hi devs,
I'd like to propose a new macro (not sure how to call it): {{current}}
Usage:
{{current document="wiki:space.page"}} .... nested blocks.... {{/current}}
What it does:
* Execute the nested blocks in the context of the passed document, i.e. it sets the passed document as the current document in the execution context.
So that means "current" macro will execute itself the transformations for its content ? What would be the priority of "current" macro in this case ?
Rationale:
* We have several use cases: ** When we have an include and we want to use relative references (links,
images) in the included document
** On the Features page of enterprise.xwiki.org I query extensions.xwiki.org and get the data from one object field which has the format: "attach:...." (or "url:....", etc). I need to make this an image that is resolved based on the page where the information was taken from.
WDYT?
Thanks -Vincent
devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
On Dec 16, 2010, at 11:56 AM, Ecaterina Moraru (Valica) wrote:
Not sure what we are talking about, but can't we use http://extensions.xwiki.org/xwiki/bin/view/Extension/Include+Macro
with context=current?
That's a bit different since context=new creates a new context (context=current doesn't do anything).
or make the {{current}} macro a new parameters for the {{include}} ?
Yes i thought about adding a new param to the include macro but that won't solve the the second use case listed below. We could have both though: a param for include + that macro for other use cases. However Thomas raised a good question which we need to answer before we go further. Thanks -Vincent
Thanks, Caty
On Thu, Dec 16, 2010 at 12:51, Thomas Mortagne <[email protected]>wrote:
On Thu, Dec 16, 2010 at 11:42, Vincent Massol <[email protected]> wrote:
Hi devs,
I'd like to propose a new macro (not sure how to call it): {{current}}
Usage:
{{current document="wiki:space.page"}} .... nested blocks.... {{/current}}
What it does:
* Execute the nested blocks in the context of the passed document, i.e. it sets the passed document as the current document in the execution context.
So that means "current" macro will execute itself the transformations for its content ? What would be the priority of "current" macro in this case ?
Rationale:
* We have several use cases: ** When we have an include and we want to use relative references (links,
images) in the included document
** On the Features page of enterprise.xwiki.org I query extensions.xwiki.org and get the data from one object field which has the format: "attach:...." (or "url:....", etc). I need to make this an image that is resolved based on the page where the information was taken from.
WDYT?
Thanks -Vincent
On Dec 16, 2010, at 12:04 PM, Vincent Massol wrote:
On Dec 16, 2010, at 11:56 AM, Ecaterina Moraru (Valica) wrote:
Not sure what we are talking about, but can't we use http://extensions.xwiki.org/xwiki/bin/view/Extension/Include+Macro
with context=current?
That's a bit different since context=new creates a new context (context=current doesn't do anything).
or make the {{current}} macro a new parameters for the {{include}} ?
Yes i thought about adding a new param to the include macro but that won't solve the the second use case listed below.
We could have both though: a param for include + that macro for other use cases.
Since there's a good portion of code shared with the include macro, we could have the include macro either extend or use that new macro too. Thanks -Vincent
However Thomas raised a good question which we need to answer before we go further.
Thanks -Vincent
Thanks, Caty
On Thu, Dec 16, 2010 at 12:51, Thomas Mortagne <[email protected]>wrote:
On Thu, Dec 16, 2010 at 11:42, Vincent Massol <[email protected]> wrote:
Hi devs,
I'd like to propose a new macro (not sure how to call it): {{current}}
Usage:
{{current document="wiki:space.page"}} .... nested blocks.... {{/current}}
What it does:
* Execute the nested blocks in the context of the passed document, i.e. it sets the passed document as the current document in the execution context.
So that means "current" macro will execute itself the transformations for its content ? What would be the priority of "current" macro in this case ?
Rationale:
* We have several use cases: ** When we have an include and we want to use relative references (links,
images) in the included document
** On the Features page of enterprise.xwiki.org I query extensions.xwiki.org and get the data from one object field which has the format: "attach:...." (or "url:....", etc). I need to make this an image that is resolved based on the page where the information was taken from.
WDYT?
Thanks -Vincent
On Thu, Dec 16, 2010 at 11:56, Ecaterina Moraru (Valica) <[email protected]> wrote:
Not sure what we are talking about, but can't we use http://extensions.xwiki.org/xwiki/bin/view/Extension/Include+Macro
with context=current?
It's context=new actually and context=new is not just that, it also isolate the included document, any velocity you set can't be used in includer document for example. Also there is use cases where you want to switch current document without having to put this in another document. By the way, I have another concern but a securiy one this time: that would allow anyone to execute anything in the context of a document with programming right.
or make the {{current}} macro a new parameters for the {{include}} ?
Thanks, Caty
On Thu, Dec 16, 2010 at 12:51, Thomas Mortagne <[email protected]>wrote:
On Thu, Dec 16, 2010 at 11:42, Vincent Massol <[email protected]> wrote:
Hi devs,
I'd like to propose a new macro (not sure how to call it): {{current}}
Usage:
{{current document="wiki:space.page"}} .... nested blocks.... {{/current}}
What it does:
* Execute the nested blocks in the context of the passed document, i.e. it sets the passed document as the current document in the execution context.
So that means "current" macro will execute itself the transformations for its content ? What would be the priority of "current" macro in this case ?
Rationale:
* We have several use cases: ** When we have an include and we want to use relative references (links,
images) in the included document
** On the Features page of enterprise.xwiki.org I query extensions.xwiki.org and get the data from one object field which has the format: "attach:...." (or "url:....", etc). I need to make this an image that is resolved based on the page where the information was taken from.
WDYT?
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
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne
On Dec 16, 2010, at 11:51 AM, Thomas Mortagne wrote:
On Thu, Dec 16, 2010 at 11:42, Vincent Massol <[email protected]> wrote:
Hi devs,
I'd like to propose a new macro (not sure how to call it): {{current}}
Usage:
{{current document="wiki:space.page"}} .... nested blocks.... {{/current}}
What it does:
* Execute the nested blocks in the context of the passed document, i.e. it sets the passed document as the current document in the execution context.
So that means "current" macro will execute itself the transformations for its content ? What would be the priority of "current" macro in this case ?
hmmm, hadn't thought of this... Since we need to reset the previous current doc, it would need to execute its content indeed. Re priority, it would need to be high priority to allow nesting high priority macros in it probably... Any better idea to fulfill the use case below? Good points... Thanks -Vincent
Rationale:
* We have several use cases: ** When we have an include and we want to use relative references (links, images) in the included document ** On the Features page of enterprise.xwiki.org I query extensions.xwiki.org and get the data from one object field which has the format: "attach:...." (or "url:....", etc). I need to make this an image that is resolved based on the page where the information was taken from.
WDYT?
Thanks -Vincent
Ok new proposal: * Name: {{context}} * Check if the specified doc has programing rights and if so requires PR too * Executes its content (same as the include macro) * Same priority as the include macro * Refactor include macro to internally use it (not at the macro level but at the java level) Thanks -Vincent On Dec 16, 2010, at 11:42 AM, Vincent Massol wrote:
Hi devs,
I'd like to propose a new macro (not sure how to call it): {{current}}
Usage:
{{current document="wiki:space.page"}} .... nested blocks.... {{/current}}
What it does:
* Execute the nested blocks in the context of the passed document, i.e. it sets the passed document as the current document in the execution context.
Rationale:
* We have several use cases: ** When we have an include and we want to use relative references (links, images) in the included document ** On the Features page of enterprise.xwiki.org I query extensions.xwiki.org and get the data from one object field which has the format: "attach:...." (or "url:....", etc). I need to make this an image that is resolved based on the page where the information was taken from.
WDYT?
Thanks -Vincent
participants (4)
-
Ecaterina Moraru (Valica) -
Jean-Vincent Drean -
Thomas Mortagne -
Vincent Massol