update language lexer translations

This commit is contained in:
Alan Hamlett 2013-10-26 17:59:41 -07:00
parent 784ad38c38
commit 9255fd2c34

View file

@ -27,6 +27,15 @@ log = logging.getLogger(__name__)
EXTENSIONS = {
'md': 'Markdown',
}
TRANSLATIONS = {
'CSS+Genshi Text': 'CSS',
'CSS+Lasso': 'CSS',
'HTML+Django/Jinja': 'HTML',
'HTML+Lasso': 'HTML',
'JavaScript+Genshi Text': 'JavaScript',
'JavaScript+Lasso': 'JavaScript',
'Perl6': 'Perl',
}
def guess_language(file_name):
@ -41,7 +50,7 @@ def guess_language(file_name):
except:
pass
if lexer:
return str(lexer.name)
return translate_language(str(lexer.name))
else:
return None
@ -55,6 +64,12 @@ def guess_language_from_extension(extension):
return None
def translate_language(language):
if language in TRANSLATIONS:
language = TRANSLATIONS[language]
return language
def number_lines_in_file(file_name):
lines = 0
try: