FEATURE: Allow multiple html builders to be registered via plugins

This commit is contained in:
Robin Ward
2017-11-03 11:32:32 -04:00
parent 93633865d9
commit 2f0c9793f1
3 changed files with 13 additions and 4 deletions

View File

@@ -137,11 +137,13 @@ class DiscoursePluginRegistry
end
def self.register_html_builder(name, &block)
html_builders[name] = block
html_builders[name] ||= []
html_builders[name] << block
end
def self.build_html(name, ctx = nil)
html_builders[name]&.call(ctx)
builders = html_builders[name] || []
builders.map { |b| b.call(ctx) }.join("\n")
end
def javascripts