Wiki source code of Macros

Version 1.1 by Andrey Che on 2018/12/10 14:09

Show last authors
1 {{include reference="Help.Code.VelocityMacros" /}}
2
3 {{velocity output="false"}}
4 #if ($hasAdmin)
5 #set ($section = 'XWiki.Extensions')
6 #if (!$xwiki.exists($section))
7 ## Support for pre-9.2RC1 Administration Application
8 #set ($section = 'XWiki.AddExtensions')
9 #end
10 #set ($browseMacrosURL = $xwiki.getURL('XWiki.XWikiPreferences', 'admin', "section=${section}&search=macro&repo="))
11 #else
12 #set ($browseMacrosURL = 'http://extensions.xwiki.org/xwiki/bin/view/Extension/#%7Ct=extensions&p=1&l=30&s=doc.creationDate&d=desc&category=macro')
13 #end
14
15 #set ($actionCards = [{
16 'title': 'Use Macros',
17 'description': 'Macros are reusable pieces of functionality that can be integrated inside pages.',
18 'tip': "The <a href=""http://extensions.xwiki.org/xwiki/bin/view/Extension/CKEditor+Integration"" class=""wikiexternallink"">WYSIWYG Editor</a> allows you to insert macros and to customize their parameters when editing pages. Look for the $services.icon.renderHTML('cog') button on the tool bar.",
19 'thumbnail': 'Macro',
20 'actions': [{
21 'label': 'Try it!',
22 'type': 'success',
23 'url': $xwiki.getURL('Sandbox.TestPage1', 'edit', 'editor=wysiwyg')
24 }]
25 }, {
26 'title': 'Browse Macros',
27 'description': 'Choose from community contributed macros and install them inside your wiki.',
28 'tip': "The <a href=""$xwiki.getURL('XWiki.WikiMacros')"">Macro Index</a> lists the macros that are already installed and ready to be used inside your pages.",
29 'thumbnail': 'EM',
30 'actions': [{
31 'label': 'Browse',
32 'url': $browseMacrosURL
33 }, {
34 'label': 'Learn more',
35 'url': 'http://platform.xwiki.org/xwiki/bin/view/DevGuide/WikiMacroTutorial'
36 }]
37 }])
38
39 #set ($exampleCards = [{
40 'title': 'Box',
41 'description': 'Displays a message in a styled box.',
42 'documentation': 'http://extensions.xwiki.org/xwiki/bin/view/Extension/Box+Macro',
43 'examples': 'Help.Macros.Box.WebHome',
44 'thumbnail': 'Help.Macros.Box.WebHome@box.png'
45 }, {
46 'title': 'Table of Contents',
47 'description': 'Generates a table of contents for the page headings.',
48 'documentation': 'http://extensions.xwiki.org/xwiki/bin/view/Extension/TOC+Macro',
49 'examples': 'Help.Macros.ToC.WebHome',
50 'thumbnail': 'Help.Macros.ToC.WebHome@toc.png'
51 }, {
52 'title': 'Gallery',
53 'description': 'Displays a list of images in a slide-show gallery.',
54 'documentation': 'http://extensions.xwiki.org/xwiki/bin/view/Extension/Gallery+Macro',
55 'examples': 'Help.Macros.Gallery.WebHome',
56 'thumbnail': 'Help.Macros.Gallery.WebHome@gallery.png'
57 }, {
58 'title': 'Chart',
59 'description': 'Generates graphical charts from data sources.',
60 'documentation': 'http://extensions.xwiki.org/xwiki/bin/view/Extension/Chart+Macro',
61 'examples': 'Help.Macros.Chart.WebHome',
62 'thumbnail': 'Help.Macros.Chart.WebHome@chart.png'
63 }, {
64 'title': 'Page Tree',
65 'description': 'Displays the hierarchy of pages.',
66 'documentation': 'http://extensions.xwiki.org/xwiki/bin/view/Extension/Document+Tree+Macro',
67 'examples': 'Help.Macros.Tree.WebHome',
68 'thumbnail': 'Help.Macros.Tree.WebHome@tree.png'
69 }, {
70 'title': 'Activity',
71 'description': 'Displays recent activities done on pages by the users.',
72 'documentation': 'http://extensions.xwiki.org/xwiki/bin/view/Extension/Activity+Macro',
73 'examples': 'Help.Macros.Activity.WebHome',
74 'thumbnail': 'Help.Macros.Activity.WebHome@activity.png'
75 }])
76 {{/velocity}}
77
78 {{velocity}}
79 {{html clean="false"}}
80 <div class="row">
81 #foreach ($card in $actionCards)
82 ## See http://getbootstrap.com/css/#grid-responsive-resets .
83 #if ($foreach.index > 0 && $foreach.index % 2 == 0)
84 <div class="clearfix visible-sm-block visible-md-block visible-lg-block"></div>
85 #end
86 <div class="col-xs-12 col-sm-6">
87 #helpActionCard($card)
88 </div>
89 #end
90 </div>
91 <h3 id="HExamples">Examples</h3>
92 <p>Need help or confused with some of our macros? Check out their documentation and find out more about their functionality.</p>
93 <div class="row">
94 #foreach ($card in $exampleCards)
95 ## See http://getbootstrap.com/css/#grid-responsive-resets .
96 #if ($foreach.index > 0 && $foreach.index % 2 == 0)
97 <div class="clearfix visible-sm-block "></div>
98 #end
99 #if ($foreach.index > 0 && $foreach.index % 3 == 0)
100 <div class="clearfix visible-md-block visible-lg-block"></div>
101 #end
102 <div class="col-xs-12 col-sm-6 col-md-4">
103 #helpExampleCard($card)
104 </div>
105 #end
106 </div>
107 <p><a href="http://extensions.xwiki.org/xwiki/bin/view/Main/#%7Ct=extensions&p=1&l=30&s=doc.creationDate&d=desc&category=macro" class="wikiexternallink">View more macros</a></p>
108 {{/html}}
109 {{/velocity}}