Fix lack of CoffeeScript livepreview

Pygments calls it coffeescript, but Ace calls it coffee.
This commit is contained in:
Walter Smith
2012-10-10 14:09:21 -07:00
parent b7cdeabbf6
commit d98547a33c
@@ -195,12 +195,13 @@ var previewSet = function( text ) {
};
// 'c', 'c++', 'cpp' are github specific and transformed to c_cpp for Ace.
var languages = [ 'c', 'c++', 'cpp', 'clojure', 'coffee', 'coldfusion',
'csharp', 'css', 'diff', 'golang', 'groovy', 'haxe', 'html',
'java', 'javascript', 'json', 'latex', 'less', 'liquid',
'lua', 'markdown', 'ocaml', 'perl', 'pgsql', 'php', 'powershell',
'python', 'ruby', 'scad', 'scala', 'scss', 'sh', 'sql', 'svg',
'textile', 'text', 'xml', 'xquery', 'yaml' ];
// 'coffeescript' is transformed to 'coffee' for Ace.
var languages = [ 'c', 'c++', 'cpp', 'clojure', 'coffee',
'coffeescript', 'coldfusion', 'csharp', 'css', 'diff', 'golang',
'groovy', 'haxe', 'html', 'java', 'javascript', 'json', 'latex',
'less', 'liquid', 'lua', 'markdown', 'ocaml', 'perl', 'pgsql', 'php',
'powershell', 'python', 'ruby', 'scad', 'scala', 'scss', 'sh', 'sql',
'svg', 'textile', 'text', 'xml', 'xquery', 'yaml' ];
var staticHighlight = require( 'ace/ext/static_highlight' );
var githubTheme = require( 'ace/theme/github' );
@@ -303,6 +304,12 @@ var makePreviewHtml = function () {
aceMode = 'c_cpp';
}
// Pygments's name for CoffeeScript is 'coffeescript', but Ace
// calls it 'coffee'.
if ( declaredLanguage === 'coffeescript' ) {
aceMode = 'coffee';
}
if ( $.inArray( declaredLanguage, languages ) === -1 ) {
// Unsupported language.
skipped++;