cfurrow
11/24/2010 - 3:51 PM

app.rb

<script src="https://gist.github.com/713851.js?file=gistHtmlExample.html"></script>
%p Inserting a gist script block is easy now.

%p You can use just the gist id (found in the url of the gist)
= gist(12345) #=> This will insert gist with id 12345

%p 
    Or you can pass in the ID, with an optional filename if you have multiple files identified
    in the same gist ID.
= gist(713851,"example.haml") #=> This would insert this gist
# local/app.rb
module Nesta
class App
    helpers do
      def gist(gn,filename=nil)
        if(!filename.nil?)
          filename = "?file=#{filename}" 
        end
        "<script type='text/javascript' src='https://gist.github.com/#{gn}.js#{filename}'></script>"
      end
    end
  end
end