Class: Coradoc::Input::HTML::Converters::Markup
- Defined in:
- lib/coradoc/input/html/converters/markup.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, #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 24 |
# File 'lib/coradoc/input/html/converters/markup.rb', line 4 def to_coradoc(node, state = {}) u_before = unconstrained_before?(node) u_after = unconstrained_after?(node) leading_whitespace, trailing_whitespace = extract_leading_trailing_whitespace(node) content = treat_children_coradoc(node, state) if node_has_ancestor?(node, markup_ancestor_tag_names) content elsif node.children.empty? leading_whitespace.to_s else u = (u_before && leading_whitespace.nil?) || (u_after && trailing_whitespace.nil?) e = coradoc_class.new(content, unconstrained: u) [leading_whitespace, e, trailing_whitespace] end end |