def expand_macro(self, formatter, name, content, args=None): req = formatter.req Chrome(self.env).add_jquery_ui(req) add_script(req, 'wikitabs/main.js') if args is None: args = {} class_ = filter(None, args.get('class', '').split()) class_.append('tracwikitabs') args['class'] = ' '.join(class_) div = WikiProcessor(formatter, 'div', args) return div.process(content)
def _macro_formatter(self, match, fullmatch): name = fullmatch.group('macroname') if name.lower() == 'br': return '<br />' args = fullmatch.group('macroargs') try: macro = WikiProcessor(self.env, name) rv = macro.process(self.req, args, True) except Exception, e: self.env.log.error('Macro %s(%s) failed' % (name, args), exc_info=True) rv = system_message('Error: Macro %s(%s) failed' % (name, args), e)
def expand_macro(self, formatter, name, content): macros, content = self._parse_args(content) if len(macros) < 1: raise Exception("Insufficient arguments.") for name in macros: try: macro = WikiProcessor(formatter, name) if macro.error: raise Exception('Failed to load macro %s: \'%s\'' % (name, macro.error)) content = str(macro.process(content)) self.env.log.debug('Macro %s returned \'%s\'' % (name, content)) except Exception, e: self.env.log.error('Macro %s(%s) failed' % (name, content), exc_info=True) raise e
def render_macro(self, req, name, content): macros, content = self._parse_args(content) if len(macros) < 1: raise Exception("Insufficient arguments.") for name in macros: try: macro = WikiProcessor(self.env, name) if macro.error: raise Exception('Failed to load macro %s: \'%s\'' % (name, macro.error)) content = macro.process(req, content) self.env.log.debug('Macro %s returned \'%s\'' % (name, content)) except Exception, e: self.env.log.error('Macro %s(%s) failed' % (name, content), exc_info=True) raise e
def _macro_formatter(self, match, fullmatch): name = fullmatch.group('macroname') if name in ['br', 'BR']: return '<br />' elif name in ['html']: args = fullmatch.group('macroargs') args = unescape(args) try: macro = WikiProcessor(self.env, name) return macro.process(self.req, args, 1) except Exception, e: self.env.log.error('Macro %s(%s) failed' % (name, args), exc_info=True) return system_message('Error: Macro %s(%s) failed' % (name, args), e) return match
def _macro_formatter(self, match, fullmatch): name = fullmatch.group('macroname') if name.lower() == 'latexdoccls': self.begindoc = True if name.lower() == 'latexenddoc': self.enddoc = True if name.lower() == 'br': return os.linesep + r'\\' + os.linesep name = 'Tex' + name args = fullmatch.group('macroargs') try: macro = WikiProcessor(self, name) return macro.process(args, True) except Exception, e: self.env.log.error('Macro %s(%s) failed' % (name, args), exc_info=True) return None
def code_formatter(env, context, language, text): processor = WikiProcessor(Formatter(env, context), language) html = processor.process(text) raw = nodes.raw('', html, format='html') return raw
def code_formatter(language, text): processor = WikiProcessor(self.env, language) html = processor.process(req, text) raw = nodes.raw('', html, format='html') return raw