Sha256: 8859895376d8c09e2209da7270394a91da01067ff898412e581ba863ee8125eb

Contents?: true

Size: 792 Bytes

Versions: 14

Compression:

Stored size: 792 Bytes

Contents

require 'slight/config'
require 'slight/engine'

module Slight
  class PrettyRender < Filter
    def self.do(src_data); end
  end

  class PrettyOutput < Filter
  end

  conf = Slight::Configuration.new do |c|
    c.use PrettyRender
    c.use PrettyOutput, :after
    #c.set :pretty_html, true
  end

  custom_engine = Slight::Engine.new(conf)
  io_out = STDOUT

  at_exit{
    io_out.close
  }

  begin
    raise IOError, "source file was not given." if ARGV.length == 0
    src_file = ARGV[0]
    io_out = File.open("#{ARGV[1]}", 'w') if ARGV.size == 2
    io_out.puts default_engine.render(src_file)
  rescue Exception => err
    STDERR.puts err.message
    STDERR.puts [err.inspect, err.backtrace.join("\n")].join("\n")
    exit 1
  end

  exit 0
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
slight-lang-1.3.6 example/custom_engine.rb
slight-lang-1.3.5 example/custom_engine.rb
slight-lang-1.3.4 example/custom_engine.rb
slight-lang-1.3.3 example/custom_engine.rb
slight-lang-1.3.2 example/custom_engine.rb
slight-lang-1.3.1 example/custom_engine.rb
slight-lang-1.3.0 example/custom_engine.rb
slight-lang-1.2.3 example/custom_engine.rb
slight-lang-1.2.1.3 example/custom_engine.rb
slight-lang-1.2.1.2 example/custom_engine.rb
slight-lang-1.2.1.1 example/custom_engine.rb
slight-lang-1.1.6 example/custom_engine.rb
slight-lang-1.2.0 example/custom_engine.rb
slight-lang-1.0.1 example/custom_engine.rb