class Translate(object): def __init__(self, etxloc=None, etxtext=None, etxconfig={}): """`etxconfig` parameter will find its way into every object defined by wiki processor. TODO : somehow find a way to pass the arguments to `body` function """ self.etxconfig = dict(defaultconfig.items()) self.etxconfig.update(etxconfig) self.etxconfig.setdefault('devmod', DEVMOD) # Initialize plugins self.etxconfig = initplugins(self.etxconfig, force=self.etxconfig['devmod']) self.etxloc, self.etxtext = etxloc, etxtext self.etparser = ETParser(etxconfig=self.etxconfig) def __call__(self, entryfn='body', context={}): from eazytext.compiler import Compiler self.compiler = Compiler(etxtext=self.etxtext, etxloc=self.etxloc, etxconfig=self.etxconfig, etparser=self.etparser) context['_etxcontext'] = context module = self.compiler.execetx(context=context) entry = getattr(module, entryfn) html = entry() if callable(entry) else '' return html