class SlackMarkdown::Filters::MultipleCodeFilter
Constants
- CODE_PATTERN
Public Instance Methods
call()
click to toggle source
# File lib/slack_markdown/filters/multiple_code_filter.rb, line 11 def call doc.search('.//text()').each do |node| content = node.to_html next if has_ancestor?(node, ignored_ancestor_tags) next unless content.include?('`') html = multiple_code_filter(content) next if html == content node.replace(html) end doc end
Private Instance Methods
multiple_code_filter(text)
click to toggle source
# File lib/slack_markdown/filters/multiple_code_filter.rb, line 25 def multiple_code_filter(text) text.gsub(CODE_PATTERN) do "<pre><code>#{$1}</code></pre>" end end