Class: Coradoc::Input::HTML::Converters::Figure

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/input/html/converters/figure.rb

Instance Method Summary collapse

Methods inherited from Base

#convert, #extract_leading_trailing_whitespace, #node_has_ancestor?, #textnode_after_start_with?, #textnode_before_end_with?, #treat, #treat_children, #treat_children_coradoc, #treat_coradoc, #unconstrained_after?, #unconstrained_before?

Instance Method Details

#extract_title(node) ⇒ Object



11
12
13
14
15
16
# File 'lib/coradoc/input/html/converters/figure.rb', line 11

def extract_title(node)
  title = node.at("./figcaption")
  return "" if title.nil?

  treat_children_coradoc(title, {})
end

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



4
5
6
7
8
9
# File 'lib/coradoc/input/html/converters/figure.rb', line 4

def to_coradoc(node, state = {})
  id = node["id"]
  title = extract_title(node)
  content = treat_children_coradoc(node, state)
  Coradoc::Element::Block::Example.new(title, lines: content, id: id)
end