Sha256: 0ace8c58997d73a783af2e1e310dcdcf415776b7bf372c4398a451d1f17db719

Contents?: true

Size: 885 Bytes

Versions: 2

Compression:

Stored size: 885 Bytes

Contents

# -*- encoding : utf-8 -*-
require 'coffee-script'
require 'uglifier'

include Machine
include MachineInput

def compile_coffee script
  ::CoffeeScript.compile script
rescue =>e
  e
end

machine_input do 
  Uglifier.compile( compile_coffee format(:js)._render_raw )
end

store_machine_output :filetype => "js"

def clean_html?
  false
end


format do
  def chunk_list  #turn off autodetection of uri's 
    :inclusion_only
  end
end


format :html do
  view :editor, :mod=>PlainText::HtmlFormat

  view :content_changes do |args|
    %{
      <pre>#{super(args)}</pre>
    }
  end
  
  view :core do |args|
    js = card.compile_coffee _render_raw
    highlighted_js = ::CodeRay.scan( js, :js ).div
    process_content highlighted_js
  end
  
end


format do  
  view :core do |args|
    process_content card.compile_coffee(_render_raw)
  end
end

def diff_args
   {:format=>:text}
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wagn-1.14.9 mod/03_machines/set/type/coffee_script.rb
wagn-1.14.8 mod/03_machines/set/type/coffee_script.rb