diff options
author | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-01-12 02:10:08 -0200 |
---|---|---|
committer | Douglas Barbosa Alexandre <dbalexandre@gmail.com> | 2016-01-14 12:09:31 -0200 |
commit | 4872b319c8152837bd36e7fc0a5ad912d1c3ef90 (patch) | |
tree | 1caed10e66de5b2f1c45e986e20e2baa599804d7 | |
parent | a6a5990ee5f504107944c3bba5c18dbdea9f5207 (diff) | |
download | gitlab-ce-4872b319c8152837bd36e7fc0a5ad912d1c3ef90.tar.gz |
Use the WikiPipeline when rendering the wiki markdown content
-rw-r--r-- | app/helpers/gitlab_markdown_helper.rb | 2 | ||||
-rw-r--r-- | lib/banzai/pipeline/gollum_tags_pipeline.rb | 13 | ||||
-rw-r--r-- | lib/banzai/pipeline/wiki_pipeline.rb | 9 | ||||
-rw-r--r-- | spec/helpers/gitlab_markdown_helper_spec.rb | 5 |
4 files changed, 26 insertions, 3 deletions
diff --git a/app/helpers/gitlab_markdown_helper.rb b/app/helpers/gitlab_markdown_helper.rb index ca41657cec1..1a226252251 100644 --- a/app/helpers/gitlab_markdown_helper.rb +++ b/app/helpers/gitlab_markdown_helper.rb @@ -91,7 +91,7 @@ module GitlabMarkdownHelper def render_wiki_content(wiki_page) case wiki_page.format when :markdown - markdown(wiki_page.content) + markdown(wiki_page.content, pipeline: :wiki, project_wiki: @project_wiki) when :asciidoc asciidoc(wiki_page.content) else diff --git a/lib/banzai/pipeline/gollum_tags_pipeline.rb b/lib/banzai/pipeline/gollum_tags_pipeline.rb new file mode 100644 index 00000000000..1f98d3a183a --- /dev/null +++ b/lib/banzai/pipeline/gollum_tags_pipeline.rb @@ -0,0 +1,13 @@ +require 'banzai' + +module Banzai + module Pipeline + class GollumTagsPipeline < BasePipeline + def self.filters + [ + Filter::GollumTagsFilter + ] + end + end + end +end diff --git a/lib/banzai/pipeline/wiki_pipeline.rb b/lib/banzai/pipeline/wiki_pipeline.rb new file mode 100644 index 00000000000..4635a8d6471 --- /dev/null +++ b/lib/banzai/pipeline/wiki_pipeline.rb @@ -0,0 +1,9 @@ +require 'banzai' + +module Banzai + module Pipeline + class WikiPipeline < CombinedPipeline.new(PlainMarkdownPipeline, GollumTagsPipeline, GfmPipeline) + + end + end +end diff --git a/spec/helpers/gitlab_markdown_helper_spec.rb b/spec/helpers/gitlab_markdown_helper_spec.rb index 762ec25c4f5..9a05b21335c 100644 --- a/spec/helpers/gitlab_markdown_helper_spec.rb +++ b/spec/helpers/gitlab_markdown_helper_spec.rb @@ -121,12 +121,13 @@ describe GitlabMarkdownHelper do before do @wiki = double('WikiPage') allow(@wiki).to receive(:content).and_return('wiki content') + helper.instance_variable_set(:@project_wiki, @wiki) end - it "should use GitLab Flavored Markdown for markdown files" do + it "should use Wiki pipeline for markdown files" do allow(@wiki).to receive(:format).and_return(:markdown) - expect(helper).to receive(:markdown).with('wiki content') + expect(helper).to receive(:markdown).with('wiki content', pipeline: :wiki, project_wiki: @wiki) helper.render_wiki_content(@wiki) end |