← Revision 5 as of 2008-05-11 17:42:57
Size: 226
Comment:
|
← Revision 6 as of 2008-05-11 18:05:51 →
Size: 405
Comment: clarification
|
Deletions are marked like this. | Additions are marked like this. |
Line 1: | Line 1: |
Download: [[attachment:ChildPage.py]] <<BR>> Usage: {{{<<ChildPage(Discuss)>>}}}<<BR>> Example: We want to link to a child page regardless if it exists or not called <<ChildPage(FooBar)>><<BR>> |
'''Download''': [[attachment:ChildPage.py]] <<BR>> '''Usage''': {{{<<ChildPage(Discuss)>>}}}<<BR>> '''Example''': We want to link to a child page regardless if it exists or not called <<ChildPage(FooBar)>><<BR>> '''Install''': As with all user-defined macros, drop this into <moinmoin-root>/data/plugin/macro and check SystemInfo to see it was picked up by MoinMoin<<BR>> |
Download: ChildPage.py
Usage: <<ChildPage(Discuss)>>
Example: We want to link to a child page regardless if it exists or not called
FooBar
Install: As with all user-defined macros, drop this into <moinmoin-root>/data/plugin/macro and check SystemInfo to see it was picked up by MoinMoin
1 # -*- coding: iso-8859-1 -*-
2 """
3 MoinMoin - Link to a child page
4 """
5
6 def execute(macro, text):
7 url = '%s/%s' % (macro.formatter.page.page_name, text)
8 html = '''
9 <a href="/%s">%s</a>
10 ''' % (url, text)
11 return html
12