Class: Marsdawn::Source
- Inherits:
-
Object
- Object
- Marsdawn::Source
- 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
-
#doc_info ⇒ Object
readonly
Returns the value of attribute doc_info.
-
#local2uri ⇒ Object
readonly
Returns the value of attribute local2uri.
Instance Method Summary collapse
- #each_contents(options) ⇒ Object
-
#initialize(path) ⇒ Source
constructor
A new instance of Source.
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.(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_info ⇒ Object (readonly)
Returns the value of attribute doc_info.
8 9 10 |
# File 'lib/marsdawn/source.rb', line 8 def doc_info @doc_info end |
#local2uri ⇒ Object (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 @local2uri.each do |file, uri| yield uri, markdown(file, uri, ), @front_matter[uri], @sysinfo[uri] end end |