Exemplo n.º 1
0
	def __init__(self, style='appscript', options=[], out=_out):
		self.typerenderer = gettyperenderer(style)
		self._out = out
		self._in = ''
		self.collapse = 'collapse' in options
		self.full = 'full' in options
		self.code = 'codes' in options and (
				lambda o:'<%s> ' % self.typerenderer.escapecode(o.code)) or (lambda o:'')
Exemplo n.º 2
0
 def __init__(self, style='appscript', options=[], out=_out):
     self.typerenderer = gettyperenderer(style)
     self._out = out
     self._in = ''
     self.collapse = 'collapse' in options
     self.full = 'full' in options
     self.code = 'codes' in options and (
         lambda o: '<%s> ' % self.typerenderer.escapecode(o.code)) or (
             lambda o: '')
Exemplo n.º 3
0
def renderdictionary(terms, style='py-appscript', options=[], template=None):
	"""Render a Dictionary object's classes and commands as an XHTML string.
		terms : osaterminology.dom.osadictionary.Dictionary -- pre-parsed dictionary object
		style : str -- keyword formatting style ('appscript' or 'applescript')
		options : list of str -- formatting options (zero or more of: 'collapse', 'showall')
		template : str -- custom HTML template to use
		Result : str -- HTML data, or empty string if no terminology was found
	"""
	if 'showall' in options:
		oldvis = terms.setvisibility(osadictionary.kAll)
	if terms.suites():
		if template:
			tpl = Template(renderTemplate, template)
		else:
			tpl = _template
		html = encodeNonASCII(tpl.render(terms, gettyperenderer(style), options))
	else:
		html = ''
	if 'showall' in options:
		terms.setvisibility(oldvis)
	return html
Exemplo n.º 4
0
def renderdictionary(terms, style='py-appscript', options=[], template=None):
    """Render a Dictionary object's classes and commands as an XHTML string.
		terms : osaterminology.dom.osadictionary.Dictionary -- pre-parsed dictionary object
		style : str -- keyword formatting style ('appscript' or 'applescript')
		options : list of str -- formatting options (zero or more of: 'collapse', 'showall')
		template : str -- custom HTML template to use
		Result : str -- HTML data, or empty string if no terminology was found
	"""
    if 'showall' in options:
        oldvis = terms.setvisibility(osadictionary.kAll)
    if terms.suites():
        if template:
            tpl = Template(renderTemplate, template)
        else:
            tpl = _template
        html = encodeNonASCII(
            tpl.render(terms, gettyperenderer(style), options))
    else:
        html = ''
    if 'showall' in options:
        terms.setvisibility(oldvis)
    return html