lib/munge/helpers/rendering.rb in munge-0.7.0 vs lib/munge/helpers/rendering.rb in munge-0.7.1

- old
+ new

@@ -2,19 +2,19 @@ module Helpers module Rendering def render(item, engines: nil, data: {}, content_override: nil) content = content_override || item.content renderers = tilt_renderer_list(item, engines) - mdata = merged_data(item.frontmatter, data, { self_item: item }) + mdata = merged_data(item.frontmatter, data, self_item: item) render_string(content, data: mdata, engines: renderers) end def layout(item_or_string, data: {}, &block) layout_item = resolve_layout(item_or_string) renderers = tilt_renderer_list(layout_item, nil) - mdata = merged_data(layout_item.frontmatter, data, { self_layout: layout_item }) + mdata = merged_data(layout_item.frontmatter, data, self_layout: layout_item) render_string(layout_item.content, data: mdata, engines: renderers, &block) end def render_string(content, data: {}, engines: [], &block) @@ -23,12 +23,12 @@ capture(&block) end output = engines - .inject(content) do |output, engine| - template = engine.new { output } + .inject(content) do |memo, engine| + template = engine.new { memo } if inner template.render(self, data) { inner } else template.render(self, data) @@ -42,10 +42,10 @@ output end def render_with_layout(item, content_engines: nil, data: {}, content_override: nil) inner = render(item, engines: content_engines, data: data, content_override: content_override) - mdata = merged_data(item.frontmatter, data, { self_item: item }) + mdata = merged_data(item.frontmatter, data, self_item: item) if item.layout layout(item.layout, data: mdata) do inner end