From b0659c1b072267e0e1fa3066ca1a8cc17bc8f6c0 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Wed, 13 May 2015 01:54:13 +0200 Subject: Simplify and unify helpers for rendering markup --- app/helpers/application_helper.rb | 4 +++- app/helpers/tree_helper.rb | 10 +--------- 2 files changed, 4 insertions(+), 10 deletions(-) (limited to 'app/helpers') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5bcc0026016..bcd400b7e7b 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -222,7 +222,9 @@ module ApplicationHelper end def render_markup(file_name, file_content) - if asciidoc?(file_name) + if gitlab_markdown?(file_name) + Haml::Helpers.preserve(markdown(file_content)) + elsif asciidoc?(file_name) asciidoc(file_content) else GitHub::Markup.render(file_name, file_content). diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index c03564a71ab..03a49e119b8 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -25,15 +25,7 @@ module TreeHelper end def render_readme(readme) - if gitlab_markdown?(readme.name) - preserve(markdown(readme.data)) - elsif asciidoc?(readme.name) - asciidoc(readme.data) - elsif markup?(readme.name) - render_markup(readme.name, readme.data) - else - simple_format(readme.data) - end + render_markup(readme.name, readme.data) end # Return an image icon depending on the file type and mode -- cgit v1.2.3