Class: Coradoc::Input::Html::Converters::Text

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

Constant Summary collapse

INSTANCE =
new

Instance Method Summary collapse

Methods inherited from Base

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

Instance Method Details

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



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/coradoc/html/input/converters/text.rb', line 10

def to_coradoc(node, state = {})
  return treat_empty(node, state) if node.text.strip.empty?

  # HTML cleanup is performed in the converter layer
  cleaned_content = cleanup_html_text(node.text)

  # Return as CoreModel::InlineElement with format_type "text"
  Coradoc::CoreModel::TextElement.new(
    content: cleaned_content
  )
end