Last modified by Simon Urli on 2023/10/10

From version 131.1
edited by Anca Luca
on 2023/03/03
Change comment: There is no comment for this version
To version 131.2
edited by Vincent Massol
on 2023/04/05
Change comment: Remove old version mentions + fix missing version macro

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.lucaa
1 +XWiki.VincentMassol
Content
... ... @@ -23,16 +23,16 @@
23 23  * **Macro id**: Id of the macro to be used by users when invoking your macro from wiki code
24 24  * **Macro name**: Name of the macro to be displayed on the wysiwyg editor
25 25  * **Macro description**: A short description of the macro to be displayed on the WYSIWYG editor
26 -* **Default categories**: Default categories under which this macro should be listed {{warning}}before 14.4RC1 this was called **Default category**{{/warning}}
26 +* {{version since="14.4RC1"}}**Default categories**: Default categories under which this macro should be listed{{version}} ({{version before="14.4RC1"}}It was called "Default category"{{/version}})
27 27  * **Supports inline mode**: Whether the macro can be used in an inline context or not
28 -* **Macro Content availability**: {{warning}}before 11.5RC1 this was called **Macro Content Type**{{/warning}} whether this macro should support a body or not
29 -* **Macro content type**: {{warning}}this field has been renamed **Macro Content Availability** since 11.5RC1{{/warning}} the type of accepted content: two values are proposed, ##WIKI## if this content should be editable like a wiki content, or ##UNKNOWN## if it should be displayed like a plain text. It's also possible to specify a custom java type such as {{code language="java"}}java.util.List<java.lang.String>{{/code}}. Leaving the field blank is equivalent to ##UNKWOWN## value.
28 +* **Macro content availability**: Whether this macro should support a body or not. Valid values are "Optional", "Mandatory" and "No Content".
29 +* **Macro content type**: The type of accepted content: two values are proposed, ##WIKI## if this content should be editable like a wiki content, or ##UNKNOWN## if it should be displayed like a plain text. It's also possible to specify a custom java type such as {{code language="java"}}java.util.List<java.lang.String>{{/code}}. Leaving the field blank is equivalent to ##UNKWOWN## value.
30 30  * **Content description**: A short description about the macro's content to be displayed on the WYSIWYG editor
31 31  * **Macro code**: The actual wiki code that will be evaluated when the macro is executed, can be any xwiki content (should be in the same syntax as the document)
32 -* {{version since="13.1RC1"}}**Priority**: The priority of execution relative to the other Macros. The lowest values have the highest priorities and execute first. For example a Macro with a priority of 100 will execute before one with a priority of 500. The default value is 1000.{{/version}}
33 -* {{version since="10.10"}}**Asynchronous rendering**: Enabled or disable asynchronous rendering of the panel. Disabled by default.{{/version}}
34 -* {{version since="10.10"}}**Cached**: Indicate if the result of the execution of the element should be cached. Disabled by default.{{/version}}
35 -* {{version since="10.10"}}**Context elements**: The context information required during the execution of the extension (current user, current document, etc.). It's also used to generate the cache key.{{/version}}
32 +* **Priority**: The priority of execution relative to the other Macros. The lowest values have the highest priorities and execute first. For example a Macro with a priority of 100 will execute before one with a priority of 500. The default value is 1000.
33 +* **Asynchronous rendering**: Enabled or disable asynchronous rendering of the panel. Disabled by default.
34 +* **Cached**: Indicate if the result of the execution of the element should be cached. Disabled by default.
35 +* **Context elements**: The context information required during the execution of the extension (current user, current document, etc.). It's also used to generate the cache key.
36 36  
37 37  Now we can define our hello macro as shown below:
38 38  
... ... @@ -91,7 +91,8 @@
91 91  
92 92  As you might have realized already, direct binding of parameters is not supported at the moment. That is, you cannot access //greetUser// parameter with **$greetUser**. Instead you must use **$wikimacro.parameters.greetUser**. We plan to introduce some form of direct parameter binding in near future.
93 93  
94 -Since {{info}}11.5RC1{{/info}}, it is also possible to display the content of a macro parameter by using a dedicated macro:
94 +It is also possible to display the content of a macro parameter by using a dedicated macro:
95 +
95 95  {{code language="none"}}Hello {{wikimacroparameter name="greetUsers" /}}{{/code}}
96 96  
97 97  Finally, we can test our new version of **hello macro** with the following invocation:
... ... @@ -137,8 +137,8 @@
137 137  There are 3 levels of visibility for a macro:
138 138  
139 139  * ##Global##
140 -** on main wiki (or {{info}}before XWiki 10.4RC1{{/info}}) the macro will be available in all the pages of all the (sub)wikis. Requires the macro author to have **Programming Rights**
141 -** on subwiki {{info}}in 10.4RC1+{{/info}} synonym of ##Current Wiki## visibility
141 +** on the main wiki, the macro will be available in all the pages of all the (sub)wikis. Requires the macro author to have **Programming Rights**
142 +** on subwikis, it's a synonym of the ##Current Wiki## visibility
142 142  * ##Current Wiki##, which means that the macro will be available in all the pages of the wiki the macro is in. Requires the macro author to have **Admin Rights**
143 143  * ##Current User##, which means that the macro will only be available to the user who is its author. No special rights required.
144 144  
... ... @@ -193,7 +193,7 @@
193 193  
194 194  Following are a few useful hints if you plan to do advanced scripting inside your wiki macros:
195 195  
196 -* Since 2.4M1, it's possible 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 syntax which does not provide any renderer. It also makes it possible to generate some XDOM which is impossible to write in any some syntax. For example the following wiki macro is generating a LinkBlock targeting a relative URL:(((
197 +* It's possible 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 syntax which does not provide any renderer. It also makes it possible to generate some XDOM which is impossible to write in any some syntax. For example the following wiki macro is generating a LinkBlock targeting a relative URL:(((
197 197  {{code language="groovy"}}
198 198  {{groovy}}
199 199  import java.util.Collections;

Get Connected