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