Sha256: 7032b94ad49d2cb7047240537685ff160a2b10608636e5ed79f4fa74cc1d1bde
Contents?: true
Size: 1.28 KB
Versions: 41
Compression:
Stored size: 1.28 KB
Contents
#!/usr/bin/env ruby require 'rubygems' require 'redcloth' require 'syntax/convertors/html' require 'erb' require 'active_support' require File.dirname(__FILE__) + '/../lib/newgem/version.rb' version = Newgem::VERSION::STRING download = 'http://rubyforge.org/projects/newgem' class Fixnum def ordinal # teens return 'th' if (10..19).include?(self % 100) # others case self % 10 when 1: return 'st' when 2: return 'nd' when 3: return 'rd' else return 'th' end end end class Time def pretty return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}" end end def convert_syntax(syntax, source) return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'') end if ARGV.length >= 1 src, template = ARGV template ||= File.dirname(__FILE__) + '/../website/template.js' else puts("Usage: #{File.split($0).last} source.txt [template.js] > output.html") exit! end template = ERB.new(File.open(template).read) title = nil body = nil File.open(src) do |fsrc| title_text = fsrc.readline body_text = fsrc.read title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip body = RedCloth.new(body_text) end stat = File.stat(src) created = stat.ctime modified = stat.mtime $stdout << template.result(binding)
Version data entries
41 entries across 41 versions & 1 rubygems
Version | Path |
---|---|
newgem-0.9.1 | scripts/txt2js |