Mercurial > genshi > mirror
annotate examples/trac/wiki-macros/HelloWorld.py @ 39:93b4dcbafd7b trunk
Copy Trac to main branch.
author | cmlenz |
---|---|
date | Mon, 03 Jul 2006 18:53:27 +0000 |
parents | |
children |
rev | line source |
---|---|
39 | 1 """Example macro.""" |
2 from trac.util import escape | |
3 | |
4 def execute(hdf, txt, env): | |
5 # Currently hdf is set only when the macro is called | |
6 # From a wiki page | |
7 if hdf: | |
8 hdf['wiki.macro.greeting'] = 'Hello World' | |
9 | |
10 # args will be `None` if the macro is called without parenthesis. | |
11 args = txt or 'No arguments' | |
12 | |
13 # then, as `txt` comes from the user, it's important to guard against | |
14 # the possibility to inject malicious HTML/Javascript, by using `escape()`: | |
15 return 'Hello World, args = ' + escape(args) |