From version 4.44
edited by Admin
on 2019/06/25 14:50
To version 5.1
edited by Simon Urli
on 2019/07/03 14:15
Change comment: There is no comment for this version

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -xwiki:XWiki.Admin
1 +xwiki:XWiki.surli
ExtensionCode.ExtensionClass[0]
Description
... ... @@ -14,9 +14,17 @@
14 14  
15 15  = Bindings =
16 16  
17 -There are several bindings that are available in the code content for the macro:
17 +There are several bindings that are available in the code content for the macro.
18 18  
19 -* ##xcontext.macro.params##: The list of all parameters passed to the macro, e.g. ##xcontext.macro.params.myparam## would return the value for the ##myparam## parameter in ##~{~{mymacro myparam="myvalue" ...}}##.
19 +Starting with {{info}}XWiki 10.11.9, 11.3.2 and 11.6RC1{{/info}} all of them are available through ##$wikimacro##:
20 + * ##wikimacro.parameters##: The list of all parameters passed to the macro with value converted to the given type, e.g. ##wikimacro.parameters.myparam## would return the value for the ##myparam## parameter in ##~{~{mymacro myparam="myvalue" ...}}##.
21 + * ##wikimacro.content##: The macro content
22 + * ##wikimacro.context##: The Macro Transformation Context (##MacroTransformationContext##) which provides access to information such as the current XDOM Block (and thus access to all parent blocks too. For example a TOC macro would need to find all the Heading blocks), the syntax of the content of the macro, whether the macro is inline or not, etc. This binding is not set if the wikimacro is executed asynchronously.
23 + * ##wikimacro.result##: This is an output parameter into which the result of the macro can be stored if you wish to directly return the desired list of rendering blocks without having to render them first to let them be parsed back by the macro transformation. The benefits are that it could be a lots quicker and most of all it means supporting syntaxes which does not provide any renderer. It also makes it possible to generate some XDOM which is impossible to write in some syntaxes.
24 + * ##wikimacro.doc##: The ##com.xpn.xwiki.api.Document## instance of the document in which the macro is defined.
25 +
26 +Some bindings are also available through ##$xcontext.macro## but they are now considered as deprecated:
27 +* ##xcontext.macro.params##: The list of all parameters passed to the macro, e.g. ##xcontext.macro.params.myparam## would return the **String value** for the ##myparam## parameter in ##~{~{mymacro myparam="myvalue" ...}}##.
20 20  * ##xcontext.macro.content##: The macro content
21 21  * ##xcontext.macro.context##: The Macro Transformation Context (##MacroTransformationContext##) which provides access to information such as the current XDOM Block (and thus access to all parent blocks too. For example a TOC macro would need to find all the Heading blocks), the syntax of the content of the macro, whether the macro is inline or not, etc.
22 22  * ##xcontext.macro.result##: This is an output parameter into which the result of the macro can be stored if you wish to directly return the desired list of rendering blocks without having to render them first to let them be parsed back by the macro transformation. The benefits are that it could be a lots quicker and most of all it means supporting syntaxes which does not provide any renderer. It also makes it possible to generate some XDOM which is impossible to write in some syntaxes.

Get Connected