Use the WikiPipeline when rendering the wiki markdown content

This commit is contained in:
Douglas Barbosa Alexandre 2016-01-12 02:10:08 -02:00
parent a6a5990ee5
commit 4872b319c8
4 changed files with 26 additions and 3 deletions

View file

@ -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

View file

@ -0,0 +1,13 @@
require 'banzai'
module Banzai
module Pipeline
class GollumTagsPipeline < BasePipeline
def self.filters
[
Filter::GollumTagsFilter
]
end
end
end
end

View file

@ -0,0 +1,9 @@
require 'banzai'
module Banzai
module Pipeline
class WikiPipeline < CombinedPipeline.new(PlainMarkdownPipeline, GollumTagsPipeline, GfmPipeline)
end
end
end

View file

@ -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