Dont render README with markup if format is not compatible

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-01-08 16:32:03 +02:00
parent 0377069841
commit d6c037de81
No known key found for this signature in database
GPG Key ID: 627C5F589F467F17
4 changed files with 8 additions and 4 deletions

View File

@ -217,4 +217,8 @@ module ApplicationHelper
haml_tag :script, "$('." + html_class + "').timeago().tooltip()"
end.html_safe
end
def render_markup(file_name, file_content)
GitHub::Markup.render(file_name, file_content).html_safe
end
end

View File

@ -4,7 +4,7 @@
= markdown(blob.data)
- elsif markup?(blob.name)
.file-content.wiki
= raw GitHub::Markup.render(blob.name, blob.data)
= render_markup(blob.name, blob.data)
- else
.file-content.code
- unless blob.empty?

View File

@ -9,5 +9,5 @@
- elsif plain_text_readme?(readme.name)
%pre.clean
= readme.data
- else
= raw GitHub::Markup.render(readme.name, readme.data)
- elsif markup?(readme.name)
= render_markup(readme.name, readme.data)

View File

@ -15,7 +15,7 @@
= markdown(@snippet.data)
- elsif markup?(@snippet.file_name)
.file-content.wiki
= raw GitHub::Markup.render(@snippet.file_name, @snippet.data)
= render_markup(@snippet.file_name, @snippet.data)
- else
.file-content.code
%div{class: user_color_scheme_class}