Class: Coradoc::Input::HTML::Converters::Pre

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

Instance Method Summary collapse

Methods inherited from Base

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

Instance Method Details

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



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/coradoc/input/html/converters/pre.rb', line 4

def to_coradoc(node, state = {})
  id = node["id"]
  lang = language(node)
  content = treat_children(node, state)

  unless lang
    return Coradoc::Element::Block::Literal.new(
      nil,
      lines: content,
      id: id,
    )
  end

  Coradoc::Element::Block::SourceCode.new(
    nil,
    lines: content,
    lang: lang,
    id: id,
  )
end