天天看點

Html的tidy 設定路徑

Specifying path for tidy rubygem

HTML Tidy is a library used to fix invalid HTML and give the source code a reasonable layout. It was developed by Dave Raggett of W3C, and is now maintained as a Sourceforge project. These are several versions of tidy available for various operating system. But the quickest way(not always easiest) to install on various unix systems are given below.

On debian based OS such as ubuntu, use apt-get to install

apt-get install tidy
           

On RPM based OS like fedora centOS, use yum to install

yum install tidy
           

On mac os x, use macports to install

port install tidy

For tidy to be used in ruby, a rubygem is available here. Just fire up gem install tidy to get it installed on your development machine. A nice documentation is provided here for reference.

gem install tidy
           

While I was working on tidy on my mac, I noticed the Tidy.path variable explained above did not work for me. I figured out an equivalent path to be used on mac,

To use both paths on my development and production environment, I modified the line 2 in the example above as

Update:

If you’re getting the error:

/opt/ruby/ruby-1.8.6/lib/ruby/gems/1.8/gems/tidy-1.1.2/lib/tidy/tidybuf.rb:40: [BUG] Segmentation fault

Apply the following patch to fix it.

繼續閱讀