from trac.core import *
from trac.wiki.macros import WikiMacroBase
from StringIO import StringIO
""" added """
from trac.wiki import wiki_to_html
import os
import urllib
"""__all__ = ['sanScriptMacro']"""
"""
{{{
Macro for adding drop down sanScript commands to the wiki
Simon Lashley 23/04/2009
Example usage, # used as seperator
[[sanScript(FUNC BOOL#IS_PED_DEAD#PED_INDEX ped#This command will return TRUE is the ped passed is dead)]]
}}}
"""
class sanScriptMacro(WikiMacroBase):
def render_macro(self, formatter, name, args):
buf = StringIO()
if args:
args = args.split('#')
if len(args) == 1:
if args[0] == 'JAVACODE':
buf.write('')
else:
buf.write("sanScript has wrong number of arguments, should have 4.")
elif len(args) == 4:
"""
buf.write(''+args[1]+'
'+args[0]+' '+args[1]+'('+args[2]+')
'+args[3]+'')
"""
buf.write(''+args[1]+'
'+args[3]+'
'+args[0]+''+args[1]+'('+args[2]+')')
else:
buf.write("sanScript has wrong number of arguments, should have 4.")
else:
buf.write("sanScript has not been passed any arguments")
return buf.getvalue()