5 require 'syntax/convertors/html'
7 require 'active_support'
8 require File.dirname(__FILE__) + '/../lib/composite_primary_keys/version.rb'
10 version = CompositePrimaryKeys::VERSION::STRING
11 download = 'http://rubyforge.org/projects/compositekeys'
16 return 'th' if (10..19).include?(self % 100)
29 return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
33 def convert_syntax(syntax, source)
34 return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
39 template ||= File.dirname(__FILE__) + '/../website/template.js'
41 puts("Usage: #{File.split($0).last} source.txt [template.js] > output.html")
45 template = ERB.new(File.open(template).read)
49 File.open(src) do |fsrc|
50 title_text = fsrc.readline
52 title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
53 body = RedCloth.new(body_text)
59 $stdout << template.result(binding)