Class: RTFDoc::AttributesComponent
- Inherits:
-
Object
- Object
- RTFDoc::AttributesComponent
- Defined in:
- lib/rtfdoc.rb
Class Method Summary collapse
-
.private_renderer ⇒ Object
Needed because we can’t call the same rendered within itself.
Instance Method Summary collapse
-
#initialize(raw_attrs, title) ⇒ AttributesComponent
constructor
A new instance of AttributesComponent.
- #to_html(text) ⇒ Object
Constructor Details
#initialize(raw_attrs, title) ⇒ AttributesComponent
Returns a new instance of AttributesComponent.
20 21 22 23 |
# File 'lib/rtfdoc.rb', line 20 def initialize(raw_attrs, title) @attributes = YAML.load(raw_attrs) @title = title end |
Class Method Details
.private_renderer ⇒ Object
Needed because we can’t call the same rendered within itself.
11 12 13 14 15 16 17 18 |
# File 'lib/rtfdoc.rb', line 11 def self.private_renderer @renderer ||= Redcarpet::Markdown.new(::RTFDoc::Renderer, { underline: true, space_after_headers: true, fenced_code_blocks: true, no_intra_emphasis: true }) end |
Instance Method Details
#to_html(text) ⇒ Object
30 31 32 |
# File 'lib/rtfdoc.rb', line 30 def to_html(text) self.class.private_renderer.render(text) if text end |