diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2016-02-01 11:07:59 -0500 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-02-12 17:20:59 +0100 |
commit | e919b5a4e9dd5e09628daf28b7b96424b764863b (patch) | |
tree | 0557a7a903b32becc1772f5bcf22e993d648b163 /lib | |
parent | 0d866d89ec26bf05f2777ac5e5cb3f23f90f0a8c (diff) | |
download | gitlab-ce-e919b5a4e9dd5e09628daf28b7b96424b764863b.tar.gz |
Fix relative links in other markup formatsben.boeckel/gitlab-ce-fixup-links-in-generic-docs
- 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.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/banzai/pipeline/asciidoc_pipeline.rb | 11 | ||||
-rw-r--r-- | lib/gitlab/asciidoc.rb | 4 | ||||
-rw-r--r-- | lib/gitlab/other_markup.rb | 24 |
3 files changed, 25 insertions, 14 deletions
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 |