Wiki source code of Macro

Last modified by Anamaria Stoica on 2010/03/25 16:07

Show last authors
1 {{velocity}}
2 #set($macroId = "$!request.id")
3 #if($macroId == '')
4 {{error}}Macro id parameter is missing.{{/error}}
5 #else
6 ##
7 #set($macroDesc = $macros.getMacroDescriptor($macroId))
8 #if(!$macroDesc)
9 {{error}}Macro with id **${macroId}** does not exist.{{/error}}
10 #else
11 ##
12 = ${macroDesc.name} =
13
14 [[<< Back to gallery>>Macros.WebHome]]
15 ; Name
16 : ${macroDesc.name}
17
18 ; Id
19 : ${macroId}
20
21 ; Description
22 : $!{macroDesc.description}
23
24 ; Default Category
25 : $!{macroDesc.defaultCategory}
26
27 #set($contentDesc = $macroDesc.contentDescriptor)
28 ; Content Description #if(${contentDesc.isMandatory()}) (Mandatory) #{end}\\
29 : $!{contentDesc.description}
30
31 #set($isWikiMacro = $macros.isWikiMacro($macroId))
32 ; Type
33 : #if($isWikiMacro) XWiki Wiki Macro #{else} XWiki Java Macro #{end}
34
35 #if($isWikiMacro)
36 ; Document Reference
37 : [[${macros.getWikiMacroDocumentReferenceFullName($macroId)}]]
38 #end
39
40 #set($paramsMap = $macroDesc.getParameterDescriptorMap())
41 **Parameters**
42 #if($paramsMap.size() > 0)
43 |=Parameter Id|=Parameter Description|=Type|=Default Value|=Required
44 #foreach($param in $paramsMap)
45 |${param.id}|${param.description}|${param.getType().name}|$!{param.defaultValue}|${param.isMandatory()}
46 #end
47
48 #else
49 None
50 #end
51 #end
52 #end
53 {{/velocity}}