Use the WikiPipeline when rendering the wiki markdown content
This commit is contained in:
parent
a6a5990ee5
commit
4872b319c8
4 changed files with 26 additions and 3 deletions
|
@ -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
|
||||
|
|
13
lib/banzai/pipeline/gollum_tags_pipeline.rb
Normal file
13
lib/banzai/pipeline/gollum_tags_pipeline.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
require 'banzai'
|
||||
|
||||
module Banzai
|
||||
module Pipeline
|
||||
class GollumTagsPipeline < BasePipeline
|
||||
def self.filters
|
||||
[
|
||||
Filter::GollumTagsFilter
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
9
lib/banzai/pipeline/wiki_pipeline.rb
Normal file
9
lib/banzai/pipeline/wiki_pipeline.rb
Normal file
|
@ -0,0 +1,9 @@
|
|||
require 'banzai'
|
||||
|
||||
module Banzai
|
||||
module Pipeline
|
||||
class WikiPipeline < CombinedPipeline.new(PlainMarkdownPipeline, GollumTagsPipeline, GfmPipeline)
|
||||
|
||||
end
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue