mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-22 19:01:33 +00:00
Temporary extension of ACE editor language map, make 'text' default
This commit is contained in:
parent
792981742c
commit
89694097cc
@ -91,12 +91,19 @@ class SourceCodeEventHandler(EventHandlerBase, SupervisorMixin):
|
|||||||
|
|
||||||
def map_file_extension_to_language(filename):
|
def map_file_extension_to_language(filename):
|
||||||
language_map = {
|
language_map = {
|
||||||
# TODO: extend, maybe auto-generate???
|
|
||||||
'.py': 'python',
|
'.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)
|
_, extension = splitext(filename)
|
||||||
language = 'javascript'
|
language = 'text'
|
||||||
try: language = language_map[extension]
|
try: language = language_map[extension]
|
||||||
except KeyError: log.debug('No such extension in list, falling back to default: "{}".'.format(language))
|
except KeyError: log.debug('No such extension in list, falling back to default: "{}".'.format(language))
|
||||||
return language
|
return language
|
Loading…
Reference in New Issue
Block a user