Class: Sourcerer::MarkDownGrade::BlockquoteWithAbstract
- Inherits:
-
ReverseMarkdown::Converters::Base
- Object
- ReverseMarkdown::Converters::Base
- Sourcerer::MarkDownGrade::BlockquoteWithAbstract
- Defined in:
- lib/sourcerer/mark_down_grade.rb
Overview
Preserve abstract content as plain text instead of markdown blockquote.
Instance Method Summary collapse
- #convert(node, state = {}) ⇒ Object
-
#initialize ⇒ BlockquoteWithAbstract
constructor
A new instance of BlockquoteWithAbstract.
Constructor Details
#initialize ⇒ BlockquoteWithAbstract
Returns a new instance of BlockquoteWithAbstract.
173 174 175 176 |
# File 'lib/sourcerer/mark_down_grade.rb', line 173 def initialize super @default = ReverseMarkdown::Converters::Blockquote.new end |
Instance Method Details
#convert(node, state = {}) ⇒ Object
178 179 180 181 182 183 184 185 |
# File 'lib/sourcerer/mark_down_grade.rb', line 178 def convert node, state={} classes = node.parent&.[]('class').to_s.split if (classes.include?('abstract') || classes.include?('quote-block')) && classes.include?('abstract') return "#{treat_children(node, state).strip}\n\n" end @default.convert(node, state) end |