Module: Murdoc

Defined in:
lib/murdoc/annotator.rb,
lib/murdoc.rb,
lib/murdoc/formatter.rb,
lib/murdoc/paragraph.rb,
lib/murdoc/languages/ruby.rb,
lib/murdoc/languages/javascript.rb

Overview

Javascript language module

Defined Under Namespace

Modules: Languages Classes: Annotator, Formatter, Paragraph

Class Method Summary collapse

Class Method Details

.default_optionsObject



21
22
23
24
25
26
27
# File 'lib/murdoc.rb', line 21

def self.default_options
  markup_dir = File.dirname(__FILE__)+ "/../markup"
  @@options ||= {
      :template =>   "#{markup_dir}/template.haml",
      :stylesheet => "#{markup_dir}/stylesheet.css"
  }
end

.generate_from_file(input, output, options = {}) ⇒ Object



13
14
15
16
17
18
19
# File 'lib/murdoc.rb', line 13

def self.generate_from_file(input, output, options = {})
  options = default_options.merge(options)
  annotator = Annotator.from_file(input, nil, options)
  File.open(output, "w+") do |f|
    f.puts Formatter.new(options[:template]).render(:paragraphs => annotator.paragraphs, :stylesheet => File.read(options[:stylesheet]))
  end
end