class SlackMarkdown::Filters::BoldFilter

Constants

BOLD_PATTERN

Public Instance Methods

bold_filter(text) click to toggle source
# File lib/slack_markdown/filters/bold_filter.rb, line 23
def bold_filter(text)
  text.gsub(BOLD_PATTERN) do
    "<b>#{$1}</b>"
  end
end
call() click to toggle source
# File lib/slack_markdown/filters/bold_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 = bold_filter(content)
    next if html == content
    node.replace(html)
  end
  doc
end