1. Skip to navigation
  2. Skip to content

The ELC Community Blog

A knowledge exchange on Ruby on Rails and Agile Development


Liquid Filter Extensions

by josh on March 24, 2007

ELC Plugins

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/

Comments

Add a comment


home | services | Ruby on Rails Development | code | blog | company