Users-and-Hashtags
I was playing around with rack a little bit and this is what I came up with.
You can use it to automatically replace @user and #tags in specified areas of your website.
Requires Nokogiri.
Installation
I. Add it to your Gemfile
gem 'users-and-hashtags'
II. Add users-and-hashtags to your application (Rails 3.1 in this case)
(config/application.rb or config/environments/[development|production|test].rb)
config.middleware.use Rack::UsersAndHashtags, {
:user_url => ["http://0.0.0.0:3000/"],
:hashtag_url => ["http://0.0.0.0:3000/search?q=%23"],
:matcher => '.twitrepl'
}
In every element with the css class .twitrepl that matches the @user or #tag regex will be replaced with a link:
@user => <a href="http://0.0.0.0:3000/@user">@user</a>
#tag => <a href="http://0.0.0.0:3000/search?q=%23tag">#tag</a>