Skip to content

Update hooks.rb #801

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/redmine_git_hosting/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def view_repositories_show_bottom(context)

return '' if readme_file.nil?

content = get_formated_text repository, readme_file, rev
content = get_formatted_text repository, readme_file, rev

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

def get_formated_text(repository, file, rev)
def get_formatted_text(repository, file, rev)
raw_readme_text = Redmine::CodesetUtil.to_utf8_by_setting repository.cat(file.path, rev)

if redmine_file? file
Expand All @@ -57,7 +57,7 @@ def get_formated_text(repository, file, rev)
elsif github_file? file
RedmineGitHosting::MarkdownRenderer.to_html raw_readme_text
else
GitHub::Markup.render file.path, raw_readme_text
GitHub::Markup.render(file.path, raw_readme_text).gsub("\n", '<br/>')
end
end

Expand Down