-
Notifications
You must be signed in to change notification settings - Fork 0
/
HelpOnMacros.html
719 lines (692 loc) · 68.3 KB
/
HelpOnMacros.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<!-- Mirrored from ffii.org/HelpOnMacros by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 05 Feb 2019 09:46:01 GMT -->
<!-- Added by HTTrack --><meta http-equiv="content-type" content="text/html;charset=utf-8" /><!-- /Added by HTTrack -->
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="robots" content="index,nofollow">
<title>HelpOnMacros - FFII</title>
<script type="text/javascript" src="https://ffii.org/static/common/js/common.js"></script>
<script type="text/javascript">
<!--
var search_hint = "Search";
//-->
</script>
<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="https://ffii.org/static/sinorca4moin/css/common.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="screen" href="https://ffii.org/static/sinorca4moin/css/screen.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="print" href="https://ffii.org/static/sinorca4moin/css/print.css">
<link rel="stylesheet" type="text/css" charset="utf-8" media="projection" href="https://ffii.org/static/sinorca4moin/css/projection.css">
<!-- css only for MS IE6/IE7 browsers -->
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="/static/sinorca4moin/css/msie.css">
<![endif]-->
<link rel="Start" href="https://ffii.org/Home">
<link rel="Alternate" title="Wiki Markup" href="https://ffii.org/HelpOnMacros?action=raw">
<link rel="Alternate" media="print" title="Print View" href="https://ffii.org/HelpOnMacros?action=print">
<link rel="Search" href="https://ffii.org/FindPage">
<link rel="Index" href="https://ffii.org/TitleIndex">
<link rel="Glossary" href="https://ffii.org/WordIndex">
<link rel="Help" href="https://ffii.org/HelpOnFormatting">
</head>
<body lang="en" dir="ltr">
<div id="header">
<div class="superHeader">
<div class="right">
<ul id="username"><li><a href="https://ffii.org/HelpOnMacros?action=login" id="login" rel="nofollow">Login</a></li></ul>
</div>
</div>
<form id="searchform" method="get" action="https://ffii.org/HelpOnMacros">
<div>
<input type="hidden" name="action" value="fullsearch">
<input type="hidden" name="context" value="180">
<label for="searchinput">Search:</label>
<input id="searchinput" type="text" name="value" value="" size="20"
onfocus="searchFocus(this)" onblur="searchBlur(this)"
onkeyup="searchChange(this)" onchange="searchChange(this)" alt="Search">
<input id="titlesearch" name="titlesearch" type="submit"
value="Titles" alt="Search Titles">
<input id="fullsearch" name="fullsearch" type="submit"
value="Text" alt="Search Full Text">
</div>
</form>
<script type="text/javascript">
<!--// Initialize search form
var f = document.getElementById('searchform');
f.getElementsByTagName('label')[0].style.display = 'none';
var e = document.getElementById('searchinput');
searchChange(e);
searchBlur(e);
//-->
</script>
<div class="midHeader">
<div id="locationline">
<div id="logo"><a href="https://ffii.org/Home"><img src="https://www.ffii.org/img/ffii-logos/ffii-logo-transparent.gif" width="85" height="98" alt="FFII logo"></a></div>
<a href="https://ffii.org/Home">FFII</a>
</div>
</div>
<div class="subHeader">
<b> <a href="https://www.ffii.org/">FFII</a> | <a href="https://action.ffii.org/">Action groups</a> | <a href="https://press.ffii.org/">Press releases</a> | <a href="http://www.ffii.fr/">FFII.fr</a> | <a href="http://www.ffii.de/">FFII.de</a> | <a href="http://www.ffii.se/">FFII.se</a> | <a href="http://www.ffii.org.uk/">FFII.org.uk</a> </b>
</div>
</div>
<div id="sidebar">
<div class="sidepanel">
<h1>Get Involved</h1>
<ul class="editbar">
<li class="wikilink"><a href="http://twitter.com/ffii/">Follow us on Twitter</a></li>
<li class="wikilink"><a href="http://blog.ffii.org/">Our Blog</a></li>
<li class="wikilink"><a href="https://ffii.org/Donations">Donate to FFII</a></li>
<li class="wikilink"><a href="http://members.ffii.org/register/">Become a member</a></li>
</ul>
<h1>Software Patents</h1>
<ul class="editbar">
<li class="wikilink"><a href="https://ffii.org/Frequently_Asked_Questions_about_software_patents">FAQ</a></li>
<li class="wikilink"><a href="http://webshop.ffii.org/">Patented Webshop</a></li>
</ul>
<h1>Mailing Lists</h1>
<ul class="editbar">
<li class="wikilink"><a href="http://lists.ffii.org/mailman/listinfo/softwarepatents">Software-Patents</a></li>
<li class="wikilink"><a href="http://lists.ffii.org/mailman/listinfo/openstandards/">Open Standards</a></li>
<li class="wikilink"><a href="http://lists.ffii.org/mailman/listinfo/floss/">Free & Open Source</a></li>
<li class="wikilink"><a href="http://lists.ffii.org/mailman/listinfo/netreg/">Open Networks</a></li>
<li class="wikilink"><a href="https://ffii.org/https://lists.ffii.org/mailman/listinfo/volunteers">Volunteers</a></li>
<li class="wikilink"><a href="http://lists.ffii.org/">More Lists</a></li>
</ul>
<h1>Association</h1>
<ul class="editbar">
<li class="wikilink"><a href="https://ffii.org/Mission">Mission</a></li>
<li class="wikilink"><a href="https://ffii.org/National_chapters">European chapters</a></li>
<li class="wikilink"><a href="http://blog.ffii.org/tag/press/">Press Releases</a></li>
<li class="wikilink"><a href="https://ffii.org/Contact">Contact Office</a></li>
</ul>
</div>
</div>
<div id="page" lang="en" dir="ltr">
<h1 id="title">HelpOnMacros</h1>
<div dir="ltr" id="content" lang="en"><span class="anchor" id="top"></span>
<span class="anchor" id="line-8"></span><p class="line867"><table class="navigation"><tr><td><a href="https://ffii.org/HelpOnMacros/EmbedObject">/EmbedObject</a> <a href="https://ffii.org/HelpOnMacros/ImageLink">/ImageLink</a> <a href="https://ffii.org/HelpOnMacros/Include">/Include</a> <a href="https://ffii.org/HelpOnMacros/MailTo">/MailTo</a> <a href="https://ffii.org/HelpOnMacros/MonthCalendar">/MonthCalendar</a> </td></tr></table> <span class="anchor" id="line-9"></span><br>
<br>
<span class="anchor" id="line-10"></span><div class="table-of-contents"><p class="table-of-contents-heading">Contents<ol><li>
<a href="#Macros">Macros</a><ol><li>
<a href="#Search_macros">Search macros</a></li><li>
<a href="#Navigation">Navigation</a></li><li>
<a href="#System_information">System information</a></li><li>
<a href="#Others">Others</a></li></ol></li><li>
<a href="#Writing_your_own_macro">Writing your own macro</a><ol><li>
<a href="#Macro_arguments">Macro arguments</a><ol><li>
<a href="#default_values">default values</a></li><li>
<a href="#unit_arguments">unit arguments</a></li><li>
<a href="#choices">choices</a></li><li>
<a href="#required_arguments">required arguments</a></li><li>
<a href="#keyword_arguments">keyword arguments</a></li><li>
<a href="#trailing_arguments">trailing arguments</a></li></ol></li></ol></li></ol></li></ol></div> <span class="anchor" id="line-11"></span><span class="anchor" id="line-12"></span><p class="line867">
<h2 id="Macros">Macros</h2>
<span class="anchor" id="line-13"></span><p class="line862">Macros allow the insertion of system features into normal wiki pages; the only thing that makes those pages special is that they contain macros. If you edit pages like <a href="https://ffii.org/RecentChanges">RecentChanges</a> or <a href="https://ffii.org/SystemInfo">SystemInfo</a>, you'll see what that means. <span class="anchor" id="line-14"></span><span class="anchor" id="line-15"></span><p class="line862">For more information on the possible markup, see <a href="https://ffii.org/HelpOnEditing">HelpOnEditing</a> and <a href="https://ffii.org/HelpOnMoinWikiSyntax">HelpOnMoinWikiSyntax</a>. <span class="anchor" id="line-16"></span><span class="anchor" id="line-17"></span><p class="line867">
<h3 id="Search_macros">Search macros</h3>
<span class="anchor" id="line-18"></span><p class="line867"><a href="https://ffii.org/MoinMoin">MoinMoin</a> now uses a new search engine, that lets your make sophisticated searches using both the interactive search box or any of the search macros. For more help, see <a href="https://ffii.org/HelpOnSearching">HelpOnSearching</a>. <span class="anchor" id="line-19"></span><div><table><tbody><tr> <td colspan="3" style="text-align: center"><p class="line891"><strong>Macro</strong> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-20"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> <strong>Description</strong> </td>
<td><p class="line891"><strong>Example</strong> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-21"></span><p class="line891"><tt><<AdvancedSearch>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-22"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> create an advanced search dialogue on the page </td>
<td><p class="line862"> See <a href="https://ffii.org/FindPage">FindPage</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-23"></span><p class="line891"><tt><<TitleSearch>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-24"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> create a search box on the page, which search the page titles </td>
<td><p class="line862"> See <a href="https://ffii.org/FindPage">FindPage</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-25"></span><p class="line891"><tt><<FullSearch>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-26"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> create a search box on the page, which search the page contents </td>
<td><p class="line862"> See <a href="https://ffii.org/FindPage">FindPage</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-27"></span><p class="line891"><tt><<FullSearch()>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-28"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> print a list of pages whose content matches the current page title (like clicking on the page title) </td>
<td><p class="line862"> See the <a href="https://ffii.org/CategoryCategory">CategoryCategory</a> page </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-29"></span><p class="line891"><tt><<FullSearch(text)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-30"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> print a list of pages whose content matches the search term </td>
<td><p class="line862"> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-31"></span><p class="line891"><tt><<FullSearchCached(text)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-32"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> Works like the <tt>FullSearch</tt> macro but caches the results statically. Use it if you prefer speed over an up-to-date result </td>
<td><p class="line862"> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-33"></span><p class="line891"><tt><<GoTo>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-34"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> directly go to the page you enter </td>
<td><p class="line862"> See the <a href="https://ffii.org/FindPage">FindPage</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-35"></span><p class="line891"><tt><<PageList(Help)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-36"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> print a list of pages whose title matches the search term </td>
<td><p class="line862"> See the <a href="https://ffii.org/HelpIndex">HelpIndex</a> </td>
</tr>
</tbody></table></div><span class="anchor" id="line-37"></span><span class="anchor" id="line-38"></span><span class="anchor" id="line-39"></span><p class="line867">
<h3 id="Navigation">Navigation</h3>
<span class="anchor" id="line-40"></span><div><table><tbody><tr> <td colspan="3" style="text-align: center"><p class="line891"><strong>Macro</strong> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-41"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> <strong>Description</strong> </td>
<td><p class="line891"><strong>Example</strong> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-42"></span><p class="line891"><tt><<RecentChanges>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-43"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> a list of recently edited pages </td>
<td><p class="line862"> See <a href="https://ffii.org/RecentChanges">RecentChanges</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-44"></span><p class="line891"><tt><<TitleIndex>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-45"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> an index of all page titles </td>
<td><p class="line862"> See <a href="https://ffii.org/TitleIndex">TitleIndex</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-46"></span><p class="line891"><tt><<WordIndex>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-47"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> an index of all words in page titles </td>
<td><p class="line862"> See <a href="https://ffii.org/WordIndex">WordIndex</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-48"></span><p class="line891"><tt><<WantedPages>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-49"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> list links to non-existent pages </td>
<td><p class="line862"> See <a href="https://ffii.org/WantedPages">WantedPages</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-50"></span><p class="line891"><tt><<OrphanedPages>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-51"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> list pages no other page links to </td>
<td><p class="line862"> See <a href="https://ffii.org/OrphanedPages">OrphanedPages</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-52"></span><p class="line891"><tt><<AbandonedPages>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-53"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> list pages that were not edited for the longest time </td>
<td><p class="line862"> See <a href="https://ffii.org/AbandonedPages">AbandonedPages</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-54"></span><p class="line891"><tt><<RandomPage>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-55"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> a link to a random page </td>
<td><p class="line862"> <tt><<RandomPage>></tt> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-56"></span><p class="line891"><tt><<RandomPage(#)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-57"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> links to a number of random pages </td>
<td><p class="line862"> Two random pages: <tt><<RandomPage(2)>></tt> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-58"></span><p class="line891"><tt><<TableOfContents([maxdepth])>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-59"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> display a local table of contents, possibly limited to a maximal depth </td>
<td><p class="line862"> See above </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-60"></span><p class="line891"><tt><<Anchor(anchorname)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-61"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> macro to insert anchors into a page </td>
<td><p class="line862"> <span class="anchor" id="here"></span>#here </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-62"></span><p class="line891"><tt><<Navigation(children[,maxdepth])>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-63"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> macro to list all of a pages' children </td>
<td><p class="line862"> See start of this page </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-64"></span><p class="line891"><tt><<Navigation(siblings[,maxdepth])>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-65"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> quick navigation to siblings of a page </td>
<td><p class="line862"> See <a href="https://ffii.org/HelpOnMacros/MailTo">/MailTo</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-66"></span><p class="line891"><tt><<Navigation(slideshow)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-67"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> creates a link to toggle between slide show and wiki mode, and a link to start the slide show </td>
<td><p class="line862"> See <a href="https://ffii.org/HelpOnSlideShows">HelpOnSlideShows</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-68"></span><p class="line891"><tt><<Navigation(slides)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-69"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> displays first/prev/next/last links </td>
<td><p class="line862"> See <a href="https://ffii.org/HelpOnSlideShows">HelpOnSlideShows</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-70"></span><p class="line891"><tt><<AttachInfo>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-71"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> displays number of attachments for current page </td>
<td><p class="line862"> See <a href="https://ffii.org/HelpOnActions/AttachFile">HelpOnActions/AttachFile</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-72"></span><p class="line891"><tt><<AttachInfo(page)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-73"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> displays number of attachments for page </td>
<td><p class="line862"> See <a href="https://ffii.org/HelpOnActions/AttachFile">HelpOnActions/AttachFile</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-74"></span><p class="line891"><tt><<AttachList(pagename,mimetype)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-75"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> displays list of attachments </td>
<td><p class="line862"> See <a href="https://ffii.org/HelpOnActions/AttachFile">HelpOnActions/AttachFile</a> </td>
</tr>
</tbody></table></div><span class="anchor" id="line-76"></span><span class="anchor" id="line-77"></span><p class="line867">
<h3 id="System_information">System information</h3>
<span class="anchor" id="line-78"></span><div><table><tbody><tr> <td colspan="3" style="text-align: center"><p class="line891"><strong>Macro</strong> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-79"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> <strong>Description</strong> </td>
<td><p class="line891"><strong>Example</strong> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-80"></span><p class="line891"><tt><<Hits>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-81"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> a counter for page hits <tt><<Hits([all=(False,True)][,event_type=(VIEWPAGE,SAVEPAGE)]>></tt></td>
<td><p class="line862"> 7021 </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-82"></span><p class="line891"><tt><<InterWiki>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-83"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> a list of all known <a href="https://ffii.org/InterWiki">InterWiki</a> names </td>
<td><p class="line862"> <a href="https://ffii.org/InterWiki">InterWiki</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-84"></span><p class="line891"><tt><<SystemInfo>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-85"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> info on the wiki, the python interpreter and the host system </td>
<td><p class="line862"> <a href="https://ffii.org/SystemInfo">SystemInfo</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-86"></span><p class="line891"><tt><<PageCount(exists)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-87"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> current page count. If <tt>exists</tt> is supplied as an argument, only existing pages will be shown. </td>
<td><p class="line862"> <tt><<PageCount>> pages</tt> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-88"></span><p class="line891"><tt><<PageSize>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-89"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> list the sizes of all pages </td>
<td><p class="line862"> See <a href="https://ffii.org/PageSize">PageSize</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-90"></span><p class="line891"><tt><<StatsChart(type)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-91"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> shows statistical charts (currently defined types: hitcounts, pagesize, useragents, languages) </td>
<td><p class="line862"> See <a href="https://ffii.org/EventStats">EventStats</a> and subpages </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-92"></span><p class="line891"><tt><<SystemAdmin>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-93"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> Information for system administrators </td>
<td><p class="line862"> You need to be superuser to use this macro <br>
<tt><<SystemAdmin>></tt> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-94"></span><p class="line891"><tt><<EditedSystemPages>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-95"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> A list of system pages that were modified </td>
<td><p class="line862"> <tt><<EditedSystemPages>></tt> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-96"></span><p class="line891"><tt><<WikiConfig>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-97"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> Shows wiki configuration settings which are either non-default or unknown.</td>
<td><p class="line862">You need to be superuser to use this macro <br>
<tt><<WikiConfig>></tt> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-98"></span><p class="line891"><tt><<WikiConfigHelp>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-99"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> Shows all wiki configuration settings with descriptions </td>
<td><p class="line862"> <tt><<WikiConfigHelp>></tt> </td>
</tr>
</tbody></table></div><span class="anchor" id="line-100"></span><p class="line867">
<h3 id="Others">Others</h3>
<span class="anchor" id="line-101"></span><div><table><tbody><tr> <td colspan="3" style="text-align: center"><p class="line891"><strong>Macro</strong> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-102"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> <strong>Description</strong> </td>
<td><p class="line891"><strong>Example</strong> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-103"></span><p class="line891"><tt><<Action(action [,text])>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-104"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862">links to page with valid action, optional text could be used as alias. (action names are case sensitive)</td>
<td><p class="line862"> e.g. <tt class="backtick"><<Action(print, Print this page)>></tt>, <a href="https://ffii.org/HelpOnMacros?action=print">Print this page</a></td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-105"></span><p class="line891"><tt><<Icon(image)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-106"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862">display system icons </td>
<td><p class="line862"> See <a href="https://ffii.org/HelpOnNavigation">HelpOnNavigation</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-107"></span><p class="line891"><tt><<BR>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-108"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> insert a line break </td>
<td><p class="line862"> 1st line<br>
2nd line </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-109"></span><p class="line891"><tt><<RandomQuote(pagename)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-110"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> Select a random quote from the given page, or from <tt>FortuneCookies</tt> if omitted </td>
<td><p class="line862"> <tt><<RandomQuote>></tt> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-111"></span><p class="line891"><tt><<Include(HelloWorld[,"heading"[,level]])>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-112"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> include contents of another page </td>
<td><p class="line862"> for details see <a href="https://ffii.org/HelpOnMacros/Include">/Include</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-113"></span><p class="line891"><tt><<FootNote(text)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-114"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> Add a footnote<sup><a href="#fnref-20f25675be2608a0416555faab22516d2d9a84d2" id="fndef-20f25675be2608a0416555faab22516d2d9a84d2-0">1</a></sup>, or explicitly display collected footnotes when no args are given </td>
<td><p class="line862"> See below for an example. </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-115"></span><p class="line891"><tt><<Date(timestamp)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-116"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> display a timestamp according to system settings </td>
<td><p class="line862"> 2019-02-05 </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-117"></span><p class="line891"><tt><<DateTime(timestamp)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-118"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> display a timestamp<sup><a href="#fnref-4e2be9fcccab96fc091ee101f59fc48f969086bb" id="fndef-4e2be9fcccab96fc091ee101f59fc48f969086bb-1">2</a></sup> according to user settings </td>
<td><p class="line862"> 2019-02-05 10:45:57 </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-119"></span><p class="line891"><tt><<GetText(text)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-120"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> loads I18N texts (mainly intended for use on Help pages) </td>
<td><p class="line862"> "Edit<tt class="backtick"></tt>Text" is translated to "EditText" </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-121"></span><p class="line891"><tt><<GetText2(,message,argument1,argument2,...)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-122"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> loads I18N texts (mainly intended for use on Help pages or in generated output on wiki pages) and replaces <tt class="backtick">%s</tt> in the message by the arguments. The first character of the argument is used as the separator (in this example: a comma). You can escape the separator by using a backslash. </td>
<td><p class="line862"> "<tt class="backtick"><<GetText2(,[You may not read %s],FooBar)>></tt>" yields "[You may not read FooBar]" </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-123"></span><p class="line891"><tt><<TeudView>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-124"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> useful for intranet developer wikis, a means to view pydoc documentation, formatted via a XSLT stylesheet </td>
<td><p class="line862"> See <a class="http" href="http://twistedmatrix.com/wiki/python/TeudProject">http://twistedmatrix.com/wiki/python/TeudProject</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-125"></span><p class="line891"><tt><<MailTo(email)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-126"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> protect your email address from spam bots </td>
<td><p class="line862"> for details see <a href="https://ffii.org/HelpOnMacros/MailTo">/MailTo</a> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-127"></span><p class="line891"><tt><<NewPage(PageTemplate,ButtonLabel,[ParentPage,@ME,@SELF] [,NameTemplate])>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-128"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> Allow the user to create (sub-) pages easily, using the page <tt>PageTemplate</tt>as the template for the new page and the string <tt>NameTemplate</tt> as a template for the name.<sup><a href="#fnref-381bfa3b6ca655a70a38ce8bea2d77e8ab6ca15c" id="fndef-381bfa3b6ca655a70a38ce8bea2d77e8ab6ca15c-2">3</a></sup> <tt class="backtick">@ME</tt> is used if you want the page created below the users homepage. <tt class="backtick">@SELF</tt> is used to create a subpage below the page where it is called from. </td>
<td><p class="line862"> <form class="macro" method="POST" action="https://ffii.org/HelpOnMacros"><div>
<input type="hidden" name="action" value="newpage">
<input type="hidden" name="parent" value="">
<input type="hidden" name="template" value="CategoryTemplate">
<input type="hidden" name="nametemplate" value="Category%s">
<input type="text" name="pagename" size="30">
<input type="submit" value="Create new category">
</div></form> </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-129"></span><p class="line891"><tt><<GetVal(NeatSnippets,regards)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-130"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> Retrieve dictionary entries from dict pages. </td>
<td><p class="line862"> If you have a page called <a class="nonexistent" href="https://ffii.org/GermanDict">GermanDict</a> which contains the entry <em>Test</em>, you should see the translation here: </td>
</tr>
<tr> <td colspan="3" style="text-align: center"><span class="anchor" id="line-131"></span><p class="line891"><tt><<MonthCalendar(,,12)>></tt> </td>
</tr>
<tr> <td style="width: 5%"><span class="anchor" id="line-132"></span><p class="line891"><br>
</td>
<td style="margin: 10px; vertical-align: top; ; width: 75%"><p class="line862"> Displays a Calendar and creates link for entries to each day on subpages </td>
<td><p class="line862"> See <a href="https://ffii.org/HelpOnMacros/MonthCalendar">/MonthCalendar</a> </td>
</tr>
</tbody></table></div><span class="anchor" id="line-133"></span><span class="anchor" id="line-134"></span><p class="line867"><div class="footnotes"><ol><li><p><a id="fnref-20f25675be2608a0416555faab22516d2d9a84d2"></a><span class="anchor" id="line-1"></span>the text cannot contain any wiki markup (<a href="#fndef-20f25675be2608a0416555faab22516d2d9a84d2-0">1</a>)</li><li><p><a id="fnref-4e2be9fcccab96fc091ee101f59fc48f969086bb"></a><span class="anchor" id="line-1-1"></span>"timestamp" can be empty (current time), a number of seconds since 1970 (unix timestamp), or a W3C time specification ("2002-01-23T12:34:56"). See RFC822, sect. 5. (<a href="#fndef-4e2be9fcccab96fc091ee101f59fc48f969086bb-1">2</a>)</li><li><p><a id="fnref-381bfa3b6ca655a70a38ce8bea2d77e8ab6ca15c"></a><span class="anchor" id="line-1-2"></span><tt class="backtick">NameTemplate</tt> is formatted with <tt class="backtick">time.strftime()</tt>, with the exception of <tt class="backtick">%s</tt> which is replaced by the input into the edit box (which is only shown if necessary). If <tt class="backtick">NameTemplate</tt> is not specified or empty, it defaults to <tt class="backtick">%s</tt>. (<a href="#fndef-381bfa3b6ca655a70a38ce8bea2d77e8ab6ca15c-2">3</a>)</li></ol></div> <span class="anchor" id="line-135"></span><span class="anchor" id="line-136"></span><p class="line867">
<h2 id="Writing_your_own_macro">Writing your own macro</h2>
<span class="anchor" id="line-137"></span><p class="line862">Create a python file called <tt>MacroName.py</tt> located in your <tt>data/plugin/macro</tt> directory. Ensure it has a single function called <tt>macro_MacroName(macro, arg1, arg2, ...)</tt>, which is the entry-point. <span class="anchor" id="line-138"></span><span class="anchor" id="line-139"></span><ul><li><p class="line862">the first argument <em>macro</em> is an instance of class Macro, and also evaluates to a string of the macroname, <span class="anchor" id="line-140"></span></li><li>arguments arg1, arg2, ... are the arguments given by the user, but special rules apply, see below. <span class="anchor" id="line-141"></span><span class="anchor" id="line-142"></span></li></ul><p class="line862">You can access the <tt class="backtick">request</tt> object by using <tt class="backtick">macro.request</tt> - e.g. to access form parameters and other information related to user interaction. <span class="anchor" id="line-143"></span><span class="anchor" id="line-144"></span><p class="line862">Your function should use the formatter to construct valid markup for the current target format. In most cases this is HTML, so writing a macro which returns HTML will work in most cases but fail when formats like XML or <tt>text/plain</tt> are requested - you can use <tt class="backtick">macro.formatter</tt> to access the current formatter. <span class="anchor" id="line-145"></span><span class="anchor" id="line-146"></span><p class="line874">For example, your wiki page has the following line on it: <span class="anchor" id="line-147"></span><span class="anchor" id="line-148"></span><p class="line867"><span class="anchor" id="line-149"></span><span class="anchor" id="line-150"></span><pre><<MacroName(True, 1.7772, 17)>></pre><span class="anchor" id="line-151"></span><span class="anchor" id="line-152"></span><p class="line862">You could write a MacroName.py file like this: <span class="anchor" id="line-153"></span><span class="anchor" id="line-154"></span><p class="line867"><span class="anchor" id="line-155"></span><span class="anchor" id="line-156"></span><span class="anchor" id="line-157"></span><span class="anchor" id="line-158"></span><span class="anchor" id="line-159"></span><span class="anchor" id="line-160"></span><span class="anchor" id="line-161"></span><span class="anchor" id="line-162"></span><span class="anchor" id="line-163"></span><span class="anchor" id="line-164"></span><span class="anchor" id="line-165"></span><span class="anchor" id="line-166"></span><span class="anchor" id="line-167"></span><span class="anchor" id="line-168"></span><span class="anchor" id="line-169"></span><span class="anchor" id="line-170"></span><div class="codearea" dir="ltr" lang="en">
<script type="text/javascript">
function isnumbered(obj) {
return obj.childNodes.length && obj.firstChild.childNodes.length && obj.firstChild.firstChild.className == 'LineNumber';
}
function nformat(num,chrs,add) {
var nlen = Math.max(0,chrs-(''+num).length), res = '';
while (nlen>0) { res += ' '; nlen-- }
return res+num+add;
}
function addnumber(did, nstart, nstep) {
var c = document.getElementById(did), l = c.firstChild, n = 1;
if (!isnumbered(c))
if (typeof nstart == 'undefined') nstart = 1;
if (typeof nstep == 'undefined') nstep = 1;
n = nstart;
while (l != null) {
if (l.tagName == 'SPAN') {
var s = document.createElement('SPAN');
s.className = 'LineNumber'
s.appendChild(document.createTextNode(nformat(n,4,' ')));
n += nstep;
if (l.childNodes.length)
l.insertBefore(s, l.firstChild)
else
l.appendChild(s)
}
l = l.nextSibling;
}
return false;
}
function remnumber(did) {
var c = document.getElementById(did), l = c.firstChild;
if (isnumbered(c))
while (l != null) {
if (l.tagName == 'SPAN' && l.firstChild.className == 'LineNumber') l.removeChild(l.firstChild);
l = l.nextSibling;
}
return false;
}
function togglenumber(did, nstart, nstep) {
var c = document.getElementById(did);
if (isnumbered(c)) {
remnumber(did);
} else {
addnumber(did,nstart,nstep);
}
return false;
}
</script>
<script type="text/javascript">
document.write('<a href="#" onclick="return togglenumber(\'CA-873219315b67c57944e521f2e994e21875f089c5\', 1, 1);" \
class="codenumbers">Toggle line numbers<\/a>');
</script>
<pre dir="ltr" id="CA-873219315b67c57944e521f2e994e21875f089c5" lang="en"><span class="line"><span class="LineNumber"> 1 </span><span class="ResWord">from</span> <span class="ID">MoinMoin</span><span class="Operator">.</span><span class="ID">wikiutil</span> <span class="ResWord">import</span> <span class="ID">get_unicode</span><span class="Operator">,</span> <span class="ID">get_bool</span><span class="Operator">,</span> <span class="ID">get_int</span><span class="Operator">,</span> <span class="ID">get_float</span></span>
<span class="line"><span class="LineNumber"> 2 </span></span>
<span class="line"><span class="LineNumber"> 3 </span><span class="ID">Dependencies</span> <span class="Operator">=</span> <span class="Operator">[</span><span class="Operator">]</span></span>
<span class="line"><span class="LineNumber"> 4 </span><span class="ID">generates_headings</span> <span class="Operator">=</span> <span class="ID">False</span></span>
<span class="line"><span class="LineNumber"> 5 </span></span>
<span class="line"><span class="LineNumber"> 6 </span><span class="ResWord">def</span> <span class="ID">macro_MacroName</span><span class="Operator">(</span><span class="ID">macro</span><span class="Operator">,</span> <span class="ID">arg1</span><span class="Operator">,</span> <span class="ID">arg2</span><span class="Operator">,</span> <span class="ID">arg3</span><span class="Operator">=</span><span class="Number">7</span><span class="Operator">)</span><span class="Operator">:</span></span>
<span class="line"><span class="LineNumber"> 7 </span> <span class="Comment"># arguments passed in can be None or a unicode object</span></span>
<span class="line"><span class="LineNumber"> 8 </span></span>
<span class="line"><span class="LineNumber"> 9 </span> <span class="ID">arg1</span> <span class="Operator">=</span> <span class="ID">get_bool</span><span class="Operator">(</span><span class="ID">macro</span><span class="Operator">.</span><span class="ID">request</span><span class="Operator">,</span> <span class="ID">arg1</span><span class="Operator">)</span></span>
<span class="line"><span class="LineNumber"> 10 </span> <span class="ID">arg2</span> <span class="Operator">=</span> <span class="ID">get_float</span><span class="Operator">(</span><span class="ID">macro</span><span class="Operator">.</span><span class="ID">request</span><span class="Operator">,</span> <span class="ID">arg2</span><span class="Operator">)</span></span>
<span class="line"><span class="LineNumber"> 11 </span> <span class="Comment"># because arg3 has a default of 7, it is always of type int or long</span></span>
<span class="line"><span class="LineNumber"> 12 </span></span>
<span class="line"><span class="LineNumber"> 13 </span> <span class="ResWord">return</span> <span class="ID">macro</span><span class="Operator">.</span><span class="ID">formatter</span><span class="Operator">.</span><span class="ID">text</span><span class="Operator">(</span><span class="String">"arguments are: %s %2.3f %d"</span> <span class="Operator">%</span> <span class="Operator">(</span><span class="ID">arg1</span><span class="Operator">,</span> <span class="ID">arg2</span><span class="Operator">,</span> <span class="ID">arg3</span><span class="Operator">)</span><span class="Operator">)</span><span class="Text"></span></span>
</pre></div><span class="anchor" id="line-171"></span><ul><li style="list-style-type:none"><p class="line891"><img alt="/!\" height="15" src="https://ffii.org/static/sinorca4moin/img/alert.png" title="/!\" width="15" /> Add an entry into <tt>Dependencies</tt> if the output from your macro should not be cached. This is important if the macro output could change from one moment to another, for example if your macro searches in wiki pages which may be being edited by other users, or loads information from an external database whose contents may change. Currently the value of any entry does not matter and may be considered a short description for 'why results from this macro should not be cached', but please look at the entries used in other macros for values which may be suitable. <span class="anchor" id="line-172"></span></li></ul><p class="line867"> <span class="anchor" id="line-173"></span><span class="anchor" id="line-174"></span><p class="line862">If your macro can generate headings (by calling <tt class="backtick">macro.formatter.heading()</tt>) then set <tt class="backtick">generates_headings</tt> to True to allow the <tt class="backtick">TableOfContents</tt> macro to evaluate your macro for headings to take into the table of contents. <span class="anchor" id="line-175"></span><span class="anchor" id="line-176"></span><p class="line867">
<h3 id="Macro_arguments">Macro arguments</h3>
<span class="anchor" id="line-177"></span><p class="line862">The arguments given to your macro are normally passed as unicode instances or <tt class="backtick">None</tt> if the user gave no argument. <span class="anchor" id="line-178"></span><span class="anchor" id="line-179"></span><p class="line874">Consider this example macro: <span class="anchor" id="line-180"></span><span class="anchor" id="line-181"></span><span class="anchor" id="line-182"></span><span class="anchor" id="line-183"></span><span class="anchor" id="line-184"></span><div class="codearea" dir="ltr" lang="en">
<script type="text/javascript">
document.write('<a href="#" onclick="return togglenumber(\'CA-eba3058d2f0a36e300b2205f35a16b8c86eb4bd8\', 1, 1);" \
class="codenumbers">Toggle line numbers<\/a>');
</script>
<pre dir="ltr" id="CA-eba3058d2f0a36e300b2205f35a16b8c86eb4bd8" lang="en"><span class="line"><span class="LineNumber"> 1 </span><span class="ResWord">def</span> <span class="ID">macro_Example</span><span class="Operator">(</span><span class="ID">macro</span><span class="Operator">,</span> <span class="ID">arg1</span><span class="Operator">,</span> <span class="ID">arg2</span><span class="Operator">)</span><span class="Operator">:</span></span>
<span class="line"><span class="LineNumber"> 2 </span> <span class="Operator">.</span><span class="Operator">.</span><span class="Operator">.</span><span class="Text"></span></span>
</pre></div><span class="anchor" id="line-185"></span><span class="anchor" id="line-186"></span><p class="line874">and the wiki code (together with the result) <span class="anchor" id="line-187"></span><span class="anchor" id="line-188"></span><span class="anchor" id="line-189"></span><span class="anchor" id="line-190"></span><span class="anchor" id="line-191"></span><span class="anchor" id="line-192"></span><pre> 1. <<Example()>> - passes None, None
2. <<Example(a,b)>> - passes u'a', u'b'
3. <<Example(,)>> - passes None, None
4. <<Example("",)>> - passes u'', None</pre><span class="anchor" id="line-193"></span><span class="anchor" id="line-194"></span><p class="line867">
<h4 id="default_values">default values</h4>
<span class="anchor" id="line-195"></span><span class="anchor" id="line-196"></span><p class="line874">If your macro declares default values as in this example: <span class="anchor" id="line-197"></span><span class="anchor" id="line-198"></span><span class="anchor" id="line-199"></span><span class="anchor" id="line-200"></span><span class="anchor" id="line-201"></span><div class="codearea" dir="ltr" lang="en">
<script type="text/javascript">
document.write('<a href="#" onclick="return togglenumber(\'CA-0062d6033bf6e797009d8031f1f916b128769b1c\', 1, 1);" \
class="codenumbers">Toggle line numbers<\/a>');
</script>
<pre dir="ltr" id="CA-0062d6033bf6e797009d8031f1f916b128769b1c" lang="en"><span class="line"><span class="LineNumber"> 1 </span><span class="ResWord">def</span> <span class="ID">macro_Example</span><span class="Operator">(</span><span class="ID">macro</span><span class="Operator">,</span> <span class="ID">arg1</span><span class="Operator">=</span><span class="Number">7</span><span class="Operator">,</span> <span class="ID">arg2</span><span class="Operator">=</span><span class="Number">2.1</span><span class="Operator">)</span><span class="Operator">:</span></span>
<span class="line"><span class="LineNumber"> 2 </span> <span class="Operator">.</span><span class="Operator">.</span><span class="Operator">.</span><span class="Text"></span></span>
</pre></div><span class="anchor" id="line-202"></span><span class="anchor" id="line-203"></span><p class="line874">Then the arguments can be skipped or left out and are automatically converted to the type of the default value: <span class="anchor" id="line-204"></span><span class="anchor" id="line-205"></span><p class="line867"><span class="anchor" id="line-206"></span><span class="anchor" id="line-207"></span><span class="anchor" id="line-208"></span><span class="anchor" id="line-209"></span><span class="anchor" id="line-210"></span><pre> 1. <<Example()>> - passes 7, 2.1
2. <<Example(,3)>> - passes 7, 3.0
3. <<Example(2)>> - passes 2, 2.1
4. <<Example(a,7.54)>> - error, "a" not an integer</pre><span class="anchor" id="line-211"></span><span class="anchor" id="line-212"></span><p class="line874">Additionally, it is possible to declare the type you would like to get: <span class="anchor" id="line-213"></span><span class="anchor" id="line-214"></span><span class="anchor" id="line-215"></span><span class="anchor" id="line-216"></span><span class="anchor" id="line-217"></span><pre>def macro_Example(macro, arg1=int, arg2=float):
...</pre><span class="anchor" id="line-218"></span><span class="anchor" id="line-219"></span><p class="line862">This requires that the user enters the correct parameter types, but it is possible to skip over them by giving an empty argument in which case it'll be passed into the macro code as <tt class="backtick">None</tt>: <span class="anchor" id="line-220"></span><span class="anchor" id="line-221"></span><span class="anchor" id="line-222"></span><span class="anchor" id="line-223"></span><span class="anchor" id="line-224"></span><span class="anchor" id="line-225"></span><pre> 1. <<Example()>> - passes None, None
2. <<Example(a, 2.2)>> - error, "a" not an integer
3. <<Example(7, 2.2)>> - passes 7, 2.2
4. <<Example(, 3.14)>> - passes None, 3.14</pre><span class="anchor" id="line-226"></span><p class="line867">
<h4 id="unit_arguments">unit arguments</h4>
<span class="anchor" id="line-227"></span><p class="line874">If your macro declares unitsarguments then units are required as in this example: <span class="anchor" id="line-228"></span><span class="anchor" id="line-229"></span><span class="anchor" id="line-230"></span><span class="anchor" id="line-231"></span><span class="anchor" id="line-232"></span><span class="anchor" id="line-233"></span><span class="anchor" id="line-234"></span><span class="anchor" id="line-235"></span><span class="anchor" id="line-236"></span><span class="anchor" id="line-237"></span><div class="codearea" dir="ltr" lang="en">
<script type="text/javascript">
document.write('<a href="#" onclick="return togglenumber(\'CA-75b855ae5928c03e2c42e2b63652d69f7851ad8c\', 1, 1);" \
class="codenumbers">Toggle line numbers<\/a>');
</script>
<pre dir="ltr" id="CA-75b855ae5928c03e2c42e2b63652d69f7851ad8c" lang="en"><span class="line"><span class="LineNumber"> 1 </span><span class="ResWord">from</span> <span class="ID">MoinMoin</span> <span class="ResWord">import</span> <span class="ID">wikiutil</span></span>
<span class="line"><span class="LineNumber"> 2 </span><span class="ResWord">def</span> <span class="ID">macro_Example</span><span class="Operator">(</span><span class="ID">macro</span><span class="Operator">,</span> <span class="ID">arg1</span><span class="Operator">=</span><span class="ID">wikiutil</span><span class="Operator">.</span><span class="ID">UnitArgument</span><span class="Operator">(</span><span class="ID">None</span><span class="Operator">,</span> <span class="ID">float</span><span class="Operator">,</span> <span class="Operator">[</span><span class="String">'px'</span><span class="Operator">,</span> <span class="String">'%'</span><span class="Operator">]</span><span class="Operator">,</span> <span class="ID">defaultunit</span><span class="Operator">=</span><span class="String">'px'</span><span class="Operator">)</span><span class="Operator">)</span><span class="Operator">:</span></span>
<span class="line"><span class="LineNumber"> 3 </span> <span class="ResWord">if</span> <span class="ID">arg1</span><span class="Operator">:</span></span>
<span class="line"><span class="LineNumber"> 4 </span> <span class="ResWord">if</span> <span class="ID">arg1</span><span class="Operator">[</span><span class="Number">1</span><span class="Operator">]</span> <span class="Operator">==</span> <span class="String">'px'</span><span class="Operator">:</span></span>
<span class="line"><span class="LineNumber"> 5 </span> <span class="ID">arg1</span> <span class="Operator">=</span> <span class="String">'%dpx'</span> <span class="Operator">%</span> <span class="ID">int</span><span class="Operator">(</span><span class="ID">arg1</span><span class="Operator">[</span><span class="Number">0</span><span class="Operator">]</span><span class="Operator">)</span></span>
<span class="line"><span class="LineNumber"> 6 </span> <span class="ResWord">else</span><span class="Operator">:</span></span>
<span class="line"><span class="LineNumber"> 7 </span> <span class="ID">arg1</span> <span class="Operator">=</span> <span class="String">'%g%s'</span> <span class="Operator">%</span> <span class="ID">arg1</span></span>
<span class="line"><span class="LineNumber"> 8 </span> <span class="ResWord">return</span> <span class="ID">macro</span><span class="Operator">.</span><span class="ID">formatter</span><span class="Operator">.</span><span class="ID">text</span><span class="Operator">(</span><span class="String">"argument is: %s"</span> <span class="Operator">%</span> <span class="Operator">(</span><span class="ID">arg1</span><span class="Operator">)</span><span class="Operator">)</span><span class="Text"></span></span>
</pre></div><span class="anchor" id="line-238"></span><p class="line874">The defaultunit of px is used if the user does not enter a unit. He has to enter valid units of px or %. <span class="anchor" id="line-239"></span><span class="anchor" id="line-240"></span><p class="line867"><span class="anchor" id="line-241"></span><span class="anchor" id="line-242"></span><span class="anchor" id="line-243"></span><span class="anchor" id="line-244"></span><span class="anchor" id="line-245"></span><pre> 1. <<Example()>> - argument is: None
2. <<Example(100)>> - argument is: 100px
3. <<Example(100mm)>> - <<Example: Invalid unit in value 100mm (allowed units: px, %)>>
4. <<Example(100px)>> - argument is: 100px</pre><span class="anchor" id="line-246"></span><span class="anchor" id="line-247"></span><p class="line867">
<h4 id="choices">choices</h4>
<span class="anchor" id="line-248"></span><span class="anchor" id="line-249"></span><p class="line874">If your plugin takes one of several choices, you can declare it as such: <span class="anchor" id="line-250"></span><span class="anchor" id="line-251"></span><span class="anchor" id="line-252"></span><span class="anchor" id="line-253"></span><span class="anchor" id="line-254"></span><div class="codearea" dir="ltr" lang="en">
<script type="text/javascript">
document.write('<a href="#" onclick="return togglenumber(\'CA-f4493ecbe53a97c5c4776aa2dd528dcee89f2a10\', 1, 1);" \
class="codenumbers">Toggle line numbers<\/a>');
</script>
<pre dir="ltr" id="CA-f4493ecbe53a97c5c4776aa2dd528dcee89f2a10" lang="en"><span class="line"><span class="LineNumber"> 1 </span><span class="ResWord">def</span> <span class="ID">macro_Example</span><span class="Operator">(</span><span class="ID">macro</span><span class="Operator">,</span> <span class="ID">fruit</span><span class="Operator">=</span><span class="Operator">(</span><span class="String">u'apple'</span><span class="Operator">,</span> <span class="String">u'orange'</span><span class="Operator">)</span><span class="Operator">)</span><span class="Operator">:</span></span>
<span class="line"><span class="LineNumber"> 2 </span> <span class="Operator">.</span><span class="Operator">.</span><span class="Operator">.</span><span class="Text"></span></span>
</pre></div><span class="anchor" id="line-255"></span><span class="anchor" id="line-256"></span><p class="line874">This requires that the user enter any of the given choices and uses the first choice if nothing is entered: <span class="anchor" id="line-257"></span><span class="anchor" id="line-258"></span><span class="anchor" id="line-259"></span><span class="anchor" id="line-260"></span><span class="anchor" id="line-261"></span><pre> 1. <<Example(apple)>> - passes u'apple'
2. <<Example(OrAnGe)>> - error, tells user which choices are valid
3. <<Example()>> - passes u'apple'</pre><span class="anchor" id="line-262"></span><span class="anchor" id="line-263"></span><p class="line867">
<h4 id="required_arguments">required arguments</h4>
<span class="anchor" id="line-264"></span><span class="anchor" id="line-265"></span><p class="line862">If you require some arguments, you can tell the generic code by using the <tt class="backtick">required_arg</tt> class that is instantiated getting the type of the argument: <span class="anchor" id="line-266"></span><span class="anchor" id="line-267"></span><span class="anchor" id="line-268"></span><span class="anchor" id="line-269"></span><span class="anchor" id="line-270"></span><span class="anchor" id="line-271"></span><pre>from MoinMoin.wikiutil import required_arg
def macro_Example(macro, arg1=required_arg(int)):
...</pre><span class="anchor" id="line-272"></span><span class="anchor" id="line-273"></span><p class="line874">This requires that the user enters the argument: <span class="anchor" id="line-274"></span><span class="anchor" id="line-275"></span><span class="anchor" id="line-276"></span><span class="anchor" id="line-277"></span><span class="anchor" id="line-278"></span><pre> 1. <<Example()>> - error, argument "arg1" required
2. <<Example(4.3)>> - error, "4.3" not an integer
3. <<Example(5)>> - passes 5</pre><span class="anchor" id="line-279"></span><span class="anchor" id="line-280"></span><span class="anchor" id="line-281"></span><p class="line867">
<h4 id="keyword_arguments">keyword arguments</h4>
<span class="anchor" id="line-282"></span><p class="line862">If your macro needs to accept arbitrary keyword arguments to pass to something else, it must declare a <tt class="backtick">_kwargs</tt> parameter which should default to the empty dict: <span class="anchor" id="line-283"></span><span class="anchor" id="line-284"></span><span class="anchor" id="line-285"></span><span class="anchor" id="line-286"></span><span class="anchor" id="line-287"></span><div class="codearea" dir="ltr" lang="en">
<script type="text/javascript">
document.write('<a href="#" onclick="return togglenumber(\'CA-fbb155ce88ee837cf48eb73aba3e10089fbe0ff6\', 1, 1);" \
class="codenumbers">Toggle line numbers<\/a>');
</script>
<pre dir="ltr" id="CA-fbb155ce88ee837cf48eb73aba3e10089fbe0ff6" lang="en"><span class="line"><span class="LineNumber"> 1 </span><span class="ResWord">def</span> <span class="ID">macro_Example</span><span class="Operator">(</span><span class="ID">macro</span><span class="Operator">,</span> <span class="ID">_kwargs</span><span class="Operator">=</span><span class="Operator">{</span><span class="Operator">}</span><span class="Operator">)</span><span class="Operator">:</span></span>
<span class="line"><span class="LineNumber"> 2 </span> <span class="Operator">.</span><span class="Operator">.</span><span class="Operator">.</span><span class="Text"></span></span>
</pre></div><span class="anchor" id="line-288"></span><span class="anchor" id="line-289"></span><p class="line874">This makes the user able to pass in anything, even arbitrary unicode strings as key names: <span class="anchor" id="line-290"></span><span class="anchor" id="line-291"></span><span class="anchor" id="line-292"></span><span class="anchor" id="line-293"></span><span class="anchor" id="line-294"></span><span class="anchor" id="line-295"></span><pre> 1. <<Example(äöü=7)>> - passes the dict {u'äöü': u'7'}
2. <<Example(=7)>> - passes the dict {u'': u'7'}
3. <<Example(a=1,"d e"=3)>> - passes the dict {u'a': u'1', u'd e': u'3'}
4. <<Example(a)>> - error, too many (non-keyword) arguments</pre><span class="anchor" id="line-296"></span><span class="anchor" id="line-297"></span><p class="line867">
<h4 id="trailing_arguments">trailing arguments</h4>
<span class="anchor" id="line-298"></span><p class="line874">Trailing arguments allow your macro to take any number of positional arguments, or to be able to handle the syntax of some existing macros that looks like <span class="anchor" id="line-299"></span><span class="anchor" id="line-300"></span><span class="anchor" id="line-301"></span><pre>[[Macro(1, 2, 3, name=value, name2=value2, someflag, anotherflag)]].</pre><span class="anchor" id="line-302"></span><span class="anchor" id="line-303"></span><p class="line862">In order to handle this, declare a <tt class="backtick">_trailing_args</tt> macro parameter which should have a an empty list as the default: <span class="anchor" id="line-304"></span><span class="anchor" id="line-305"></span><span class="anchor" id="line-306"></span><span class="anchor" id="line-307"></span><span class="anchor" id="line-308"></span><div class="codearea" dir="ltr" lang="en">
<script type="text/javascript">
document.write('<a href="#" onclick="return togglenumber(\'CA-b46ec2f69f59baeb71f8c6fc7caee72f9eb3b5a3\', 1, 1);" \
class="codenumbers">Toggle line numbers<\/a>');
</script>
<pre dir="ltr" id="CA-b46ec2f69f59baeb71f8c6fc7caee72f9eb3b5a3" lang="en"><span class="line"><span class="LineNumber"> 1 </span><span class="ResWord">def</span> <span class="ID">macro_Example</span><span class="Operator">(</span><span class="ID">macro</span><span class="Operator">,</span> <span class="ID">i1</span><span class="Operator">,</span> <span class="ID">i2</span><span class="Operator">,</span> <span class="ID">i3</span><span class="Operator">,</span> <span class="ID">name</span><span class="Operator">,</span> <span class="ID">name2</span><span class="Operator">,</span> <span class="ID">_trailing_args</span><span class="Operator">=</span><span class="Operator">[</span><span class="Operator">]</span><span class="Operator">)</span><span class="Operator">:</span></span>
<span class="line"><span class="LineNumber"> 2 </span> <span class="Operator">.</span><span class="Operator">.</span><span class="Operator">.</span><span class="Text"></span></span>
</pre></div><span class="anchor" id="line-309"></span><span class="anchor" id="line-310"></span><p class="line862">Also, when the user gives too many arguments, these are put into <tt class="backtick">_trailing_args</tt> as in the second example: <span class="anchor" id="line-311"></span><span class="anchor" id="line-312"></span><span class="anchor" id="line-313"></span><span class="anchor" id="line-314"></span><pre> 1. <<Example(1, 2, 3, name=test, name2=test2, flag1)>> - valid, passes u'flag1' in _trailing_args
2. <<Example(1, 2, 3, test, test2, flag1)>> - same</pre><span class="anchor" id="line-315"></span><span class="anchor" id="line-316"></span><p class="line862">It is possible to use this feature together with the arbitrary keyword arguments feature <tt class="backtick">_kwargs</tt>. <span class="anchor" id="line-317"></span><span class="anchor" id="bottom"></span></div>
<ul id="iconbar">
<li><a href="https://ffii.org/HelpOnMacros?action=edit" rel="nofollow" title="Edit"><img alt="Edit" height="12" src="https://ffii.org/static/sinorca4moin/img/moin-edit.png" title="Edit" width="12" /></a></li>
<li><a href="https://ffii.org/HelpOnMacros" rel="nofollow" title="View"><img alt="View" height="13" src="https://ffii.org/static/sinorca4moin/img/moin-show.png" title="View" width="12" /></a></li>
<li><a href="https://ffii.org/HelpOnMacros?action=diff" rel="nofollow" title="Diffs"><img alt="Diffs" height="11" src="https://ffii.org/static/sinorca4moin/img/moin-diff.png" title="Diffs" width="15" /></a></li>
<li><a href="https://ffii.org/HelpOnMacros?action=info" rel="nofollow" title="Info"><img alt="Info" height="11" src="https://ffii.org/static/sinorca4moin/img/moin-info.png" title="Info" width="12" /></a></li>
<li><a href="https://ffii.org/HelpOnMacros?action=subscribe" rel="nofollow" title="Subscribe"><img alt="Subscribe" height="10" src="https://ffii.org/static/sinorca4moin/img/moin-subscribe.png" title="Subscribe" width="14" /></a></li>
<li><a href="https://ffii.org/HelpOnMacros?action=raw" rel="nofollow" title="Raw"><img alt="Raw" height="13" src="https://ffii.org/static/sinorca4moin/img/moin-raw.png" title="Raw" width="12" /></a></li>
<li><a href="https://ffii.org/HelpOnMacros?action=print" rel="nofollow" title="Print"><img alt="Print" height="14" src="https://ffii.org/static/sinorca4moin/img/moin-print.png" title="Print" width="16" /></a></li>
</ul>
<div id="pagebottom"></div>
</div>
<div id="footer">
<ul id="credits">
<li><a href="http://moinmo.in/" title="This site uses the MoinMoin Wiki software.">MoinMoin Powered</a></li><li><a href="http://moinmo.in/Python" title="MoinMoin is written in Python.">Python Powered</a></li><li><a href="http://moinmo.in/GPL" title="MoinMoin is GPL licensed.">GPL licensed</a></li><li><a href="http://validator.w3.org/check?uri=referer" title="Click here to validate this page.">Valid HTML 4.01</a></li>
</ul>
</div>
<p id="copyright_notice">Copyright (C) 2000-2015 FFII e.V.</p><p id="hosting_sponsor">Hosting sponsored by <a href="http://www.netgate.de/">Netgate</a> and <a href="http://www.init7.com/">Init Seven AG</a></p></body>
<!-- Mirrored from ffii.org/HelpOnMacros by HTTrack Website Copier/3.x [XR&CO'2014], Tue, 05 Feb 2019 09:46:01 GMT -->
</html>