Sha256: 854e58df19bc558a164273dcb5dd06e5f84978155603960dac8f2a3d7deceb1e
Contents?: true
Size: 659 Bytes
Versions: 6
Compression:
Stored size: 659 Bytes
Contents
module Coradoc::Input::HTML module Converters class Text < Base def to_coradoc(node, state = {}) return treat_empty(node, state) if node.text.strip.empty? Coradoc::Element::TextElement.new(node.text, html_cleanup: true) end private def treat_empty(node, state) parent = node.parent.name.to_sym if %i[ol ul].include?(parent) # Otherwise the identation is broken "" elsif state[:tdsinglepara] "" elsif node.text == " " # Regular whitespace text node " " else "" end end end register :text, Text.new end end
Version data entries
6 entries across 6 versions & 1 rubygems