1
0
Fork 0
mirror of https://github.com/haml/haml.git synced 2022-11-09 12:33:31 -05:00
haml--haml/lib/hamlit/engine.rb
2015-04-12 18:53:59 +09:00

33 lines
682 B
Ruby

require 'temple'
require 'hamlit/compiler'
require 'hamlit/html'
require 'hamlit/parser'
module Hamlit
class Engine < Temple::Engine
define_options(
generator: Temple::Generators::ArrayBuffer,
format: :html,
attr_quote: "'",
escape_html: true,
)
use Parser
use Compiler
use HTML
filter :Escapable
filter :ControlFlow
filter :MultiFlattener
filter :StaticMerger
use :Generator, -> { create(options[:generator]) }
private
def create(klass)
valid_options = options.to_hash.select do |key, value|
klass.options.valid_key?(key)
end
klass.new(valid_options)
end
end
end