Class: ReverseAdoc::Converters::Blockquote

Inherits:
Base
  • Object
show all
Defined in:
lib/reverse_adoc/converters/blockquote.rb

Instance Method Summary collapse

Methods inherited from Base

#constrained?, #escape_keychars, #extract_title, #node_has_ancestor?, #textnode_before_end_with?, #treat, #treat_children, #treat_children_coradoc, #treat_coradoc, #unconstrained_after?, #unconstrained_before?

Instance Method Details

#convert(node, state = {}) ⇒ Object



20
21
22
# File 'lib/reverse_adoc/converters/blockquote.rb', line 20

def convert(node, state = {})
  Coradoc::Generator.gen_adoc(to_coradoc(node, state))
end

#to_coradoc(node, state = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/reverse_adoc/converters/blockquote.rb', line 4

def to_coradoc(node, state = {})
  node["id"]
  cite = node["cite"]
  attributes = if cite.nil?
                 nil
               else
                 Coradoc::Element::AttributeList.new(
                   "quote", cite
                 )
               end
  content = treat_children(node, state).strip
  content = ReverseAdoc.cleaner.remove_newlines(content)
  Coradoc::Element::Block::Quote.new(nil, lines: content,
                                          attributes: attributes)
end