ruby bluecloth alternatives
comments | Posted in website on Monday, June 02 2008 19:14:30 GMT
I stumbled across a few new Ruby libraries to generate HTML content from BlueCloth. You can see below:
# David Gurba
# 06/02/2008
#
# The 'discount' filter implements a new BlueCloth implementation that
is 59x
# faster than the standard Ruby class.
#
# See: http://tomayko.com/writings/ruby-markdown-libraries-real-cheap-for-you-two-for-price-of-one
# to get Discount issue:
# sudo gem install discount
#
#
class DiscountFilter < Nanoc::Filter
identifiers :discount
def run(content)
nanoc_require 'rubygems'
nanoc_require 'discount'
return Discount.new(content).to_html
end
end
This website went now compiles from scratch in 5.48 seconds, as opposed to the old value of 10.51 seconds.