The Artima Developer Community
Sponsored Link

Ruby Buzz Forum
Syntax Highlighting for Ruby Made Very Easy

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Jake Scruggs

Posts: 336
Nickname: aurorae314
Registered: Feb, 2008

Jake Scruggs is a developer at ThoughtWorks
Syntax Highlighting for Ruby Made Very Easy Posted: May 29, 2008 3:20 PM
Reply to this message Reply

This post originated from an RSS feed registered with Ruby Buzz by Jake Scruggs.
Original Post: Syntax Highlighting for Ruby Made Very Easy
Feed Title: Jake Scruggs
Feed URL: http://jakescruggs.blogspot.com/feeds/posts/default
Feed Description: Ruby, Rails, Metrics, Testing, and pursuit of clean code.
Latest Ruby Buzz Posts
Latest Ruby Buzz Posts by Jake Scruggs
Latest Posts From Jake Scruggs

Advertisement
So I've been making do with lame-o 'pre' tags for my code snippets and my blog looks, well, lame. But the various alternatives for highlighting ruby either didn't work for Blogger or smacked of effort (and you know how I feel about effort).

Well, recently I joined Obtiva and I was being all nosy looking at my new co-worker's blogs, when I found Tyler Jennings post about creating Spotlight. Take some ruby code, paste it into the text box, press a button, and you get some html which you copy and past into your blog. You'll have to include the default css in your css file the first time, but that's not too hard. Output looks like this:


 1 class Echo < ActionMailer::Base
2 def copy formatted_message, incident_id
3 users_with_echo_emails = User.find(:all,
4 :conditions => "echo_email is not NULL")
5 users_with_echo_emails.reject! {|user| !user.receive_echo?}
6 recipients_array = users_with_echo_emails.map { |user| user.echo_email }
7 recipients_array << ENV['default_echo_email'] if ENV['default_echo_email']
8
9 recipients recipients_array
10 subject "Globex pager incident #{incident_id} updated"
11 from 'noreply@globex.com'
12 body :message => formatted_message, :incident_id => incident_id
13 end
14 end



Cool huh?

Read: Syntax Highlighting for Ruby Made Very Easy

Topic: One week left for Ruby Hoedown proposals Previous Topic   Next Topic Topic: Meet us at RailsConf

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use