ShowMe macro
It's no necessary because the Action macro accept a second parameter with free text. Usage: [[Action(action, text)]].
I'll keep ShowMe macro here for illustration.
Description
Allow an inline link from a page to itself. Used to create custom links in included pages. Created to use with the NewBlogEntry macro.
Usage
Without parameters.
[[ShowMe()]]
Rendered as: show
With a single parameter indicating the hyperlink text.
[[ShowMe(the ShowMe macro page)]]
Rendered as: the ShowMe macro page
Code
1 """
2 ShowMe
3
4 Description
5 ===========
6 Create a link to the page where the macro appears. The parameter will be the hyperlinked text. If no parameter is passed then standard localization for 'show' action will be used.
7 @see http://moinmoin.wikiwikiweb.de/MacroMarket/ShowMe for more info.
8
9 Usage
10 =====
11 [[ShowMe()]]
12 [[ShowMe(free text)]]
13
14 @license: GNU GPL
15 @copyright: 2005 by Julián Romero <julian.romero@gmail.com>
16 """
17
18 from MoinMoin import wikiutil
19
20 def execute(macro, args=None):
21 """ @param macro: macro object
22 @param args: text to use as hyperlink (optional)
23 """
24 action = 'show'
25 label = 'show'
26 if args is None:
27 label = macro.request.getText(action, formatted=False)
28 else:
29 label = args
30
31 formatter = macro.formatter
32 page = wikiutil.quoteWikinameURL(formatter.page.page_name)
33 url = '%s?action=%s' % (page, action)
34 link = wikiutil.link_tag(macro.request, url, text=label, formatter=formatter)
35
36 return link
Discussion
It seems that this macro is not needed - see how the usage is created with [[Action(action, text)]] macro
- Thanks. I forgot trying this trivial parameter before start programming.