Orph

Orphans (commonly referred to as 'widows') are single-word lines at the end of paragraphs and are generally considered bad form by type nerds. This library removes them with non-breaking spaces.

Usage

>> orph = Orph.new
=> # 

>> orph.fix("

Here's some content.

") => "

Here's some content.

" >> orph.fix "

some contentmore content

" => "

some contentmore content

" >> orph.content_tags << "span" => ["h1", "h2", "h3", "h4", "h5", "h6", "p", "li", "blockquote", "dt", "dd", "span"] >> orph.fix "

some contentmore content

" => "

some contentmore content

"

(c) 2011 David Eisinger