Project

orph

0.0
No commit activity in last 3 years
No release in over 3 years
Orphans (commonly referred to as 'widows') are single-word lines at the end of paragraphs. This library removes them with non-breaking spaces.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

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:0x000001008e7578 @content_tags=["h1", "h2", "h3", "h4", "h5", "h6", "p", "li", "blockquote", "dt", "dd"]> 

>> orph.fix("<p>Here's some content.</p>")
=> "<p>Here's some&#160;content.</p>" 

>> orph.fix "<p><span>some content</span><span>more content</span></p>"
=> "<p><span>some content</span><span>more&#160;content</span></p>" 

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

>> orph.fix "<p><span>some content</span><span>more content</span></p>"
=> "<p><span>some&#160;content</span><span>more&#160;content</span></p>"

(c) 2011 David Eisinger