Sha256: deadfeb7306a46f2153a6efb01f7b222d1542e796d4a13708ab60175b62a836b
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
module PufferPages module Liquid class FileSystem < ::Liquid::BlankFileSystem def read_template_file(template_path, context) case template_type template_path when :snippet then template_path = template_path.gsub(/^snippets\//, '') snippet = ::Snippet.find_by_name(template_path) raise ::Liquid::FileSystemError, "No such snippet '#{template_path}' found" unless snippet snippet.body when :layout then template_path = template_path.gsub(/^layouts\//, '') layout = ::Layout.find_by_name(template_path) raise ::Liquid::FileSystemError, "No such layout '#{template_path}' found" unless layout layout.body when :page_part then page_part = context.registers[:page].part(template_path) raise ::Liquid::FileSystemError, "No such page_part '#{template_path}' found for current page" unless page_part page_part.body end end def template_type template_path return :snippet if template_path.start_with? 'snippets/' return :layout if template_path.start_with? 'layouts/' return :page_part end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
puffer_pages-0.1.1 | lib/puffer_pages/liquid/file_system.rb |
puffer_pages-0.1.0 | lib/puffer_pages/liquid/file_system.rb |