lib/octopress-ink/assets/asset.rb in octopress-ink-1.0.0.rc.32 vs lib/octopress-ink/assets/asset.rb in octopress-ink-1.0.0.rc.33

- old
+ new

@@ -101,47 +101,32 @@ def destination File.join(dir, file) end def content - unless @content + @content ||= begin if read =~ FRONT_MATTER - @content = $POSTMATCH + $POSTMATCH else - @content = read + read end end - @content end - # Render file through Liquid if it contains YAML front-matter - # - def render - unless @rendered_content - if asset_payload = payload - @rendered_content = Liquid::Template.parse(content).render!(payload) - else - @rendered_content = content - end - end - - @rendered_content - end - def payload - unless @payload - @payload = Ink.payload - @payload['jekyll'] = { + @payload ||= begin + p = Ink.payload + p['jekyll'] = { 'version' => Jekyll::VERSION, 'environment' => Jekyll.env } - @payload['site'] = Octopress.site.config - @payload['site']['data'] = Octopress.site.site_data - @payload['page'] = data - end + p['site'] = Octopress.site.config + p['site']['data'] = Octopress.site.site_data + p['page'] = data - @payload + p + end end def data if read =~ FRONT_MATTER SafeYAML.load($1) @@ -151,11 +136,11 @@ end private def source_dir - if exists? user_override_path + if exists? user_path user_dir else plugin_dir end end @@ -167,22 +152,18 @@ def plugin_path File.join plugin_dir, file end def user_dir - File.join Octopress.site.source, Plugins.custom_dir, dir + File.join Plugins.custom_dir, dir end def local_plugin_path File.join Octopress.site.source, dir, file end - def user_override_path - File.join user_dir, filename - end - def user_path - user_override_path + File.join user_dir, filename end def file_check if !exists? plugin_path raise "\nPlugin: #{plugin.name}: Could not find #{File.basename(file)} at #{plugin_path}".red