Docunext


Rudy Tidy Gem

March 21st, 2010

I just tried using the Ruby Tidy gem, the one hosted at Ruby Forge. Alas, its not compatible with Ruby 1.9.1:

/var/lib/gems/1.9.1/gems/tidy-1.1.2/lib/tidy/tidybuf.rb:5:in `': uninitialized constant DL::Importable (NameError)
	from /var/lib/gems/1.9.1/gems/tidy-1.1.2/lib/tidy/tidybuf.rb:3:in `'
	from /var/lib/gems/1.9.1/gems/tidy-1.1.2/lib/tidy.rb:25:in `require'
	from /var/lib/gems/1.9.1/gems/tidy-1.1.2/lib/tidy.rb:25:in `'
	from /var/lib/gems/1.9.1/gems/tidy-1.1.2/lib/tidy.rb:21:in `'

Thankfully, there is another Tidy Gem which is! As an added bonus, it uses the ffi gem. As a side note, the ffi gem is awesome!

It actually took some digging to find it, so here's a link to the github project:

And the author's website:

The docs are a bit sparse, so here's an example of how I'm using it:

TidyFFI::Tidy.new(output, :show_body_only => 1, :output_xml => 1, :numeric_entities => 1).clean

Basically, tidy options can be used when their hyphens (-) are switched with underscores (_).

Yearly Indexes: 2003 2004 2006 2007 2008 2009 2010 2011 2012 2013 2015 2019 2020 2022