Class: MarkdownComposer::DocumentIndex::HtmlParser
- Inherits:
-
Object
- Object
- MarkdownComposer::DocumentIndex::HtmlParser
- Defined in:
- lib/markdown_composer/document_index/html_parser.rb
Instance Attribute Summary collapse
-
#diagnostics ⇒ Object
readonly
Returns the value of attribute diagnostics.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
- #index ⇒ Object
-
#initialize(source, diagnostics:) ⇒ HtmlParser
constructor
A new instance of HtmlParser.
Constructor Details
#initialize(source, diagnostics:) ⇒ HtmlParser
Returns a new instance of HtmlParser.
14 15 16 17 |
# File 'lib/markdown_composer/document_index/html_parser.rb', line 14 def initialize(source, diagnostics:) @source = source @diagnostics = diagnostics end |
Instance Attribute Details
#diagnostics ⇒ Object (readonly)
Returns the value of attribute diagnostics.
12 13 14 |
# File 'lib/markdown_composer/document_index/html_parser.rb', line 12 def diagnostics @diagnostics end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
12 13 14 |
# File 'lib/markdown_composer/document_index/html_parser.rb', line 12 def source @source end |
Instance Method Details
#index ⇒ Object
19 20 21 22 23 |
# File 'lib/markdown_composer/document_index/html_parser.rb', line 19 def index fragment = Nokogiri::HTML5.fragment(source.html.to_s) markdown = html_to_markdown(fragment) DocumentIndex.from_markdown(markdown, source_key: source.key, diagnostics: diagnostics) end |