projects
/
matthijs
/
projects
/
wipi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
3fc0c8d
)
Add a linktext parameter to the RandomPage macro.
author
Matthijs Kooijman
<matthijs@stdin.nl>
Tue, 15 Sep 2009 18:31:11 +0000
(20:31 +0200)
committer
Matthijs Kooijman
<matthijs@stdin.nl>
Tue, 15 Sep 2009 18:31:11 +0000
(20:31 +0200)
This allows you to generate a single random link with a custom link
text.
plugin/macro/RandomPage.py
patch
|
blob
|
history
diff --git
a/plugin/macro/RandomPage.py
b/plugin/macro/RandomPage.py
index b97cd1d00f56444c088625f77079692927886109..9622b45c7114f9815eb0ab55fb66a58ddead9610 100644
(file)
--- a/
plugin/macro/RandomPage.py
+++ b/
plugin/macro/RandomPage.py
@@
-13,7
+13,9
@@
from MoinMoin.Page import Page
Dependencies = ["time"]
-def macro_RandomPage(macro, links=1):
+# Generate links random pagelinks. If links is 1, linktext can be used to
+# override the link text.
+def macro_RandomPage(macro, links=1, linktext=None):
request = macro.request
links = max(links, 1) # at least 1 link
@@
-44,7
+46,7
@@
def macro_RandomPage(macro, links=1):
if links == 1:
name = pages[0]
return (f.pagelink(1, name, generated=1) +
- f.text(name) +
+ f.text(
linktext or
name) +
f.pagelink(0, name))
# return a list of page links