force some languages to be recognized as others
This commit is contained in:
parent
1038529fd0
commit
ffd557dfef
1 changed files with 12 additions and 2 deletions
|
@ -26,7 +26,11 @@ log = logging.getLogger(__name__)
|
|||
# force file name extensions to be recognized as a certain language
|
||||
EXTENSIONS = {
|
||||
'md': 'Markdown',
|
||||
'js': 'JavaScript',
|
||||
}
|
||||
TRANSLATIONS = {
|
||||
'JavaScript+Lasso': 'JavaScript',
|
||||
'CSS+Lasso': 'CSS',
|
||||
'CSS+Genshi Text': 'CSS',
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +46,7 @@ def guess_language(file_name):
|
|||
except:
|
||||
pass
|
||||
if lexer:
|
||||
return str(lexer.name)
|
||||
return translate_language(str(lexer.name))
|
||||
else:
|
||||
return None
|
||||
|
||||
|
@ -56,6 +60,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:
|
||||
|
|
Loading…
Reference in a new issue