Class: HTML::Pipeline::ShortenFilter
- Inherits:
-
AbbrFilter
- Object
- Filter
- AbbrFilter
- HTML::Pipeline::ShortenFilter
- Defined in:
- lib/html/pipeline/shorten_filter.rb
Overview
Similar to abbreviate but it starts with the long format and shortens it
Constant Summary
Constants inherited from AbbrFilter
AbbrFilter::DEFAULT_IGNORED_ANCESTOR_TAGS, AbbrFilter::DEFINITION_PATTERN
Instance Method Summary collapse
- #abbr_filter(content, abbr, full) ⇒ Object
-
#abbrs_filter(content, abbrs) ⇒ String
Return html with abbreviations replaced.
Methods inherited from AbbrFilter
Instance Method Details
#abbr_filter(content, abbr, full) ⇒ Object
17 18 19 20 |
# File 'lib/html/pipeline/shorten_filter.rb', line 17 def abbr_filter(content, abbr, full) target_html = abbr_tag(abbr, full) content.gsub(full) { |_| target_html } end |
#abbrs_filter(content, abbrs) ⇒ String
Return html with abbreviations replaced
10 11 12 13 14 15 |
# File 'lib/html/pipeline/shorten_filter.rb', line 10 def abbrs_filter(content, abbrs) abbrs.each do |abbr, full| content = abbr_filter(content, abbr, full) if content.include?(full) end content end |