The ELC Community Blog
A knowledge exchange on Ruby on Rails and Agile Development
Liquid Filter Extensions
by josh on March 24, 2007
Inspired by the need to truncate text containing html tags without losing any closing tags, Ryan and I have created a plugin that we're hoping others will add to. The plugin is called LiquidFilterExtensions and hosts extensions to Liquid's StandardFilters module.
Currently, it has two methods for preserving the tag structure of truncated elements.
The methods are called truncate_with_closing_tags and truncatewords_with_closing_tags and operate the same way as truncate and truncatewords:
1 {{ article.body | truncatewords_with_closing_tags: 56 }}
We're hoping this plugin will grow to include all the useful helpers we all wish were included in Liquid.
Start using it right away by checking it out of our repository:
1 svn export http://svn.elctech.com/svn/public/liquid_filter_extensions/ vendor/plugins/liquid_filter_extensions/
Timeline
- DRY validates_inclusion_of with introspection
- HTTP Auth with Restful Authentication
- TuneCore covered on TUAW!
- TabTerm Release
- write_inheritable_attribute.............. and friends !
- Liquid Filter Extensions
- Using and Testing Rails with Multiple Databases
- Securing your Models
- Installing RMagick properly in OSX
- RubyGems 0.91 and the "refresh" error
- ActiveRecord attribute update semantics
Comments