Class: Hx::Output::LiquidTemplate::TemplateSource

Inherits:
Object
  • Object
show all
Includes:
Filter
Defined in:
lib/hx/output/liquidtemplate.rb

Instance Method Summary collapse

Methods included from Filter

#each_entry

Methods included from View

#each_entry, #edit_entry

Constructor Details

#initialize(options) ⇒ TemplateSource

Returns a new instance of TemplateSource.



66
67
68
69
70
71
72
# File 'lib/hx/output/liquidtemplate.rb', line 66

def initialize(options)
  # global, so all LiquidTemplate instances have to agree on the
  # same template directory for things to work right
  @template_dir = Hx.get_pathname(options, :template_dir)
  Liquid::Template.file_system = Liquid::LocalFileSystem.new(@template_dir)
  Liquid::Template.register_filter(TextFilters)
end

Instance Method Details

#each_entry_path(selector) ⇒ Object



74
75
76
77
# File 'lib/hx/output/liquidtemplate.rb', line 74

def each_entry_path(selector)
  # enumeration currently unneeded
  self
end

#get_entry(path) ⇒ Object



79
80
81
82
# File 'lib/hx/output/liquidtemplate.rb', line 79

def get_entry(path)
  template_file = @template_dir + "#{path}.liquid"
  {"template" => Liquid::Template.parse(template_file.read)}
end