!!!
%html
  %head
    / Load jQuery and autolink-js
    %script{:src => "https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"}
    %script{:src => "../autolink.js"}
  %body
    %ul
      %li Our first item contains no links.
      %li Our second item contains a link to Google http://google.com.
      %li.new_window Our third item contains a link that opens in a new window http://google.com
      %li Our fourth item contains a link to Google http://google.com and a shortened bitly http://bit.ly/1337
      %li.callback Our fifth item contains a link to image https://www.google.com/images/srpr/logo3w.png
    :javascript
      $(document).ready(function() {
        $('li:not([class!=""])').each(function() {
          var that = $(this);
          var text = that.html();

          that.html(text.autoLink());
        });

        var callback = $('li.callback');

        $(callback).html(
          callback.html().autoLink({ callback: function(url){
            return /\.(gif|png|jpe?g)$/i.test(url) ? '<img src="' + url + '">' : null;
          }})
        );

        var new_window = $('li.new_window');

        $(new_window).html(
          new_window.html().autoLink({ target: "_blank" })
        );
      });
