Skip to content

Commit 0516457

Browse files
authored
Update hooks.rb
1. Typo 2. In case of a typical README Linux file, which is without extension the file is displayed as it is including '\n'. Therefore line ends are missing and the text is difficult to read. This small change replace '\n' with '<br/>'.
1 parent 6541484 commit 0516457

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: lib/redmine_git_hosting/hooks.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def view_repositories_show_bottom(context)
2828

2929
return '' if readme_file.nil?
3030

31-
content = get_formated_text repository, readme_file, rev
31+
content = get_formatted_text repository, readme_file, rev
3232

3333
context[:controller].send :render_to_string, partial: 'repositories/readme', locals: { html: content }
3434
end
@@ -48,7 +48,7 @@ def find_readme_file(repository, path, rev)
4848
(repository.entries(path, rev) || []).find { |f| f.name =~ /README((\.).*)?/i }
4949
end
5050

51-
def get_formated_text(repository, file, rev)
51+
def get_formatted_text(repository, file, rev)
5252
raw_readme_text = Redmine::CodesetUtil.to_utf8_by_setting repository.cat(file.path, rev)
5353

5454
if redmine_file? file
@@ -57,7 +57,7 @@ def get_formated_text(repository, file, rev)
5757
elsif github_file? file
5858
RedmineGitHosting::MarkdownRenderer.to_html raw_readme_text
5959
else
60-
GitHub::Markup.render file.path, raw_readme_text
60+
GitHub::Markup.render(file.path, raw_readme_text).gsub("\n", '<br/>')
6161
end
6262
end
6363

0 commit comments

Comments
 (0)