Class: Marsdawn::Source

Inherits:
Object
  • Object
show all
Defined in:
lib/marsdawn/source.rb,
lib/marsdawn/source/document.rb,
lib/marsdawn/source/front_matter.rb

Defined Under Namespace

Classes: Document, FrontMatter

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ Source

Returns a new instance of Source.



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/marsdawn/source.rb', line 10

def initialize path
  @path = File.expand_path(path)
  raise "No source directory '#{@path}'." unless File.exists?(@path)
  @doc_info = {
    key: nil,
    lang: 'en',
    title: '',
    version: '0.0.0',
    markdown_extname: '.md',
    directory_index: '.index.md',
    encoding: 'utf-8',
    link_defs: {},
    kramdown_options: {}
  }
  load_doc_info
  investigate
end

Instance Attribute Details

#doc_infoObject (readonly)

Returns the value of attribute doc_info.



8
9
10
# File 'lib/marsdawn/source.rb', line 8

def doc_info
  @doc_info
end

#local2uriObject (readonly)

Returns the value of attribute local2uri.



8
9
10
# File 'lib/marsdawn/source.rb', line 8

def local2uri
  @local2uri
end

Instance Method Details

#each_contents(options) ⇒ Object



28
29
30
31
32
# File 'lib/marsdawn/source.rb', line 28

def each_contents options
  @local2uri.each do |file, uri|
    yield uri, markdown(file, uri, options), @front_matter[uri], @sysinfo[uri]
  end
end