"""Example macro."""
from trac.core import *
from trac.wiki.macros import WikiMacroBase
from trac.util import escape

__all__ = ['HelloWorldMacro']

class HelloWorldMacro(WikiMacroBase):
	"""
	Demo macro for a greeting with an argument.

	{{{
	[[HelloWorld(args)]]
	}}}

	"""
	def expand_macro(self, formatter, name, args):
		# args will be `None` if the macro is called without parenthesis.
		txt = args or 'No arguments'

		# then, as `txt` comes from the user, it's important to guard against
		# the possibility to inject malicious HTML/Javascript, by using `escape()`:
		return 'Hello World, args = ' + escape(txt)
		
