2010-05-30 23:57:33 +00:00
|
|
|
module Locomotive
|
|
|
|
|
|
|
|
module Liquid
|
2010-06-01 00:06:46 +00:00
|
|
|
|
2010-05-30 23:57:33 +00:00
|
|
|
class DbFileSystem
|
|
|
|
|
2010-06-01 00:06:46 +00:00
|
|
|
# Works only with snippets
|
2010-05-30 23:57:33 +00:00
|
|
|
def read_template_file(site, template_path)
|
|
|
|
raise FileSystemError, "Illegal snippet name '#{template_path}'" unless template_path =~ /^[^.\/][a-zA-Z0-9_\/]+$/
|
|
|
|
|
|
|
|
snippet = site.snippets.where(:slug => template_path).first
|
|
|
|
|
|
|
|
raise FileSystemError, "No such snippet '#{template_path}'" if snippet.nil?
|
|
|
|
|
|
|
|
snippet.template
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|