Class: SlackMarkdown::Filters::LineBreakFilter
- Inherits:
-
HTML::Pipeline::Filter
- Object
- HTML::Pipeline::Filter
- SlackMarkdown::Filters::LineBreakFilter
- Includes:
- IgnorableAncestorTags
- Defined in:
- lib/slack_markdown/filters/line_break_filter.rb
Constant Summary
Constants included from IgnorableAncestorTags
IgnorableAncestorTags::DEFAULT_IGNORED_ANCESTOR_TAGS
Instance Method Summary collapse
Methods included from IgnorableAncestorTags
Instance Method Details
#call ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/slack_markdown/filters/line_break_filter.rb', line 11 def call doc.search(".//text()").each do |node| content = node.to_html next if has_ancestor?(node, ) next unless content.include?("\n") html = content.gsub("\n", '<br>') next if html == content node.replace(html) end doc end |