Class: Mastalk::Document
- Inherits:
-
Object
- Object
- Mastalk::Document
- Includes:
- Extensions
- Defined in:
- lib/mastalk/document.rb
Overview
Document class to preprocess mastalk specific syntax
Constant Summary
Constants included from Extensions
Instance Attribute Summary collapse
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(source) ⇒ Document
constructor
A new instance of Document.
- #to_html(options = {}) ⇒ Object
Methods included from Extensions
#args, #extension, #extensions, #remove_syntax_from
Constructor Details
#initialize(source) ⇒ Document
Returns a new instance of Document.
13 14 15 |
# File 'lib/mastalk/document.rb', line 13 def initialize(source) @source = source.dup end |
Instance Attribute Details
#source ⇒ Object (readonly)
Returns the value of attribute source.
11 12 13 |
# File 'lib/mastalk/document.rb', line 11 def source @source end |
Instance Method Details
#to_html(options = {}) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/mastalk/document.rb', line 17 def to_html( = {}) auto_ids = [:auto_id].nil? ? true : [:auto_ids] kramdown = Kramdown::Document.new( preprocess(source), auto_ids: auto_ids ) html, _ = Kramdown::Converter::Html.convert(kramdown.root, kramdown.) ::HTMLEntities.new.decode(html) end |