Temporary extension of ACE editor language map, make 'text' default

This commit is contained in:
Kristóf Tóth 2018-02-08 15:17:30 +01:00
parent 792981742c
commit 89694097cc

View File

@ -91,12 +91,19 @@ class SourceCodeEventHandler(EventHandlerBase, SupervisorMixin):
def map_file_extension_to_language(filename):
language_map = {
# TODO: extend, maybe auto-generate???
'.py': 'python',
'.js': 'javascript'
'.js': 'javascript',
'.html': 'html',
'.css': 'css',
'.java': 'java',
'.cpp': 'c_cpp',
'.hpp': 'c_cpp',
'.c': 'c_cpp',
'.h': 'c_cpp',
'.cs': 'csharp'
}
_, extension = splitext(filename)
language = 'javascript'
language = 'text'
try: language = language_map[extension]
except KeyError: log.debug('No such extension in list, falling back to default: "{}".'.format(language))
return language