lib/reverse_adoc/converters/blockquote.rb in reverse_adoc-0.3.7 vs lib/reverse_adoc/converters/blockquote.rb in reverse_adoc-1.0.0

- old
+ new

@@ -1,16 +1,25 @@ module ReverseAdoc module Converters class Blockquote < Base - def convert(node, state = {}) - id = node['id'] - anchor = id ? "[[#{id}]]\n" : "" - cite = node['cite'] - attrs = cite ? "[quote, #{cite}]\n" : "" + 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) - #"\n\n> " << content.lines.to_a.join('> ') << "\n\n" - "\n\n#{attrs}____\n" << content.lines.to_a.join('') << "\n____\n\n" + Coradoc::Element::Block::Quote.new(nil, lines: content, + attributes: attributes) + end + + def convert(node, state = {}) + Coradoc::Generator.gen_adoc(to_coradoc(node, state)) end end register :blockquote, Blockquote.new end