Merge pull request #533 from wrs/wrs_syntaxfixes
Two little syntax highlighting fixes
This commit is contained in:
@@ -195,12 +195,13 @@ var previewSet = function( text ) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// 'c', 'c++', 'cpp' are github specific and transformed to c_cpp for Ace.
|
// 'c', 'c++', 'cpp' are github specific and transformed to c_cpp for Ace.
|
||||||
var languages = [ 'c', 'c++', 'cpp', 'clojure', 'coffee', 'coldfusion',
|
// 'coffeescript' is transformed to 'coffee' for Ace.
|
||||||
'csharp', 'css', 'diff', 'golang', 'groovy', 'haxe', 'html',
|
var languages = [ 'c', 'c++', 'cpp', 'clojure', 'coffee',
|
||||||
'java', 'javascript', 'json', 'latex', 'less', 'liquid',
|
'coffeescript', 'coldfusion', 'csharp', 'css', 'diff', 'golang',
|
||||||
'lua', 'markdown', 'ocaml', 'perl', 'pgsql', 'php', 'powershell',
|
'groovy', 'haxe', 'html', 'java', 'javascript', 'json', 'latex',
|
||||||
'python', 'ruby', 'scad', 'scala', 'scss', 'sh', 'sql', 'svg',
|
'less', 'liquid', 'lua', 'markdown', 'ocaml', 'perl', 'pgsql', 'php',
|
||||||
'textile', 'text', 'xml', 'xquery', 'yaml' ];
|
'powershell', 'python', 'ruby', 'scad', 'scala', 'scss', 'sh', 'sql',
|
||||||
|
'svg', 'textile', 'text', 'xml', 'xquery', 'yaml' ];
|
||||||
|
|
||||||
var staticHighlight = require( 'ace/ext/static_highlight' );
|
var staticHighlight = require( 'ace/ext/static_highlight' );
|
||||||
var githubTheme = require( 'ace/theme/github' );
|
var githubTheme = require( 'ace/theme/github' );
|
||||||
@@ -303,6 +304,12 @@ var makePreviewHtml = function () {
|
|||||||
aceMode = 'c_cpp';
|
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 ) {
|
if ( $.inArray( declaredLanguage, languages ) === -1 ) {
|
||||||
// Unsupported language.
|
// Unsupported language.
|
||||||
skipped++;
|
skipped++;
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ module Gollum
|
|||||||
encoding ||= 'utf-8'
|
encoding ||= 'utf-8'
|
||||||
begin
|
begin
|
||||||
hl_code = Pygments.highlight(code, :lexer => lang, :options => {:encoding => encoding.to_s})
|
hl_code = Pygments.highlight(code, :lexer => lang, :options => {:encoding => encoding.to_s})
|
||||||
rescue ::RubyPython::PythonError
|
rescue
|
||||||
hl_code = code
|
hl_code = code
|
||||||
end
|
end
|
||||||
highlighted << hl_code
|
highlighted << hl_code
|
||||||
|
|||||||
@@ -534,6 +534,14 @@ np.array([[2,2],[1,3]],np.float)
|
|||||||
assert_equal %Q{<p>a\n</p><div class=\"highlight\"><pre><span class=\"nt\"><p></span>a\n!rel<span class=\"nt\"></p></span>\n</pre></div>\n}, output
|
assert_equal %Q{<p>a\n</p><div class=\"highlight\"><pre><span class=\"nt\"><p></span>a\n!rel<span class=\"nt\"></p></span>\n</pre></div>\n}, output
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "code block in unsupported language" do
|
||||||
|
@wiki.write_page("a", :markdown, "a\n```nonexistent\ncode\n```\nb", commit_details)
|
||||||
|
|
||||||
|
page = @wiki.page("a")
|
||||||
|
output = page.formatted_data
|
||||||
|
assert_equal %Q{<p>a\ncode\nb</p>}, output
|
||||||
|
end
|
||||||
|
|
||||||
#########################################################################
|
#########################################################################
|
||||||
#
|
#
|
||||||
# Web Sequence Diagrams
|
# Web Sequence Diagrams
|
||||||
|
|||||||
Reference in New Issue
Block a user