From 8dbc4746fe7c723b67f3c90cbf40fd7bf6c29cb7 Mon Sep 17 00:00:00 2001 From: Jakub Jirutka Date: Wed, 13 May 2015 01:07:48 +0200 Subject: Handle AsciiDoc better, reuse HTML pipeline filters (fixes #9263) --- app/helpers/application_helper.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'app/helpers/application_helper.rb') diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ea9722b9bef..bc07c09cd4a 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -222,8 +222,12 @@ module ApplicationHelper end def render_markup(file_name, file_content) - GitHub::Markup.render(file_name, file_content). - force_encoding(file_content.encoding).html_safe + if asciidoc?(file_name) + asciidoc(file_content) + else + GitHub::Markup.render(file_name, file_content). + force_encoding(file_content.encoding).html_safe + end rescue RuntimeError simple_format(file_content) end @@ -236,6 +240,10 @@ module ApplicationHelper Gitlab::MarkdownHelper.gitlab_markdown?(filename) end + def asciidoc?(filename) + Gitlab::MarkdownHelper.asciidoc?(filename) + end + # Overrides ActionView::Helpers::UrlHelper#link_to to add `rel="nofollow"` to # external links def link_to(name = nil, options = nil, html_options = {}) -- cgit v1.2.1