0.0
No commit activity in last 3 years
No release in over 3 years
A Jekyll plugin for dealing with money. Enhanced from the original jekyll-money gem.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.12
~> 10.0
~> 3.0

Runtime

~> 4.0
~> 6.14
 Project Readme

Jekyll Money2

A Jekyll plugin for dealing with money. Because we all have to at some point.

Works by extending the functionality of the popular money RubyGem. Intends to become a full-featured way to work with money in Jekyll. It starts with a simple filter to enable the common use case of formatting of international currencies. In time the plugin should be extended to create a Tag enabling arithmetic, comparisons and currency conversion.

Notice on forked repo

The original repository for this gem can be found at https://git.habd.as/jhabdas/jekyll-money. The author stated that he is not actively working on the repo. This version was forked from that private Git server, moderately modified, and now lives on Github.

Installation

Add this line to your application's Gemfile:

gem 'jekyll-money2'

And then execute:

$ bundle

Or install it yourself as:

$ gem install jekyll-money2

Then, in your _config.yml file, add to or make a new array with the key plugins and the values of the gem names of the plugins you'd like to use. In this case:

plugins:
  - jekyll-money2

Note: If using a version of Jekyll below 3.5.0, use gems: in place of plugins:.

Usage

By default, the money helper formats a value as a USD currency amount using a Liquid filter.

{{ 5000 | money }}

Outputs $50.00

{{ 5000 | money: "GBP" }}

Outputs £50.00

{{ 100000000 | money: "IDR" }}

Outputs Rp1.000.000,00

Alternative Usage

The standard behaviour in the money gem treats all input values as in the base unit of currency. For example, cents for US Dollars.

{{ 1000.00 | money }}

Outputs $10.00 and NOT $1000.00 as one might expect.

Use the money_from_amount to parse a value that includes cents/decimal.

{{ 1000.00 | money_from_amount }}

Outputs $1,000.00

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake test to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests welcome at https://github.com/johnpitchko/jekyll-money.

Credits

This plugin wouldn't be possible without the fine work of:

License

The gem is available as open source under the terms of the MIT License.

Copyright (c) 2021 John Pitchko Copyright (c) 2017 Josh Habdas