Class: Slimdown::PageParser
- Inherits:
-
Object
- Object
- Slimdown::PageParser
- Defined in:
- lib/slimdown/page_parser.rb
Overview
Internal class to manage parsing the markdown document.
Instance Method Summary collapse
-
#body ⇒ Kramdown::Document
The parsed markdown document body.
-
#headers ⇒ Hash
A hash of the headers in the document.
-
#initialize(path) ⇒ PageParser
constructor
A new instance of PageParser.
Constructor Details
#initialize(path) ⇒ PageParser
Returns a new instance of PageParser.
8 9 10 11 12 |
# File 'lib/slimdown/page_parser.rb', line 8 def initialize(path) @path = path parse_file end |
Instance Method Details
#body ⇒ Kramdown::Document
The parsed markdown document body.
33 34 35 |
# File 'lib/slimdown/page_parser.rb', line 33 def body Kramdown::Document.new(@body_text) end |
#headers ⇒ Hash
A hash of the headers in the document
Example:
{
"title" => "Test title",
"template" => "test_template",
}
23 24 25 26 27 28 |
# File 'lib/slimdown/page_parser.rb', line 23 def headers head = {} head = YAML.load @header_text unless @header_text == '' head end |