Project

ragadjust

0.0
Low commit activity in last 3 years
No release in over a year
Gem to rag-adjust text content based on Mark Boulton's 24ways article: http://24ways.org/2013/run-ragged/ and Nathan Ford's JS implementation: https://github.com/nathanford/ragadjust
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 1.6
>= 0

Runtime

 Project Readme

Ragadjust

Gem to rag-adjust text content based on Mark Boulton's 24ways article: http://24ways.org/2013/run-ragged/ and Nathan Ford's JS implementation: https://github.com/nathanford/ragadjust

Installation

Add this line to your application's Gemfile:

gem 'ragadjust'

And then execute:

$ bundle

Or install it yourself as:

$ gem install ragadjust

Usage

Ragadjust::Adjust.ragadjust_content(text_to_adjust, selector, method, orphans)

selector takes a CSS selector and defaults to:

 'p, li, dd, figcaption'

method options:

'all' - default: apply adjustment to all the below
'prepositions' - only rag-adjust prepositions
'small-words' - only adjust 1-/2-letter words
'dashes' - only adjust space after dashes
'emphasis' - only adjust within emphasis tags (em, strong, i, b)

orphans defaults to true and will add a non-breaking space before the last word in an h1-h6 tag

Contributing

  1. Fork it ( https://github.com/aperfect/ragadjust/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

Questions or suggestions, please email github@adamperfect.com