Defect #30434 » 30434-remove-cr-chars-v2.patch
| lib/redmine/syntax_highlighting.rb | ||
|---|---|---|
|
# Highlights +text+ as the content of +filename+
|
||
|
# Should not return line numbers nor outer pre tag
|
||
|
def highlight_by_filename(text, filename)
|
||
|
text = text.gsub(/\r\n?/, "\n")
|
||
|
lexer =::Rouge::Lexer.guess_by_filename(filename)
|
||
|
formatter = ::Rouge::Formatters::HTML.new
|
||
|
::Rouge.highlight(text, lexer, CustomHTMLLinewise.new(formatter))
|
||
| test/helpers/application_helper_test.rb | ||
|---|---|---|
|
end
|
||
|
end
|
||
|
def test_syntax_highlight_should_normalize_line_endings
|
||
|
assert_equal "line 1\nline 2\n", syntax_highlight("test.txt", "line 1\rline 2\r\n")
|
||
|
end
|
||
|
def test_to_path_param
|
||
|
assert_equal 'test1/test2', to_path_param('test1/test2')
|
||
|
assert_equal 'test1/test2', to_path_param('/test1/test2/')
|
||