예제 #1
0
 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)
예제 #2
0
 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)
예제 #3
0
 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)
예제 #4
0
 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)
예제 #5
0
    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
예제 #6
0
    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
예제 #7
0
    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
예제 #8
0
    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
예제 #9
0
파일: rst.py 프로젝트: starworldx/trac
 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
예제 #10
0
파일: rst.py 프로젝트: wiraqutra/photrackjp
 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
예제 #11
0
 def code_formatter(language, text):
     processor = WikiProcessor(self.env, language)
     html = processor.process(req, text)
     raw = nodes.raw('', html, format='html')
     return raw
예제 #12
0
파일: rst.py 프로젝트: nyuhuhuu/trachacks
 def code_formatter(language, text):
     processor = WikiProcessor(self.env, language)
     html = processor.process(req, text)
     raw = nodes.raw('', html, format='html')
     return raw