Report abuse
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
require 'bitly'
class BitlyFilter < Nanoc3::Filter
identifier :bitly
def run(content, params={})
username, api_key = 'xx', 'xxx'
bitly = Bitly.new(username, api_key)
content.gsub(/\]\:\s(.*?)(\\n|\s)/i) do |match|
bitly.shorten(match).short_url)
end
end
end
|