0.0
A long-lived project that still receives updates
An executable and a Ruby library for wrapping paragraphs of text.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 2.7
~> 5.6
~> 13.0
~> 6.0
~> 1.0
 Project Readme

Lovely Rufus

Lovely Rufus is an executable and a Ruby library for wrapping paragraphs of text in the spirit of Par.

Usage

Lovely Rufus can be used from the command-line by piping text through the lovely-rufus executable:

$ echo 'The Ballyshannon foundered off the coast of Cariboo, And down in fathoms many went the captain and the crew;' | lovely-rufus
The Ballyshannon foundered off the coast of Cariboo,
And down in fathoms many went the captain and the crew;

Lovely Rufus can also be used from Ruby code through the wrap method:

$ irb
>> require 'lovely_rufus'
>> text = 'The Ballyshannon foundered off the coast of Cariboo, And down in fathoms many went the captain and the crew;'
>> puts LovelyRufus.wrap(text)
The Ballyshannon foundered off the coast of Cariboo,
And down in fathoms many went the captain and the crew;

Note that wrap can take optional desired width:

$ irb
>> require 'lovely_rufus'
>> text = 'The Ballyshannon foundered off the coast of Cariboo, And down in fathoms many went the captain and the crew;'
>> puts LovelyRufus.wrap(text, width: 15)
The
Ballyshannon
foundered off
the coast of
Cariboo, And
down in fathoms
many went the
captain and
the crew;

Features

Currently, Lovely Rufus sports the following features:

  • paragraphs are wrapped to the specified width,
  • one-letter words are not left at ends of lines,
  • email quotes (>) are handled properly and normalised (> > >>>>),
  • email-quoted paragraph breaks are cleared,
  • code comments (starting with # and //) are handled properly,
  • multiple paragraphs are wrapped independently.

Name and history

Lovely Rufus was created as a Ruby Mendicant University project and is named after a certain Love Actually character who’s exceptionally good at wrapping.


© MMX-MMXIX Piotr Szotkowski chastell@chastell.net, licensed under AGPL-3.0 (see LICENCE)