Sha256: b990a6fca7fe28def63086c534e5336dd7a038448d59761668a641931e3981e7

Contents?: true

Size: 670 Bytes

Versions: 1

Compression:

Stored size: 670 Bytes

Contents

# encoding: utf-8

require "ace/filters"
require "template-inheritance"

layouts = File.join(Dir.pwd, "layouts")
unless TemplateInheritance::Template.paths.include?(layouts)
  TemplateInheritance::Template.paths.unshift(layouts)
end

TemplateInheritance::Template.paths << File.join(Dir.pwd, "content")

module Ace
  class TemplateFilter < Filter
    def call(item, content)
      if item.output_path
        item.output_path = item.output_path.split(".")[0..-2].join(".")
      end

      relative_path = item.original_path.sub("content/", "")
      template = TemplateInheritance::Template.new(relative_path)
      return template.render(item: item)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ace-0.1 lib/ace/filters/template.rb