- def autolink(link, link_type)
- if link_type == :email
- "<a rel=\"nofollow\" href=\"mailto:#{link}\">#{link}</a>"
+ def first_paragraph_element(element)
+ return element if paragraph?(element)
+
+ element.children.find do |child|
+ nested_paragraph = first_paragraph_element(child)
+ break nested_paragraph if nested_paragraph
+ end
+ end
+
+ def truncated_text_content(element)
+ text = ""
+
+ append_text = lambda do |child|
+ if child.type == :text
+ text << child.value