예제 #1
0
파일: __init__.py 프로젝트: Mekyi/crunchy
 def __init__(self, **options):
     Filter.__init__(self, **options)
     tags = get_list_opt(options, 'codetags',
                         ['XXX', 'TODO', 'BUG', 'NOTE'])
     self.tag_re = re.compile(r'\b(%s)\b' % '|'.join([
         re.escape(tag) for tag in tags if tag
     ]))
예제 #2
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     self.names = set(get_list_opt(options, 'names', []))
     tokentype = options.get('tokentype')
     if tokentype:
         self.tokentype = string_to_tokentype(tokentype)
     else:
         self.tokentype = Name.Function
예제 #3
0
파일: __init__.py 프로젝트: Mekyi/crunchy
 def __init__(self, **options):
     Filter.__init__(self, **options)
     self.names = set(get_list_opt(options, 'names', []))
     tokentype = options.get('tokentype')
     if tokentype:
         self.tokentype = string_to_tokentype(tokentype)
     else:
         self.tokentype = Name.Function
예제 #4
0
 def __init__(self, **options):
     self.options = options
     self.stripnl = get_bool_opt(options, 'stripnl', True)
     self.stripall = get_bool_opt(options, 'stripall', False)
     self.tabsize = get_int_opt(options, 'tabsize', 0)
     self.encoding = options.get('encoding', 'latin1')
     # self.encoding = options.get('inencoding', None) or self.encoding
     self.filters = []
     for filter_ in get_list_opt(options, 'filters', ()):
         self.add_filter(filter_)
예제 #5
0
파일: lexer.py 프로젝트: Mekyi/crunchy
 def __init__(self, **options):
     self.options = options
     self.stripnl = get_bool_opt(options, "stripnl", True)
     self.stripall = get_bool_opt(options, "stripall", False)
     self.tabsize = get_int_opt(options, "tabsize", 0)
     self.encoding = options.get("encoding", "latin1")
     # self.encoding = options.get('inencoding', None) or self.encoding
     self.filters = []
     for filter_ in get_list_opt(options, "filters", ()):
         self.add_filter(filter_)
예제 #6
0
파일: web.py 프로젝트: Mekyi/crunchy
    def __init__(self, **options):
        self.funcnamehighlighting = get_bool_opt(options, "funcnamehighlighting", True)
        self.disabledmodules = get_list_opt(options, "disabledmodules", ["unknown"])
        self.startinline = get_bool_opt(options, "startinline", False)

        # private option argument for the lexer itself
        if "_startinline" in options:
            self.startinline = options.pop("_startinline")

        # collect activated functions in a set
        self._functions = set()
        if self.funcnamehighlighting:
            from pygments3.lexers._phpbuiltins import MODULES

            for key, value in MODULES.items():
                if key not in self.disabledmodules:
                    self._functions.update(value)
        RegexLexer.__init__(self, **options)
예제 #7
0
파일: web.py 프로젝트: wolverine2k/crunchy
    def __init__(self, **options):
        self.funcnamehighlighting = get_bool_opt(options,
                                                 'funcnamehighlighting', True)
        self.disabledmodules = get_list_opt(options, 'disabledmodules',
                                            ['unknown'])
        self.startinline = get_bool_opt(options, 'startinline', False)

        # private option argument for the lexer itself
        if '_startinline' in options:
            self.startinline = options.pop('_startinline')

        # collect activated functions in a set
        self._functions = set()
        if self.funcnamehighlighting:
            from pygments3.lexers._phpbuiltins import MODULES
            for key, value in MODULES.items():
                if key not in self.disabledmodules:
                    self._functions.update(value)
        RegexLexer.__init__(self, **options)
예제 #8
0
파일: html.py 프로젝트: wolverine2k/crunchy
    def __init__(self, **options):
        Formatter.__init__(self, **options)
        self.title = self._decodeifneeded(self.title)
        self.nowrap = get_bool_opt(options, 'nowrap', False)
        self.noclasses = get_bool_opt(options, 'noclasses', False)
        self.classprefix = options.get('classprefix', '')
        self.cssclass = self._decodeifneeded(
            options.get('cssclass', 'highlight'))
        self.cssstyles = self._decodeifneeded(options.get('cssstyles', ''))
        self.prestyles = self._decodeifneeded(options.get('prestyles', ''))
        self.cssfile = self._decodeifneeded(options.get('cssfile', ''))
        self.noclobber_cssfile = get_bool_opt(options, 'noclobber_cssfile',
                                              False)

        linenos = options.get('linenos', False)
        if linenos == 'inline':
            self.linenos = 2
        elif linenos:
            # compatibility with <= 0.7
            self.linenos = 1
        else:
            self.linenos = 0
        self.linenostart = abs(get_int_opt(options, 'linenostart', 1))
        self.linenostep = abs(get_int_opt(options, 'linenostep', 1))
        self.linenospecial = abs(get_int_opt(options, 'linenospecial', 0))
        self.nobackground = get_bool_opt(options, 'nobackground', False)
        self.lineseparator = options.get('lineseparator', '\n')
        self.lineanchors = options.get('lineanchors', '')
        self.anchorlinenos = options.get('anchorlinenos', False)
        self.hl_lines = set()
        for lineno in get_list_opt(options, 'hl_lines', []):
            try:
                self.hl_lines.add(int(lineno))
            except ValueError:
                pass

        self._class_cache = {}
        self._create_stylesheet()
예제 #9
0
파일: html.py 프로젝트: Mekyi/crunchy
    def __init__(self, **options):
        Formatter.__init__(self, **options)
        self.title = self._decodeifneeded(self.title)
        self.nowrap = get_bool_opt(options, 'nowrap', False)
        self.noclasses = get_bool_opt(options, 'noclasses', False)
        self.classprefix = options.get('classprefix', '')
        self.cssclass = self._decodeifneeded(options.get('cssclass', 'highlight'))
        self.cssstyles = self._decodeifneeded(options.get('cssstyles', ''))
        self.prestyles = self._decodeifneeded(options.get('prestyles', ''))
        self.cssfile = self._decodeifneeded(options.get('cssfile', ''))
        self.noclobber_cssfile = get_bool_opt(options, 'noclobber_cssfile', False)

        linenos = options.get('linenos', False)
        if linenos == 'inline':
            self.linenos = 2
        elif linenos:
            # compatibility with <= 0.7
            self.linenos = 1
        else:
            self.linenos = 0
        self.linenostart = abs(get_int_opt(options, 'linenostart', 1))
        self.linenostep = abs(get_int_opt(options, 'linenostep', 1))
        self.linenospecial = abs(get_int_opt(options, 'linenospecial', 0))
        self.nobackground = get_bool_opt(options, 'nobackground', False)
        self.lineseparator = options.get('lineseparator', '\n')
        self.lineanchors = options.get('lineanchors', '')
        self.anchorlinenos = options.get('anchorlinenos', False)
        self.hl_lines = set()
        for lineno in get_list_opt(options, 'hl_lines', []):
            try:
                self.hl_lines.add(int(lineno))
            except ValueError:
                pass

        self._class_cache = {}
        self._create_stylesheet()
예제 #10
0
 def __init__(self, **options):
     Filter.__init__(self, **options)
     tags = get_list_opt(options, 'codetags',
                         ['XXX', 'TODO', 'BUG', 'NOTE'])
     self.tag_re = re.compile(
         r'\b(%s)\b' % '|'.join([re.escape(tag) for tag in tags if tag]))