From: Wim Vander Schelden Date: 2006-12-29T18:26:28+09:00 Subject: Re: Ruby Tidy Arie Kusuma Atmaja wrote: > Mark Dodwell wrote: >> Hi All, >> >> I'm trying to get the Ruby Tidy gem installed but I am having problems. >> I downloaded and installed HTML Tidy from source first, then installed >> Ruby Tidy from the gem: >> >> gem install tidy >> >> And it reports that it went ok: >> >> Bulk updating Gem source index for: http://gems.rubyforge.org >> irbSuccessfully installed tidy-1.1.2 >> Installing ri documentation for tidy-1.1.2... >> Installing RDoc documentation for tidy-1.1.2... >> >> But when I issue 'require 'tidy'' (in my rails 'script/console') it >> reports false, as if it isn't installed. >> >> Any ideas? I'm on OS X 10.4.8 on my workstation and FC5 on my server. >> > > Hi Mark, > I'm on Mac OS X 10.4.8 as well (Powerbook). and i've got no problems > with Tidy here > > sayang:~/mo/tau/direktori/gw/aja/lu/huh/hwek arie$ irb > irb(main):001:0> require 'tidy' > => true > irb(main):004:0> Tidy.path = '/usr/lib/libtidy.dylib' > => "/usr/lib/libtidy.dylib" > irb(main):005:0> html = 'titleBody akeh pokoke > isine merene mrono das des dos i\ntes > tes tes
\n\n
adfdfdfdfd' > => "titleBody akeh pokoke isine merene mrono das des dos i\\ntes tes tes
\\n\\n
/>adfdfdfdfd" > irb(main):006:0> xml = Tidy.open(:show_warnings => true) do |tidy| > irb(main):007:1* tidy.options.output_xml = true > irb(main):008:1> puts tidy.options.show_warnings > irb(main):009:1> xml = tidy.clean(html) > irb(main):010:1> puts tidy.errors > irb(main):011:1> puts tidy.diagnostics > irb(main):012:1> xml > irb(main):013:1> end > true > line 1 column 1 - Warning: missing declaration > line 1 column 9 - Warning: plain text isn't allowed in elements > Info: Document content looks like XHTML 1.0 Transitional > 2 warnings, 0 errors were found! > > => "\n\n />\ntitle\n\nBody akeh pokoke isine merene > mrono \n das des dos \ni\\ntes tes > tes\n
\\n\\n\n
\nadfdfdfdfd\n\n" > irb(main):014:0> puts xml > > > content="HTML Tidy for Mac OS X (vers 1st December 2004), see > www.w3.org" /> > title > > Body akeh pokoke isine merene mrono > das des dos > i\ntes tes tes >
\n\n >
> adfdfdfdfd > > => nil > irb(main):015:0> > > I've had similar problems before, but require doesn't return false on an error. It returns false if the file has been included before and there is not loaded again. When an error occurs, require will throw an Error. Try and use some of the methods from Tidy and see if they work. Kind regards, Wim -- Wim Vander Schelden Bachelor Computer Science, University Ghent http://nanoblog.ath.cx My weblog, powered by Ruby and BSD licensed.