## Macro syntax in newer versions

Note that MoinMoin versions from 1.6.0 and upward use a new syntax for macro calls:

<<Macro(Arguments)>>

[[Macro(Arguments)]]

## To macro authors

Please put your macros (new & old) on a subpage and attach the macro to the subpage (as many have done already) that is then linked from here. You can use the MacroMarketTemplate when creating subpages. Adding a bit of info about the macro - common usage, known limitations and the like - would be great too. This makes it much easier to alter the structure of this page than it is now with many direct attachments. It would, I think, even allow several references, e.g. from different categories.

I would also encourage authors or users to indicate whether they have used a macro with a version other than that it's advertised for, and if there were issues in doing so.

## Installation instructions

• Make sure, you got the file installed with the correct file name: Of most macros there are different versions available and you might have to delete the version number in the filename: e.g. /MiniPage --> download MiniPage-1.7.1-5.py but install it as MiniPage.py

• The best location for macros is to copy them into the /path_to_wiki_instance/data/plugin/macro directory. This method would be guaranteed to survive MoinMoin and Python upgrades.

Alternatively:

• You can also copy macros into the Python site-packages/MoinMoin/macro directory. The MoinMoin/macro directory is created inside site-packages during the MoinMoin install. Typical default Python site-packages path on Unix/Linux is /usr/lib/pythonX.Y/site-packages. Because you can add paths to the PYTHONPATH environment variable the actual directory could be anywhere.

• Actually, i think that last phrase is not actually true. MoinMoin looks for plugins in two places, the site-packages directory and the wiki's data/ directory. It would be nice to have a third place, but it's not currently the case. -- TheAnarcat 2006-05-30 20:37:53

On Unix/Linux systems you might have to chmod a+r on the *.py file, or better yet set the right owner to the *.py files. In most cases it is the owner of the webserver process.

## Important hints for developers

• The MoinMoin.wikiutil module provides rich functionality for parsing the given args string of a macro: see parseArguments and ParameterParser for that. So there is no need to write your own arg parser in your macro. To build a querystring for calling an action, use makeQueryString.

• Please make sure that via your macro no arbitrary HTML code could be injected into a page which could cause cross-site scripting attacks. Use wikiutil.escape or formatter.escapedText to prevent inserting of malicious code.

• Moin has an output abstraction built in which enables users to output a page not just in HTML but also in DocBook, Word and other office formats. Output abstraction is done via so called "formatters". So please do not return in your macro just  return 'Macro output' but use instead  return macro.formatter.text('Macro output') . To output raw HTML: don't do  return '<q> Your qoute</q>'  please use also the formatter for that nested in a try...except statement:  try: return macro.formatter.rawHTML(wikiutil.escape('<q>Your quote</q>')) except: return macro.formatter.escapedText('Your quote')

• Make sure that your macro also supports others languages, i.e. macro output could be translated with the built-in getText function by using the underscore. So write  text = _('Edit page') and not  text = 'Edit page'. From Moin 1.6 onwards you can provide separate translation files for your extensions named LangShortcut.Extensionname.po. For example: de.TaskPlanner.po.

• Have a look at our CodingStyle and MoinDev/CodingStandards

## Offers

### Release 1.8

 Macro Author Email Designed for MoinMoin Release Description / Sample 1.8/1.7 <> 1.8 added a second version 1.5/1.6/1.7/1.8 <> 1.8.5 generates a TagCloud of category pages  <> 1.8 <> 1.8.x <> 1.8.x <> 1.5/1.6/1.7/1.8/1.9 <> 1.8 (1.5) petrdll at centrum dot sk 1.8 Set of macro plugins to generate various HTML form elements. Submited data are processed by specified MoinMoin action plugin or FormSubmit plugin. See FormSubmit in ActionMarket. 1.8/1.9 <> AndyD'ArcyJewell 1.8 <> 1.8/1.6/1.3 <> 1.8.1 <> 1.8/1.9 <> The mathtran macro is used to write latex formulars into the wiki text. 1.8/1.9 Blog like comments 1.5 to 1.8 permits the use of titles in form = title = or '''title''' in a calendar, see /MonthCalendarHack 1.5 to 1.8 create a list of recent entries created with MonthCalendar, see /MonthCalendarTopList 1.8 Automatically creates new calendar entry (based on core NewPage macro) 1.6 to 1.9 Enables sections of a page to be see-sawed (toggled) between hidden and shown, or unconditionally placed in either state. Requires JavaScript and jQuery. 1.8.x <> 1.8 <> 1.7 <> 1.8 <> or <> Peter Hübert 1.6 - 1.8 <> 1.8.x <>

### Release 1.7

 Macro Author Email Designed for MoinMoin Release Description / Sample 1.5/1.6/1.7/1.8 <> 1.7 Allow to insert some Crunchy controls 1.7 <> 1.5/1.6/1.7/1.8/1.9 <> 1.7 <> , <> 1.7 <> 1.7 Implement a MoinMoin like issue tracker with search 1.7 <> 1.7.2 <> 1.5/1.6/1.7 create a list of recent entries created with MonthCalendar, see /MonthCalendarTopList 1.5/1.6/1.7 permits the use of titles in form = title = or '''title''' in a calendar, see /MonthCalendarHack 1.7 <> 1.7 1.7 1.7 <> 1.5 - 1.7.x <> 1.6/1.7 Searches text in some pages and displays the result by sorted lines. Great to collect info over pages, such as TODOs, deadlines, etc. see /SearchInPagesAndSort 1.6 to 1.9 Enables sections of a page to be see-sawed (toggled) between hidden and shown, or unconditionally placed in either state. Requires JavaScript and jQuery. 1.6 - 1.7 Used to show csv file as wiki table - /ShowCSV 1.5 - 1.7.x Sorts table data much like a spreadsheet. See /SortBy 1.6-1.7 Update of Zdenek Pizl's remake of UserList, originaly coded by AnttiKuntsi.

### Release 1.6

 Macro Author Email Designed for MoinMoin Release Description / Sample l-tribe at yandex dot ru, BoleslawKulbabinski 1.6 Set of tools for Wiki administration Currently includes: - AllPagesWithACL - LostSoulsInGroups - ManageUsers - WikiLog 1.6 <> ggodfrey PLUS moin AT io DOT com 1.6 <> When run on pages created under a MonthCalendar, it returns with formatted text for the date. 1.5/1.6/1.7/1.8 <> 1.6 returns list of pages in a category, can be used to get rid of ugly regexps in category pages 1.6 Extends Color macro to support text color, background color, and font. Also uses code from /MiniPage to support markup within text. e.g. <>. Note: install as Color2.py 1.6 <> , <>  Macro converted to new syntax of 1.6, see also /Columns 1.6 Displays results of SQL select statements as a table. ODBC, MySQL and Oracle DB connections are supported. Supports any database source that can be connected by ODBC. 1.5/1.6/1.7/1.8/1.9 <> 1.6, 1.5 A modification of Moin's built-in Action macro which allows also to make action links to other pages than just the current one 1.6/1.7/1.8 Displays forms based on database records. The records can be edited or deleted. New records can be inserted. The macro also supports sub forms, filters and table views. petrdll at centrum dot sk 1.6 Set of macro plugins to generate various HTML form elements. Submited data are processed by specified MoinMoin action plugin or FormSubmit plugin. See FormSubmit in ActionMarket. 1.6 Adds a preview window underneath the calendar where you can view, create, change the daypages 1.6 <> , <> 1.6 1.6 see wiki page 1.6 <> 1.6 1.5/1.6/1.7 create a list of recent entries created with MonthCalendar, see /MonthCalendarTopList 1.5/1.6/1.7 permits the use of titles in form = title = or '''title''' in a calendar, see /MonthCalendarHack 1.6 shows tooltips for all available pages when using multiple calendars in MonthCalendar 1.6/1.5/1.3 1.6 1.6 1.6 1.6/1.7 Searches text in some pages and displays the result by sorted lines. Great to collect info over pages, such as TODOs, deadlines, etc. see /SearchInPagesAndSort 1.6 to 1.9 Enables sections of a page to be see-sawed (toggled) between hidden and shown, or unconditionally placed in either state. Requires JavaScript and jQuery. 1.6 1.6 1.5/1.6/1.7 TaskTable.py, see TaskPlanner 1.6 1.6/1.3 <>

### Release 1.3

 Macro Author Email Designed for MoinMoin Release Description / Sample >=1.3 A simple, 5-stars rating system including a rating form and cross-page ranking tables >=1.3 Wikipedia-like Attention Boxes in MoinMoin 1.3 This macro allows an easy integration of a bug tracking system in a wiki 1.3 This macro generates a progress indicator. Various styles. See /ProgressBar. 1.3 Get content from an URL and insert it into the wiki page. See /UrlGrab. Lars Kruse devel[at]sumpfralle.de 1.3 [[NewPage(pagename_prefix,template)]] shows a form to create a new page starting with "pagename_prefix" by using the optional template 1.35 1.5 Item becomes clickable SergioRGiraldo 1.3 read script 1.3 [[SQL(oraprod1|NEXRAD|NEXRAD|prod1|oracle|select * from user_tables)]] Supports Oracle or MySQL database queries. 1.2, 1.3, 1.5 1.3 [[FreeSpace(/mnt/hda)]] prints (e.g.) "3.8GiB of 3.8GiB" 1.3 [[HelpTitle(this is the text you see, this is the tooltip for it)]] 1.3 [[Link(PageName, accesskey="1")]] Mat see source 1.3.3 creates a link which opens in a new browser window >=1.3 Remake of UserList originaly coded by AnttiKuntsi. Download here UserList2.py >=1.3 includes a variable from a page 1.3 1.3 1.3 1.3 1.3 1.3 1.3 >=1.3 1.3 latex macro (for code see url) 1.3 patch-500 1.3 1.3.5 unofficial patch of irss (action) for MoinMoin 1.5.8: /IRSS/irss-moin-1.5.8.patch Turns parts of any normal Moin page in RSS feeds, using very simple and straightforward markup. 1.3 and 1.2 Searches text in some pages and displays the result by sorted lines. Great to collect info over pages, such as TODOs, deadlines, etc. 1.3 1.3, 1.5 (Last update: 2006-04-02) [[SubscribeTo(UserName,ImportantGroup,-SkipThisUser)]] 1.3 works with MM 1.5.4 and DesktopEdition, see docu at /FreeMindBrowser [[FreeMindBrowser(mindmapUrl)]] 1.3.4, 1.5 1.3.4+ [[ShowMe()]] [[ShowMe(my text)]] 1.3.4+ Updated Martin Stone's and John Cocula's vote macro to work with 1.3.4. See attachment for details 1.3 Roger Haase 1.3, 1.5 beta After downloading, rename this to NewWindow.py. This is a small mod to Changjune Kim's macro to use Javascript to open a new window because the HTML feature is deprecated. 1.3 [[Card(TemplatePage arg1|arg2|var1=value|var2=value|...)]] 1.3 /QueryDb After downloading, rename this to QueryDb.py. Use something like [[QueryDb(SELECT * from countries)]], Flisol's sample 1.3 /RandomBanner After donwloading, rename to RandomBanner.py, please do read the docs, before using it

### Release 1.2

 Macro Author Email Designed for MoinMoin Release... ... and Revision... Description / Sample -- 1.2.3 n/a 1.2.3 n/a 1.2.3 n/a 1.2 n/a 1.2 n/a 1.2 n/a [[AlertDate(10/28/2004)]] 1.2 n/a RockPaperScissors(), also see /RockPaperScissors 1.2 n/a Columns(start,left) also see /Columns Columns(end) (This works in 1.5, at least on my install (Apache2, Python2.4, Firefox 1.5.0.10) 1.2 n/a UserList(), also see /UserList 1.2 n/a A monthly calendar - see /MonthCalendar for more details. Macro used to generate calendar sheet - more info on MonthCalendar (updated 4.3.2004) Jun Hu Jun Hu 1.2 n/a Updated for Moin 1.2. More info now on /IncludePages 1.2.1 this works if: eventlog.py from 1.1 is copied to MoinMoin dir and request.py get added these lines EditRequest (only runs in standalone wiki) -- ReimarBauer 2004-04-09 07:17:55 this is obsolete because of 1.2.2 -- ReimarBauer 2004-07-04 17:36:28 1.2 n/a Updated for Moin 1.2. More info on macro/IncludeCalendarPage.py 1.2.1 this works if: eventlog.py from 1.1 is copied to MoinMoin dir (only runs in standalone wiki) -- ReimarBauer 2004-04-09 07:17:55 this is obsolete because of 1.2.2 -- ReimarBauer 2004-07-04 17:36:28 /SearchInPagesAndSort new version fixing a security hole! 1.2 (and 1.1) n/a Searches text in some pages and displays the result by sorted lines. Great to collect info over pages, such as TODOs, deadlines, etc. RobertKellyIV 1.2 trade will embed HTML: "™" RobertKellyIV 1.2 deg will embed HTML: "°" 1.2 n/a modified FullSearch which handles Category searchs a bit more strict and displays an optional ##BLURP text from the result pages see macro see macro 1.2(2) n/a cleaned up version 1.2 [[SubscribedPages]] will display a list of all pages you have subscribed to. [[SubscribedPages(SomeUser)]] will display a list of all pages SomeUser has subscribed to. 1.2 [[AttachList]] shows list of files attached to a page, [[AttachInfo]] has info on attached files. Minor mods needed to main Moin code - see homepage NigelMetheringham for details

### Release 1.1

Macros designed for Release 1.1 are now on this subpage.

### Release 1.0

Macros designed for Release 1.0 are now on this subpage.

### Macros for older or unknown releases

Macros designed for Release 1.0 are now on this subpage.

### Attic

The Attic is now on a subpage.

### Miscellaneous Macros

Stuff formerly found under contribution/:

## Requests

If you are not familiar with Python and/or the MoinMoin code base, but have a need or an idea for a macro, this is the place to ask for it. Someone might find it useful, too, and implement it.

### Miscellaneous

• Is there a macro to include a web page in the wiki page? For exampe like a Include macro inserts another wiki page, this one should insert a web page by link. Something like:

<<Include(http://moinmo.in/, ,)>>
• AFAIK there is no such macro. Maybe you could do your own macro and use an iframe to do that.
• I am not familiar with Python, that is why I can't craate any macros. Can any one help me with this?
• See /IncludeUrlContent and /UrlGrab. However installing this macro, which enables inclusion of foreign HTML/Javascript is a security problem.

• /IncludeUrlContent includes html code of the page, I need full page, like if it was browser in page. /UrlGrab seems that it is hard to make it work on moin v1.6

• Indeed, /UrlGrab does not work on v1.6. Please either wait till I fix it (allow 1+ week), or if anybody wants to do it, please contact me -- PascalBauermeister 2008-05-29 10:13:26

• OK I will wait. Just, please, do not forget about it.
• See also /IncludePage-1.7 now where you can include external pages, interwiki pages, locale pages with an iframe.

• Thank you very much, this /IncludePage-1.7 macro seems to be exactly what I was looking for.

• Using the linking functions of moinmoin be able to post comments to other pages through a link or by itself, such as [url label "comment"] or [url "comment"] and then the comments are displayed on both pages, or only on the page it is written and then on the reciving page with a macro.
• I'd like to have a macro to find all pages created or modified by a user... it'd be invoked like !UserContributions(!UserName) or something like that and show a list of pages... maybe an optional argument to be able to sort the list alphabetically/chronologically by last modification/by total number of lines contributed/etc... you might use it in your WikiHomePage -- MarianoAbsatz 2007-07-27 04:53:17

• Probably the wrong place to ask, but: -- EvanLanglois

1. Can you use a macro inside a processor block? Meaning, will the macro be done before the processor sees it, like a preprocessor. This could be useful for using a macro to fetch dynamic content to be processed by something else, or is there a preferred way to do this?
2. Will macros such as macro/IncVar fetch data based on the raw source, or will other macros or processors be applied to the page before it looks at it? Basically looking for ways to fetch content dynamically and hopefully format it as something other than a table.
• I would like to see a macro like PageHits.py that presents the total of hits on the wikisite. (all pagehits cumulated). Most beautiful would be that it can be presented in the header of all pages in the wiki. Something like "This wikisite had hitscounter been read".

• some easy way to upload media files, images, etc, and reference them systematically, organise them by date/time/etc.
• tables of thumbnails of images, possibly with captions
• It would be nice if you could list images as bullet items and the use the RandomQuote macro to select one and display it. Currently this doesn't work, it just returns the URL. -- AdamShand

• I would suggest two macros wich would be useful to write information based on the date.
• Probably, the harder will be to deal with date format (I've been told that some strange countries wouldn't use the same format for dates than me)
• If someone does this, then as [[BETWEEN('','somedate',...)]] or even [[CONDITION('someexpr',...]] please. -- jh

• ISO 8601 is meant for fixing up date format confusion, please use it. E.g. right now is 2002-06-24T19:14+01:00 (aka 2002-06-24T18:14Z).

### AliasOfThisPage

If you want alias of existing page, just create the alias, place #redirect there, and point it to existing page. See HelpOnProcessingInstructions.

### Macro for Graphs in Wiki

Is there a way of creating graphs, charts and stuff like that in Wiki? That would really help a lot of people out. Now I'm making images out of them, but that's not really working for me.
I'm not sure this is the right place to put this... if so, my apologies.

### Macro for integrating mail archives

• It would be very useful to have a archive of a mailing list integrated in the wiki. A tool which converts each email sent to the list to a wiki page... and a macro which displays the first few lines of of all email-pages (including author and subject). Or is there an other, easier way to achieve this?

Yes. Use an existing mail archiver, and link to it.

### PageOf macro and TOC markup

To make navigation of book style organization of wikipages, a PageOf macro will take a TOC page which contain a section of wikinames organized in tree structure and output the prev, up, toc, next links.

For example, the TOC page look like:

    Title
by
authors
....
<TOC>
* [[Chapter 0]] The first chapter
** [[Section 0]] The first section of Chapter
* [[Chapter 1]] Chapter 1
....
</TOC>
....

The macro in Section 0 will generate :

• TOC page as TOC, Chapter 0 as up and prev, Chapter 1 as next.

These macros can be inserted to pages in templates, by hand and by action of the TOC page.

### subversion integration

an integration of subversion archives was requested on the mailing list .

• Currently, using show_section_numbers configuration setting, gives nice section numbers for headings e.g. "5.1.2 Section Title". However, the table of contents is still numbered with separate lists, so there is no way to show the full section number in the table of contents.

I have modified my (1.5, intranet) install to show full section numbers in the html table of contents. Before I post it, I'll need to clean up my hard-coded changes to check the relevant configuration settings. Interested in this change? Let me know. --StuartHarding

### Encryption of parts of a page

I would like to be able to store encrypted text within the normal text of a page, e.g. for storing passwords, PINs etc. The idea is to store information that does not need encryption (e.g. a web address, a user name, a bank account number) on the same page as sensitive information that should be encrypted. e.g.

Bank: Some Bank
Account No: 08514711
PIN: <some encrypted text or link to it>

En/decryption should use a user supplied password and should be reasonably secure. I imagine the syntax as something like this:

<<<encrypt(password, some text)>>>`

which will then add a link to the page that asks for a password and then tries to use this password to decrypt the content. Of course this is only really usefull in a personal wiki that is not accessible remotely.

Suggestion Instead of making the wiki do the encryption, do it on your local machine and paste the encrypted text to the wiki. E.G. pipe your PIN through GPG and paste the results to your wiki. To get your pin back, copy from wiki and pipe to GPG again.

Possible Solution I just posted https://github.com/lorrin/moinmoin-client-crypt which tackles this use-case. Installation & MoinMoin integration isn't polished yet.

### Easy-append to a page

This macro should generate a text box and a button. Clicking the button causes the contents of the text box to be appended to the page. TWiki's %COMMENT% macro works this way.

We want to solve two problems:

1. people have problems finding the right plugin (solution: categories)
2. people have problems to find what plugins they actually can install with no risk of data loss (solution: table)

### DONE

I started to split up this page into seperate sub-pages. See /DatabaseMacros and /WikiInfoMacros for examples. When the component pages are complete we could then [[Include()]] them onto this page. Anyone want to help? Good idea? Bad idea? Other categories that I thought of would be /ImageMacros and /NavigationMacros, and then of course the /ImpossibleToClassifyMacros There is a problem with this approach in that the location of attachments and descriptive pages/sub-pages are scattered all over the wiki and web. Having macro descriptions split up onto seperate pages is not going to help. Though I really think this categorization would really help new users to find macros useful to them. -- TimCera 2006-02-02 14:33:42

• I must admit I did not follow the structure after my own suggestions. I think good ideas. I think with the attachments we should follow one standard all over the wiki. So discussing this only here would be a fault. Instead I suggest we do the discussion on a page MarketDiscussion and link from all market pages to that page. -- ThiloPfennig 2006-10-22 13:56:46

#### Moved macros

I just finished cleaning up the MacroMarket by moving all of the macros/attachments to their own subpage. If you notice anything broken, please let me know on my home page. If you are looking for a macro that is no longer attached to this page, try going to MacroMarket/NameOfMacroYouAreLookingFor. -- JordanCronin 2008-02-01 19:46:10

### OPEN

• it would be nice to have what plugins work on what versions. I also. Do all plugins under 1.3 do not work under 1.5 or do 1.5 plugins not work under 1.3? I think this kind od overview should be made as a table. I also would like to see plugins sorted by:
• official macro (part of distribution
• tested macro (this one is working good)
• untested macro (only for developers)
• maybe also display how active one plugin is developed.

MoinMoin: MacroMarket (last edited 2013-03-03 17:54:17 by 173-160-248-38-Washington)