From e919b5a4e9dd5e09628daf28b7b96424b764863b Mon Sep 17 00:00:00 2001 From: Ben Boeckel Date: Mon, 1 Feb 2016 11:07:59 -0500 Subject: Fix relative links in other markup formats - Apply the RelativeLinkFilter filter to other formats, e.g., reStructuredText so links from the Files view or the Project view work - Remove the AsciidocPipeline pipeline Fixes #3533. --- lib/banzai/pipeline/asciidoc_pipeline.rb | 11 ----------- lib/gitlab/asciidoc.rb | 4 +--- lib/gitlab/other_markup.rb | 24 ++++++++++++++++++++++++ 3 files changed, 25 insertions(+), 14 deletions(-) delete mode 100644 lib/banzai/pipeline/asciidoc_pipeline.rb create mode 100644 lib/gitlab/other_markup.rb (limited to 'lib') diff --git a/lib/banzai/pipeline/asciidoc_pipeline.rb b/lib/banzai/pipeline/asciidoc_pipeline.rb deleted file mode 100644 index f1331c0ebf9..00000000000 --- a/lib/banzai/pipeline/asciidoc_pipeline.rb +++ /dev/null @@ -1,11 +0,0 @@ -module Banzai - module Pipeline - class AsciidocPipeline < BasePipeline - def self.filters - [ - Filter::RelativeLinkFilter - ] - end - end - end -end diff --git a/lib/gitlab/asciidoc.rb b/lib/gitlab/asciidoc.rb index b203b9d70e4..0b9c2e730f9 100644 --- a/lib/gitlab/asciidoc.rb +++ b/lib/gitlab/asciidoc.rb @@ -31,9 +31,7 @@ module Gitlab html = ::Asciidoctor.convert(input, asciidoc_opts) - if context[:project] - html = Banzai.render(html, context.merge(pipeline: :asciidoc)) - end + html = Banzai.post_process(html, context) html.html_safe end diff --git a/lib/gitlab/other_markup.rb b/lib/gitlab/other_markup.rb new file mode 100644 index 00000000000..746ec283330 --- /dev/null +++ b/lib/gitlab/other_markup.rb @@ -0,0 +1,24 @@ +module Gitlab + # Parser/renderer for markups without other special support code. + module OtherMarkup + + # Public: Converts the provided markup into HTML. + # + # input - the source text in a markup format + # context - a Hash with the template context: + # :commit + # :project + # :project_wiki + # :requested_path + # :ref + # + def self.render(file_name, input, context) + html = GitHub::Markup.render(file_name, input). + force_encoding(input.encoding) + + html = Banzai.post_process(html, context) + + html.html_safe + end + end +end -- cgit v1.2.1