Module: Murdoc
- Defined in:
- lib/murdoc/annotator.rb,
lib/murdoc.rb,
lib/murdoc/formatter.rb,
lib/murdoc/paragraph.rb,
lib/murdoc/languages/html.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_options ⇒ Object
32
33
34
35
36
37
|
# File 'lib/murdoc.rb', line 32
def self.default_options
@@options ||= {
:template => "#{markup_dir}/template.haml",
:stylesheet => "#{markup_dir}/stylesheet.css"
}
end
|
.default_options_for_multiple_files ⇒ Object
39
40
41
42
43
44
|
# File 'lib/murdoc.rb', line 39
def self.default_options_for_multiple_files
@@options ||= {
:template => "#{markup_dir}/template_multifile.haml",
:stylesheet => "#{markup_dir}/stylesheet.css"
}
end
|
.generate_from_file(input, output, options = {}) ⇒ Object
13
14
15
16
17
18
19
20
|
# 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
|
.generate_from_multiple_files(input_files, output, options = {}) ⇒ Object
22
23
24
25
26
27
28
29
30
|
# File 'lib/murdoc.rb', line 22
def self.generate_from_multiple_files(input_files, output, options = {})
options = default_options_for_multiple_files.merge(options)
annotators = input_files.map {|fn| Annotator.from_file(fn, nil, options) }
File.open(output, "w+") do |f|
f.puts Formatter.new(options[:template]).render(:annotators => annotators,
:filenames => input_files,
:stylesheet => File.read(options[:stylesheet]))
end
end
|
.markup_dir ⇒ Object
46
47
48
|
# File 'lib/murdoc.rb', line 46
def self.markup_dir
File.expand_path("../..", __FILE__)+ "/markup"
end
|