2018-12-13 13:39:08 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
module Banzai
|
2018-11-08 19:23:39 +05:30
|
|
|
# if you need to render markdown, then you probably need to post_process as well,
|
|
|
|
# such as removing references that the current user doesn't have
|
|
|
|
# permission to make
|
|
|
|
def self.render_and_post_process(text, context = {})
|
|
|
|
post_process(render(text, context), context)
|
|
|
|
end
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
def self.render_field_and_post_process(object, field, context = {})
|
|
|
|
post_process(render_field(object, field, context), context)
|
|
|
|
end
|
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
def self.render(text, context = {})
|
|
|
|
Renderer.render(text, context)
|
|
|
|
end
|
|
|
|
|
2018-03-17 18:26:18 +05:30
|
|
|
def self.render_field(object, field, context = {})
|
|
|
|
Renderer.render_field(object, field, context)
|
2016-11-03 12:29:30 +05:30
|
|
|
end
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
def self.cache_collection_render(texts_and_contexts)
|
|
|
|
Renderer.cache_collection_render(texts_and_contexts)
|
|
|
|
end
|
|
|
|
|
2015-12-23 02:04:40 +05:30
|
|
|
def self.render_result(text, context = {})
|
|
|
|
Renderer.render_result(text, context)
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.post_process(html, context)
|
|
|
|
Renderer.post_process(html, context)
|
|
|
|
end
|
|
|
|
end
|