'''
Updated 7/8/2002 by Seth Russell
'''
# -------------------------------------------------------
# writing
# -------------------------------------------------------
production={}
# sail is set to the instance of the sailor agent
# by writing('html') from sailor
sail = 'none'
sp = ' '
nl = '
'
tab = ' '
bold = ''
boldEnd = ''
row = '
'
endRow = '
'
production['space']= lambda: ' '
production['nl']= lambda: '
'
production['tab']= lambda: ' '
production['bold']= lambda: ''
production['boldEnd']= lambda: ''
production['node']= lambda: \
sa('nodeStart') +\
topicFor('localName') +\
sa('typeRow') +\
predicatesFor('slot') +\
sa('submitRow') +\
sa('nodeEnd')
production['nodeStart']= lambda: \
''
def hidden(xname,xvalue):
if xvalue==None:
v=''
else:
v=xvalue
r=' \n'
return r
## Routines necessary to function
def sa(xproduction):
# execuite this grammar's expression in this module
# bound to 'say' in sailor agent
if production.has_key(xproduction):
sail.mem()
r=production[xproduction]()
sail.remem()
return r
else:
return 'No production "%s" in %s grammar.' % (xproduction, sail.sayingGrammar)
def ckUri(s):
# cant't have <...> characters in HTML markup
s=s.replace('<','<')
s=s.replace('>','>')
return s
## Routines necessary to function
class say:
def __init__(self, other):
self.sail=other
def sa(self,xproduction):
global sail
sail=self.sail
return sa(xproduction)
class read:
def __init__(self, other):
global sail
sail=other
def readDoc(self, doc): pass
def readText(self,text): pass
def processText(self,text): pass