<
From version < 117.4 >
edited by Vincent Massol
on 2021/01/05
To version < 117.5 >
edited by Vincent Massol
on 2021/01/25
>
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -6,20 +6,6 @@
6 6  
7 7  This page is a tutorial but you can also access the [[reference documentation for the Wiki Macro feature>>doc:extensions:Extension.WikiMacroStore.WebHome]].
8 8  
9 -= Macro Visibility and Rights =
10 -
11 -There are 3 levels of visibility for a macro:
12 -
13 -* ##Global##
14 -** 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**
15 -** on subwiki {{info}}in 10.4RC1+{{/info}} synonym of ##Current Wiki## visibility
16 -* ##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**
17 -* ##Current User##, which means that the macro will only be available to the user who is its author. No special rights required.
18 -
19 -== Using protected API in wiki macros ==
20 -
21 -Also, if the macro needs to use [[protected API>>platform:DevGuide.Scripting||anchor="HXWikiCoreAccess"]], the author of the macro will need to have programming rights. Note that the macro will always be executed with the rights of its author, and not with the rights of the author of the calling document (the document using the macro). Specifically, if the macro uses protected API, only the macro author needs to have programming rights, not all the authors of the documents that call this macro.
22 -
23 23  = Hello Macro =
24 24  
25 25  We are going to start with a very simple xwiki/2.0 wiki macro which prints a greeting message to the document content. It isn't a very useful macro but the idea is to get you familiarised with the wiki macro creation process.
... ... @@ -32,7 +32,6 @@
32 32  There can be only one object of type ##XWiki.WikiMacroClass## per wiki page (if you add more only the first will be used).
33 33  {{/warning}}
34 34  
35 -
36 36  This class contains the following fields:
37 37  
38 38  * **Macro id**: Id of the macro to be used by users when invoking your macro from wiki code
... ... @@ -153,6 +153,24 @@
153 153  rendering.macro.hello.parameter.greetUser.description=Personnaliser le message pour l'utilisateur courant en train de visualiser la page. Les valeurs possibles sont "true" (oui) et "false" (non).
154 154  {{/code}}
155 155  
141 += Macro Visibility and Rights =
142 +
143 +There are 3 levels of visibility for a macro:
144 +
145 +* ##Global##
146 +** 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**
147 +** on subwiki {{info}}in 10.4RC1+{{/info}} synonym of ##Current Wiki## visibility
148 +* ##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**
149 +* ##Current User##, which means that the macro will only be available to the user who is its author. No special rights required.
150 +
151 +== Using protected API in wiki macros ==
152 +
153 +Also, if the macro needs to use [[protected API>>platform:DevGuide.Scripting||anchor="HXWikiCoreAccess"]], the author of the macro will need to have programming rights. Note that the macro will always be executed with the rights of its author, and not with the rights of the author of the calling document (the document using the macro). Specifically, if the macro uses protected API, only the macro author needs to have programming rights, not all the authors of the documents that call this macro.
154 +
155 += Bindings =
156 +
157 +See all availalbe bindings in [[the reference documentation page>>doc:extensions:Extension.WikiMacroStore.WebHome||anchor="HBindings"]].
158 +
156 156  = WYSIWYG Access =
157 157  
158 158  A wiki macros is treated just like any other rendering macro in the system. As such, the moment you save your wiki macro it will be available to the users through the WYSIWYG editor's **Insert Macro** dialog box:
... ... @@ -194,7 +194,6 @@
194 194  
195 195  Following are a few useful hints if you plan to do advanced scripting inside your wiki macros:
196 196  
197 -* See all bindings in [[the reference documentation page>>doc:extensions:Extension.WikiMacroStore.WebHome||anchor="HBindings"]].
198 198  * 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:(((
199 199  {{code language='groovy'}}
200 200  {{groovy}}

Get Connected