Class: JekyllPagesApi::Filters
- Inherits:
-
Object
- Object
- JekyllPagesApi::Filters
- Includes:
- Liquid::StandardFilters
- Defined in:
- lib/jekyll_pages_api/filters.rb
Overview
This is a hack to allow the module functions to be used
Instance Method Summary collapse
-
#condense(str) ⇒ Object
Slight tweak of github.com/Shopify/liquid/blob/v2.6.1/lib/liquid/standardfilters.rb#L71-L74 to replace newlines with spaces.
- #decode_html(str) ⇒ Object
- #text_only(str) ⇒ Object
Instance Method Details
#condense(str) ⇒ Object
Slight tweak of github.com/Shopify/liquid/blob/v2.6.1/lib/liquid/standardfilters.rb#L71-L74 to replace newlines with spaces.
16 17 18 |
# File 'lib/jekyll_pages_api/filters.rb', line 16 def condense(str) str.to_s.gsub(/\s+/m, ' '.freeze).strip end |
#decode_html(str) ⇒ Object
9 10 11 |
# File 'lib/jekyll_pages_api/filters.rb', line 9 def decode_html(str) html_decoder.decode(str) end |
#text_only(str) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/jekyll_pages_api/filters.rb', line 20 def text_only(str) # apply each filter in order [ :strip_html, :condense, :decode_html, :strip_html, :condense ].reduce(str) do |result, filter| self.send(filter, result) end end |