diff options
author | Douwe Maan <douwe@selenight.nl> | 2017-04-28 17:57:17 +0300 |
---|---|---|
committer | Douwe Maan <douwe@selenight.nl> | 2017-04-28 19:37:19 +0300 |
commit | 0be3187a56603e26b677d31880be0dc21072f687 (patch) | |
tree | 3f2763bfed60f9fe09468303d6a23468f578c7a9 /app/helpers/markup_helper.rb | |
parent | 31b87b8cab2c2daebb99657046e5d121b48499ad (diff) |
Pull preserve into render helpers
Diffstat (limited to 'app/helpers/markup_helper.rb')
-rw-r--r-- | app/helpers/markup_helper.rb | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/app/helpers/markup_helper.rb b/app/helpers/markup_helper.rb index 0781874d7fc..b241a14740b 100644 --- a/app/helpers/markup_helper.rb +++ b/app/helpers/markup_helper.rb @@ -74,7 +74,7 @@ module MarkupHelper context[:project] ||= @project html = markdown_unsafe(text, context) - banzai_postprocess(html, context) + prepare_for_rendering(html, context) end def markdown_field(object, field) @@ -82,13 +82,13 @@ module MarkupHelper return '' unless object.present? html = Banzai.render_field(object, field) - banzai_postprocess(html, object.banzai_render_context(field)) + prepare_for_rendering(html, object.banzai_render_context(field)) end def markup(file_name, text, context = {}) context[:project] ||= @project html = context.delete(:rendered) || markup_unsafe(file_name, text, context) - banzai_postprocess(html, context) + prepare_for_rendering(html, context) end def render_wiki_content(wiki_page) @@ -107,14 +107,14 @@ module MarkupHelper wiki_page.formatted_content.html_safe end - banzai_postprocess(html, context) + prepare_for_rendering(html, context) end def markup_unsafe(file_name, text, context = {}) return '' unless text.present? if gitlab_markdown?(file_name) - Hamlit::RailsHelpers.preserve(markdown_unsafe(text, context)) + markdown_unsafe(text, context) elsif asciidoc?(file_name) asciidoc_unsafe(text) elsif plain?(file_name) @@ -225,8 +225,7 @@ module MarkupHelper Gitlab::OtherMarkup.render(file_name, text) end - # Calls Banzai.post_process with some common context options - def banzai_postprocess(html, context = {}) + def prepare_for_rendering(html, context = {}) return '' unless html.present? context.merge!( @@ -239,7 +238,9 @@ module MarkupHelper requested_path: @path ) - Banzai.post_process(html, context) + html = Banzai.post_process(html, context) + + Hamlit::RailsHelpers.preserve(html) end extend self |