Class: Coradoc::Input::HTML::Converters::Head

Inherits:
Base
  • Object
show all
Defined in:
lib/coradoc/input/html/converters/head.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



9
10
11
12
13
14
# File 'lib/coradoc/input/html/converters/head.rb', line 9

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

  title.text
end

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



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

def to_coradoc(node, _state = {})
  title = extract_title(node)
  Coradoc::Element::Header.new(title)
end