Changeset - d10caf435170
[Not reviewed]
default
0 1 0
Mads Kiilerich - 6 years ago 2019-11-23 21:42:11
mads@kiilerich.com
Grafted from: 6edefe941a0c
pygmentsutils: simplify get_index_filenames
1 file changed with 3 insertions and 8 deletions:
0 comments (0 inline, 0 general)
kallithea/lib/pygmentsutils.py
Show inline comments
 
@@ -23,13 +23,12 @@ Original author and date, and relevant c
 
:author: marcink
 
:copyright: (c) 2013 RhodeCode GmbH, and others.
 
:license: GPLv3, see LICENSE.md for more details.
 
"""
 

	
 
from collections import defaultdict
 
from itertools import ifilter
 

	
 
from pygments import lexers
 

	
 

	
 
def get_extension_descriptions():
 
    """
 
@@ -56,21 +55,17 @@ def get_extension_descriptions():
 

	
 

	
 
def get_index_filenames():
 
    """
 
    Get list of known indexable filenames from pygment lexer internals
 
    """
 

	
 
    filenames = []
 

	
 
    def likely_filename(s):
 
        return s.find('*') == -1 and s.find('[') == -1
 

	
 
    for lx, t in sorted(lexers.LEXERS.items()):
 
        for f in ifilter(likely_filename, t[-2]):
 
            filenames.append(f)
 
        for f in t[-2]:
 
            if '*' not in f and '[' not in f:
 
                filenames.append(f)
 

	
 
    return filenames
 

	
 

	
 
def get_custom_lexer(extension):
 
    """
0 comments (0 inline, 0 general)