2015-10-21 06:18:23 -04:00
|
|
|
module Gitlab
|
|
|
|
module Markdown
|
|
|
|
class Pipeline
|
2015-11-19 10:18:13 -05:00
|
|
|
def self.[](name)
|
|
|
|
name ||= :full
|
2015-12-15 09:51:16 -05:00
|
|
|
const_get("#{name.to_s.camelize}Pipeline")
|
2015-11-19 10:18:13 -05:00
|
|
|
end
|
|
|
|
|
2015-10-21 06:18:23 -04:00
|
|
|
def self.filters
|
|
|
|
[]
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.transform_context(context)
|
|
|
|
context
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.html_pipeline
|
|
|
|
@html_pipeline ||= HTML::Pipeline.new(filters)
|
|
|
|
end
|
|
|
|
|
|
|
|
class << self
|
|
|
|
%i(call to_document to_html).each do |meth|
|
|
|
|
define_method(meth) do |text, context|
|
|
|
|
context = transform_context(context)
|
|
|
|
|
|
|
|
html_pipeline.send(meth, text, context)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|