jekyll-round-filter

jekyll-round-filter

A Liquid filter to round floats in Jekyll templates

jekyll-round-filter

This Liquid filter lets you round floats in Jekyll templates to a given precision in decimal digits.

Installation

Copy jekyll-round-filter.rb file into _plugins directory.

Usage

{{ float | round: precision }}

Examples:

{{ 512.4562 | round }}      => 512
{{ 512.4562 | round: 2 }}   => 512.46

Reference:

http://ruby-doc.org/core-1.9.3/Float.html#method-i-round