simplews 1.3.2 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +20 -0
- data/README.rdoc +14 -88
- data/lib/simplews/jobs.rb +54 -20
- data/lib/simplews.rb +1 -1
- metadata +24 -51
- data/History.txt +0 -57
- data/Manifest.txt +0 -26
- data/PostInstall.txt +0 -7
- data/Rakefile +0 -28
- data/config/hoe.rb +0 -73
- data/config/requirements.rb +0 -15
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/script/txt2html +0 -82
- data/setup.rb +0 -1585
- data/simplews.gemspec +0 -38
- data/tasks/deployment.rake +0 -34
- data/tasks/environment.rake +0 -7
- data/tasks/website.rake +0 -17
- data/test/simplews/test_jobs.rb +0 -93
- data/test/test_helper.rb +0 -3
- data/test/test_simplews.rb +0 -50
- data/website/index.html +0 -11
- data/website/index.txt +0 -83
- data/website/javascripts/rounded_corners_lite.inc.js +0 -285
- data/website/stylesheets/screen.css +0 -138
- data/website/template.html.erb +0 -48
data/script/txt2html
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
GEM_NAME = 'simplews' # what ppl will type to install your gem
|
4
|
-
RUBYFORGE_PROJECT = 'simplews'
|
5
|
-
|
6
|
-
require 'rubygems'
|
7
|
-
begin
|
8
|
-
require 'newgem'
|
9
|
-
require 'rubyforge'
|
10
|
-
rescue LoadError
|
11
|
-
puts "\n\nGenerating the website requires the newgem RubyGem"
|
12
|
-
puts "Install: gem install newgem\n\n"
|
13
|
-
exit(1)
|
14
|
-
end
|
15
|
-
require 'redcloth'
|
16
|
-
require 'syntax/convertors/html'
|
17
|
-
require 'erb'
|
18
|
-
require File.dirname(__FILE__) + "/../lib/#{GEM_NAME}/version.rb"
|
19
|
-
|
20
|
-
version = Simplews::VERSION::STRING
|
21
|
-
download = "http://rubyforge.org/projects/#{RUBYFORGE_PROJECT}"
|
22
|
-
|
23
|
-
def rubyforge_project_id
|
24
|
-
RubyForge.new.configure.autoconfig["group_ids"][RUBYFORGE_PROJECT]
|
25
|
-
end
|
26
|
-
|
27
|
-
class Fixnum
|
28
|
-
def ordinal
|
29
|
-
# teens
|
30
|
-
return 'th' if (10..19).include?(self % 100)
|
31
|
-
# others
|
32
|
-
case self % 10
|
33
|
-
when 1: return 'st'
|
34
|
-
when 2: return 'nd'
|
35
|
-
when 3: return 'rd'
|
36
|
-
else return 'th'
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
class Time
|
42
|
-
def pretty
|
43
|
-
return "#{mday}#{mday.ordinal} #{strftime('%B')} #{year}"
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
47
|
-
def convert_syntax(syntax, source)
|
48
|
-
return Syntax::Convertors::HTML.for_syntax(syntax).convert(source).gsub(%r!^<pre>|</pre>$!,'')
|
49
|
-
end
|
50
|
-
|
51
|
-
if ARGV.length >= 1
|
52
|
-
src, template = ARGV
|
53
|
-
template ||= File.join(File.dirname(__FILE__), '/../website/template.html.erb')
|
54
|
-
else
|
55
|
-
puts("Usage: #{File.split($0).last} source.txt [template.html.erb] > output.html")
|
56
|
-
exit!
|
57
|
-
end
|
58
|
-
|
59
|
-
template = ERB.new(File.open(template).read)
|
60
|
-
|
61
|
-
title = nil
|
62
|
-
body = nil
|
63
|
-
File.open(src) do |fsrc|
|
64
|
-
title_text = fsrc.readline
|
65
|
-
body_text_template = fsrc.read
|
66
|
-
body_text = ERB.new(body_text_template).result(binding)
|
67
|
-
syntax_items = []
|
68
|
-
body_text.gsub!(%r!<(pre|code)[^>]*?syntax=['"]([^'"]+)[^>]*>(.*?)</\1>!m){
|
69
|
-
ident = syntax_items.length
|
70
|
-
element, syntax, source = $1, $2, $3
|
71
|
-
syntax_items << "<#{element} class='syntax'>#{convert_syntax(syntax, source)}</#{element}>"
|
72
|
-
"syntax-temp-#{ident}"
|
73
|
-
}
|
74
|
-
title = RedCloth.new(title_text).to_html.gsub(%r!<.*?>!,'').strip
|
75
|
-
body = RedCloth.new(body_text).to_html
|
76
|
-
body.gsub!(%r!(?:<pre><code>)?syntax-temp-(\d+)(?:</code></pre>)?!){ syntax_items[$1.to_i] }
|
77
|
-
end
|
78
|
-
stat = File.stat(src)
|
79
|
-
created = stat.ctime
|
80
|
-
modified = stat.mtime
|
81
|
-
|
82
|
-
$stdout << template.result(binding)
|