Class: HTML::Pipeline::AutoAbbrFilter

Inherits:
AbbrFilter
  • Object
show all
Defined in:
lib/html/pipeline/auto_abbr_filter.rb

Overview

Similar to abbreviate but it starts with the long format and shortens it

Constant Summary

Constants inherited from AbbrFilter

HTML::Pipeline::AbbrFilter::DEFAULT_IGNORED_ANCESTOR_TAGS, HTML::Pipeline::AbbrFilter::DEFINITION_PATTERN

Instance Method Summary collapse

Methods inherited from AbbrFilter

#call

Instance Method Details

#abbr_filter(content, abbr, full) ⇒ Object



6
7
8
9
# File 'lib/html/pipeline/auto_abbr_filter.rb', line 6

def abbr_filter(content, abbr, full)
  target_html = abbr_tag(abbr, full)
  content.gsub(/\b#{full}\b/) { |_| target_html } || content
end