lib/wlang/command.rb in wlang-2.0.0.beta vs lib/wlang/command.rb in wlang-2.0.0

- old
+ new

@@ -43,18 +43,17 @@ end def execute(argv) install(argv) - compiler = @dialect.compiler(@compiling_options) if @ast require 'awesome_print' - ap compiler.ast(@template) + ap @template.to_ast end with_output do |output| - compiler.compile(@template).render(@context, output) + @template.render(@context, output) end end private @@ -69,18 +68,11 @@ # dialect require 'wlang/html' @dialect = WLang::Html # template and context - @template = File.read(@tpl_file) + @template = Template.new(File.read(@tpl_file), @compiling_options) @context = {} - - if @yaml_front_matter and - @template =~ /^(---\s*\n.*?\n?)^(---\s*$\n?)/m - require 'yaml' - @context.merge! YAML::load($1) - @template = $' - end end def with_output(&proc) if @output File.open(@output, 'w', &proc) \ No newline at end of file