who-needs-wp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/LICENSE +20 -0
- data/README.rdoc +17 -0
- data/bin/who-needs-wp +21 -0
- data/bin/wordpress2wnwp +40 -0
- data/bin/wordpress2wnwp~ +6 -0
- data/lib/who-needs-wp.rb +51 -0
- data/lib/who-needs-wp/css.rb +10 -0
- data/lib/who-needs-wp/delicious.rb +20 -0
- data/lib/who-needs-wp/posts.rb +57 -0
- data/lib/who-needs-wp/stylesheets/base.sass +77 -0
- data/lib/who-needs-wp/stylesheets/pygments.sass +140 -0
- data/lib/who-needs-wp/stylesheets/reset-fonts-grids.sass +449 -0
- data/lib/who-needs-wp/stylesheets/style.sass +3 -0
- data/lib/who-needs-wp/templates.rb +16 -0
- data/lib/who-needs-wp/templates/delicious.haml +6 -0
- data/lib/who-needs-wp/templates/layout.haml +31 -0
- data/lib/who-needs-wp/templates/post.haml +11 -0
- data/lib/who-needs-wp/templates/recentposts.haml +6 -0
- data/lib/who-needs-wp/templates/twitter.haml +6 -0
- data/lib/who-needs-wp/twitter.rb +11 -0
- metadata +133 -0
data/LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2009 Owen Griffin
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.rdoc
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
= who-needs-wp
|
2
|
+
|
3
|
+
Description goes here.
|
4
|
+
|
5
|
+
== Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
* Fork the project.
|
8
|
+
* Make your feature addition or bug fix.
|
9
|
+
* Add tests for it. This is important so I don't break it in a
|
10
|
+
future version unintentionally.
|
11
|
+
* Commit, do not mess with rakefile, version, or history.
|
12
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
+
* Send me a pull request. Bonus points for topic branches.
|
14
|
+
|
15
|
+
== Copyright
|
16
|
+
|
17
|
+
Copyright (c) 2010 Owen Griffin. See LICENSE for details.
|
data/bin/who-needs-wp
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/bin/ruby
|
2
|
+
$: << File.expand_path(File.dirname(__FILE__) + "/../lib")
|
3
|
+
|
4
|
+
require 'rubygems'
|
5
|
+
require 'who-needs-wp.rb'
|
6
|
+
require 'optparse'
|
7
|
+
|
8
|
+
options = {}
|
9
|
+
OptionParser.new do |opts|
|
10
|
+
opts.banner = "Usage: who-needs-wp [options]"
|
11
|
+
|
12
|
+
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
13
|
+
options[:verbose] = v
|
14
|
+
end
|
15
|
+
|
16
|
+
opts.on('-s', '--stylesheet STYLESHEET', 'Include STYLESHEET in the output') do |stylesheet|
|
17
|
+
options[:stylesheet] = stylesheet
|
18
|
+
end
|
19
|
+
end.parse!
|
20
|
+
|
21
|
+
WhoNeedsWP::generate(YAML.load_file('.who-needs-wp.yaml').merge(options))
|
data/bin/wordpress2wnwp
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
#!/bin/ruby
|
2
|
+
|
3
|
+
require 'rubygems'
|
4
|
+
require 'sequel'
|
5
|
+
require 'logger'
|
6
|
+
|
7
|
+
require 'mysql'
|
8
|
+
require 'ftools'
|
9
|
+
|
10
|
+
|
11
|
+
database = ARGV[0]
|
12
|
+
user = ARGV[1]
|
13
|
+
password = ARGV[2]
|
14
|
+
prefix = ARGV[3]
|
15
|
+
|
16
|
+
dbh = Mysql.real_connect("localhost", user, password, database)
|
17
|
+
res = dbh.query("SELECT DISTINCT post_parent FROM wp_#{prefix}_posts")
|
18
|
+
posts = []
|
19
|
+
while row = res.fetch_row do
|
20
|
+
posts << row[0]
|
21
|
+
end
|
22
|
+
puts posts.inspect
|
23
|
+
posts0 = []
|
24
|
+
posts.each do |post_id|
|
25
|
+
res = dbh.query("SELECT post_title, post_date, post_content FROM wp_#{prefix}_posts WHERE post_parent ='#{post_id}' ORDER BY ID DESC LIMIT 1")
|
26
|
+
row = res.fetch_row
|
27
|
+
posts0 << {
|
28
|
+
:id => post_id,
|
29
|
+
:title => row[0],
|
30
|
+
:date => Date.parse(row[1]),
|
31
|
+
:content => row[2]
|
32
|
+
}
|
33
|
+
end
|
34
|
+
posts0.each do |post|
|
35
|
+
dir = "#{post[:date].strftime('%Y')}/#{post[:date].strftime('%m')}/#{post[:date].strftime('%d')}"
|
36
|
+
File.makedirs dir
|
37
|
+
File.open(dir + "/" + post[:title].gsub(/ /, '_') + ".markdown", "w") do |file|
|
38
|
+
file.puts post[:content]
|
39
|
+
end
|
40
|
+
end
|
data/bin/wordpress2wnwp~
ADDED
data/lib/who-needs-wp.rb
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rdiscount'
|
3
|
+
require 'haml'
|
4
|
+
require 'twitter'
|
5
|
+
require 'nokogiri'
|
6
|
+
require 'open-uri'
|
7
|
+
require 'sass'
|
8
|
+
require 'makers-mark'
|
9
|
+
require 'logger'
|
10
|
+
|
11
|
+
require 'who-needs-wp/css.rb'
|
12
|
+
require 'who-needs-wp/twitter.rb'
|
13
|
+
require 'who-needs-wp/delicious.rb'
|
14
|
+
require 'who-needs-wp/templates.rb'
|
15
|
+
require 'who-needs-wp/posts.rb'
|
16
|
+
|
17
|
+
module WhoNeedsWP
|
18
|
+
# A list of HTML strings which will be the sidebar
|
19
|
+
@sidebar = []
|
20
|
+
|
21
|
+
# Map of templates which are used to render content
|
22
|
+
@template = []
|
23
|
+
|
24
|
+
# Logger
|
25
|
+
@logger = Logger.new(STDOUT)
|
26
|
+
|
27
|
+
def self.generate(options)
|
28
|
+
@options = options
|
29
|
+
self.load_templates
|
30
|
+
self.load_posts
|
31
|
+
self.twitter
|
32
|
+
self.delicious
|
33
|
+
self.recentposts
|
34
|
+
self.generate_posts
|
35
|
+
self.index
|
36
|
+
self.css
|
37
|
+
end
|
38
|
+
def self.index
|
39
|
+
File.open("index.html", "w") do |file|
|
40
|
+
contents = ""
|
41
|
+
@POSTS[0..3].each do |post|
|
42
|
+
contents << post[:html]
|
43
|
+
end
|
44
|
+
file.puts @template['layout'].render(Object.new, {
|
45
|
+
:content => contents,
|
46
|
+
:options => @options,
|
47
|
+
:sidebar => @sidebar.join
|
48
|
+
})
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
|
2
|
+
module WhoNeedsWP
|
3
|
+
def self.css(filename="style.css")
|
4
|
+
stylesheets_folder = File.expand_path(File.join(File.dirname(__FILE__), "stylesheets"))
|
5
|
+
@logger.debug "Generating stylesheets from #{stylesheets_folder}"
|
6
|
+
File.open(filename, "w") do |file|
|
7
|
+
file.puts Sass::Engine.new(File.read("#{stylesheets_folder}/style.sass"), { :load_paths => [stylesheets_folder]}).to_css
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
|
2
|
+
module WhoNeedsWP
|
3
|
+
def self.delicious
|
4
|
+
if @options[:delicious]
|
5
|
+
delicious = []
|
6
|
+
doc = Nokogiri::XML(open("http://feeds.delicious.com/v2/rss/#{@options[:delicious][:user]}?count=5"))
|
7
|
+
doc.xpath('//channel/item').each do |item|
|
8
|
+
delicious << {
|
9
|
+
:title => (item/'title').first.content,
|
10
|
+
:url => (item/'link').first.content,
|
11
|
+
:date => Date.parse((item/'pubDate').first.content)
|
12
|
+
}
|
13
|
+
end
|
14
|
+
@sidebar << @template['delicious'].render(Object.new, {
|
15
|
+
:posts => delicious,
|
16
|
+
:options => @options
|
17
|
+
})
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
|
2
|
+
module WhoNeedsWP
|
3
|
+
def self.load_posts
|
4
|
+
@POSTS = []
|
5
|
+
Dir.glob('posts/**/*.markdown').each do |filename|
|
6
|
+
@logger.debug "Loading post #{filename}"
|
7
|
+
match = filename.match(/([0-9]{4})\/([0-9]{2})\/([0-9]{2})\/([^\.]*)/)
|
8
|
+
date = DateTime.new(match[1].to_i, match[2].to_i, match[3].to_i)
|
9
|
+
@POSTS << {
|
10
|
+
:filename => {
|
11
|
+
:original => filename,
|
12
|
+
:generated => File.dirname(filename) + "/" + File.basename(filename, ".markdown") + ".html"
|
13
|
+
},
|
14
|
+
:title => match[4].gsub(/_/, ' '),
|
15
|
+
:created_at => date
|
16
|
+
}
|
17
|
+
end
|
18
|
+
@POSTS.sort! { |a, b| a[:created_at] <=> b[:created_at] }
|
19
|
+
@POSTS.reverse!
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
def self.recentposts
|
24
|
+
@sidebar << @template['recentposts'].render(Object.new, {
|
25
|
+
:posts => @POSTS[0..5],
|
26
|
+
:options => @options
|
27
|
+
})
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.generate_posts
|
31
|
+
@POSTS.each do |post|
|
32
|
+
File.open(post[:filename][:generated], "w") do |file|
|
33
|
+
markdown = File.read(post[:filename][:original])
|
34
|
+
post[:author] = @options[:author]
|
35
|
+
match = markdown.match(/^[aA]uthor: (.*)$/o)
|
36
|
+
if match
|
37
|
+
post[:author] = match[1]
|
38
|
+
# Remove the author from the post text
|
39
|
+
markdown.gsub! /^[aA]uthor: .*$/, ''
|
40
|
+
end
|
41
|
+
# post[:markdown] = RDiscount.new(markdown, :smart, :generate_toc).to_html
|
42
|
+
post[:markdown] = MakersMark.generate(markdown)
|
43
|
+
post[:html] = @template['post'].render(Object.new, {
|
44
|
+
:post => post,
|
45
|
+
:title => post[:title],
|
46
|
+
:options => @options
|
47
|
+
})
|
48
|
+
file.puts @template['layout'].render(Object.new, {
|
49
|
+
:content => post[:html],
|
50
|
+
:options => @options,
|
51
|
+
:title => post[:title],
|
52
|
+
:sidebar => @sidebar.join
|
53
|
+
})
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
h1
|
2
|
+
font-size: 138.5%
|
3
|
+
|
4
|
+
|
5
|
+
h2
|
6
|
+
font-size: 123.1%
|
7
|
+
|
8
|
+
|
9
|
+
h3
|
10
|
+
font-size: 108%
|
11
|
+
|
12
|
+
|
13
|
+
h1, h2, h3
|
14
|
+
margin: 1em 0
|
15
|
+
|
16
|
+
|
17
|
+
h1, h2, h3, h4, h5, h6, strong
|
18
|
+
font-weight: bold
|
19
|
+
|
20
|
+
|
21
|
+
abbr, acronym
|
22
|
+
border-bottom: 1px dotted #000
|
23
|
+
cursor: help
|
24
|
+
|
25
|
+
|
26
|
+
em
|
27
|
+
font-style: italic
|
28
|
+
|
29
|
+
|
30
|
+
blockquote, ul, ol, dl
|
31
|
+
margin: 1em
|
32
|
+
|
33
|
+
|
34
|
+
ol, ul, dl
|
35
|
+
margin-left: 2em
|
36
|
+
|
37
|
+
|
38
|
+
ol li
|
39
|
+
list-style: decimal outside
|
40
|
+
|
41
|
+
|
42
|
+
ul li
|
43
|
+
list-style: disc outside
|
44
|
+
|
45
|
+
|
46
|
+
dl dd
|
47
|
+
margin-left: 1em
|
48
|
+
|
49
|
+
|
50
|
+
th, td
|
51
|
+
border: 1px solid #000
|
52
|
+
padding: .5em
|
53
|
+
|
54
|
+
|
55
|
+
th
|
56
|
+
font-weight: bold
|
57
|
+
text-align: center
|
58
|
+
|
59
|
+
|
60
|
+
caption
|
61
|
+
margin-bottom: .5em
|
62
|
+
text-align: center
|
63
|
+
|
64
|
+
|
65
|
+
p, fieldset, table, pre
|
66
|
+
margin-bottom: 1em
|
67
|
+
|
68
|
+
|
69
|
+
input
|
70
|
+
&[type=text], &[type=password]
|
71
|
+
width: 12.25em
|
72
|
+
*width: 11.9em
|
73
|
+
|
74
|
+
|
75
|
+
textarea
|
76
|
+
width: 12.25em
|
77
|
+
*width: 11.9em
|
@@ -0,0 +1,140 @@
|
|
1
|
+
.code
|
2
|
+
.c
|
3
|
+
color: #999988
|
4
|
+
font-style: italic
|
5
|
+
|
6
|
+
.err
|
7
|
+
color: #a61717
|
8
|
+
background-color: #e3d2d2
|
9
|
+
|
10
|
+
.k, .o
|
11
|
+
font-weight: bold
|
12
|
+
|
13
|
+
.cm
|
14
|
+
color: #999988
|
15
|
+
font-style: italic
|
16
|
+
|
17
|
+
.cp
|
18
|
+
color: #999999
|
19
|
+
font-weight: bold
|
20
|
+
|
21
|
+
.c1
|
22
|
+
color: #999988
|
23
|
+
font-style: italic
|
24
|
+
|
25
|
+
.cs
|
26
|
+
color: #999999
|
27
|
+
font-weight: bold
|
28
|
+
font-style: italic
|
29
|
+
|
30
|
+
.gd
|
31
|
+
color: #000000
|
32
|
+
background-color: #ffdddd
|
33
|
+
|
34
|
+
.x
|
35
|
+
color: #000000
|
36
|
+
background-color: #ffaaaa
|
37
|
+
|
38
|
+
.ge
|
39
|
+
font-style: italic
|
40
|
+
|
41
|
+
.gr
|
42
|
+
color: #aa0000
|
43
|
+
|
44
|
+
.gh
|
45
|
+
color: #999999
|
46
|
+
|
47
|
+
.gi
|
48
|
+
color: #000000
|
49
|
+
background-color: #ddffdd
|
50
|
+
|
51
|
+
.x
|
52
|
+
color: #000000
|
53
|
+
background-color: #aaffaa
|
54
|
+
|
55
|
+
.go
|
56
|
+
color: #888888
|
57
|
+
|
58
|
+
.gp
|
59
|
+
color: #555555
|
60
|
+
|
61
|
+
.gs
|
62
|
+
font-weight: bold
|
63
|
+
|
64
|
+
.gu
|
65
|
+
color: #aaaaaa
|
66
|
+
|
67
|
+
.gt
|
68
|
+
color: #aa0000
|
69
|
+
|
70
|
+
.kc, .kd, .kp, .kr
|
71
|
+
font-weight: bold
|
72
|
+
|
73
|
+
.kt
|
74
|
+
color: #445588
|
75
|
+
font-weight: bold
|
76
|
+
|
77
|
+
.m
|
78
|
+
color: #009999
|
79
|
+
|
80
|
+
.s
|
81
|
+
color: #d14
|
82
|
+
|
83
|
+
.na
|
84
|
+
color: #008080
|
85
|
+
|
86
|
+
.nb
|
87
|
+
color: #0086B3
|
88
|
+
|
89
|
+
.nc
|
90
|
+
color: #445588
|
91
|
+
font-weight: bold
|
92
|
+
|
93
|
+
.no
|
94
|
+
color: #008080
|
95
|
+
|
96
|
+
.ni
|
97
|
+
color: #800080
|
98
|
+
|
99
|
+
.ne, .nf
|
100
|
+
color: #990000
|
101
|
+
font-weight: bold
|
102
|
+
|
103
|
+
.nn
|
104
|
+
color: #555555
|
105
|
+
|
106
|
+
.nt
|
107
|
+
color: #000080
|
108
|
+
|
109
|
+
.nv
|
110
|
+
color: #008080
|
111
|
+
|
112
|
+
.ow
|
113
|
+
font-weight: bold
|
114
|
+
|
115
|
+
.w
|
116
|
+
color: #bbbbbb
|
117
|
+
|
118
|
+
.mf, .mh, .mi, .mo
|
119
|
+
color: #009999
|
120
|
+
|
121
|
+
.sb, .sc, .sd, .s2, .se, .sh, .si, .sx
|
122
|
+
color: #d14
|
123
|
+
|
124
|
+
.sr
|
125
|
+
color: #009926
|
126
|
+
|
127
|
+
.s1
|
128
|
+
color: #d14
|
129
|
+
|
130
|
+
.ss
|
131
|
+
color: #990073
|
132
|
+
|
133
|
+
.bp
|
134
|
+
color: #999999
|
135
|
+
|
136
|
+
.vc, .vg, .vi
|
137
|
+
color: #008080
|
138
|
+
|
139
|
+
.il
|
140
|
+
color: #009999
|
@@ -0,0 +1,449 @@
|
|
1
|
+
html
|
2
|
+
color: #000
|
3
|
+
background: #FFF
|
4
|
+
|
5
|
+
|
6
|
+
body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td
|
7
|
+
margin: 0
|
8
|
+
padding: 0
|
9
|
+
|
10
|
+
|
11
|
+
table
|
12
|
+
border-collapse: collapse
|
13
|
+
border-spacing: 0
|
14
|
+
|
15
|
+
|
16
|
+
fieldset, img
|
17
|
+
border: 0
|
18
|
+
|
19
|
+
|
20
|
+
address, caption, cite, code, dfn, em, strong, th, var
|
21
|
+
font-style: normal
|
22
|
+
font-weight: normal
|
23
|
+
|
24
|
+
|
25
|
+
li
|
26
|
+
list-style: none
|
27
|
+
|
28
|
+
|
29
|
+
caption, th
|
30
|
+
text-align: left
|
31
|
+
|
32
|
+
|
33
|
+
h1, h2, h3, h4, h5, h6
|
34
|
+
font-size: 100%
|
35
|
+
font-weight: normal
|
36
|
+
|
37
|
+
|
38
|
+
q
|
39
|
+
&:before, &:after
|
40
|
+
content: ''
|
41
|
+
|
42
|
+
|
43
|
+
abbr, acronym
|
44
|
+
border: 0
|
45
|
+
font-variant: normal
|
46
|
+
|
47
|
+
|
48
|
+
sup
|
49
|
+
vertical-align: text-top
|
50
|
+
|
51
|
+
|
52
|
+
sub
|
53
|
+
vertical-align: text-bottom
|
54
|
+
|
55
|
+
|
56
|
+
input, textarea, select
|
57
|
+
font-family: inherit
|
58
|
+
font-size: inherit
|
59
|
+
font-weight: inherit
|
60
|
+
|
61
|
+
|
62
|
+
input, textarea, select
|
63
|
+
*font-size: 100%
|
64
|
+
|
65
|
+
|
66
|
+
legend
|
67
|
+
color: #000
|
68
|
+
|
69
|
+
|
70
|
+
body
|
71
|
+
font: 13px/1.231 arial,helvetica,clean,sans-serif
|
72
|
+
*font-size: small
|
73
|
+
*font: x-small
|
74
|
+
|
75
|
+
|
76
|
+
table
|
77
|
+
font-size: inherit
|
78
|
+
font: 100%
|
79
|
+
|
80
|
+
|
81
|
+
pre, code, kbd, samp, tt
|
82
|
+
font-family: monospace
|
83
|
+
*font-size: 108%
|
84
|
+
line-height: 100%
|
85
|
+
|
86
|
+
|
87
|
+
body
|
88
|
+
text-align: center
|
89
|
+
|
90
|
+
|
91
|
+
#ft
|
92
|
+
clear: both
|
93
|
+
|
94
|
+
|
95
|
+
#doc, #doc2, #doc3, #doc4, .yui-t1, .yui-t2, .yui-t3, .yui-t4, .yui-t5, .yui-t6, .yui-t7
|
96
|
+
margin: auto
|
97
|
+
text-align: left
|
98
|
+
width: 57.69em
|
99
|
+
*width: 56.25em
|
100
|
+
min-width: 750px
|
101
|
+
|
102
|
+
|
103
|
+
#doc2
|
104
|
+
width: 73.076em
|
105
|
+
*width: 71.25em
|
106
|
+
|
107
|
+
|
108
|
+
#doc3
|
109
|
+
margin: auto 10px
|
110
|
+
width: auto
|
111
|
+
|
112
|
+
|
113
|
+
#doc4
|
114
|
+
width: 74.923em
|
115
|
+
*width: 73.05em
|
116
|
+
|
117
|
+
|
118
|
+
.yui-b
|
119
|
+
position: relative
|
120
|
+
_position: static
|
121
|
+
|
122
|
+
|
123
|
+
#yui-main
|
124
|
+
width: 100%
|
125
|
+
|
126
|
+
.yui-b
|
127
|
+
position: static
|
128
|
+
|
129
|
+
|
130
|
+
.yui-t1 #yui-main, .yui-t2 #yui-main, .yui-t3 #yui-main
|
131
|
+
float: right
|
132
|
+
margin-left: -25em
|
133
|
+
|
134
|
+
|
135
|
+
.yui-t4 #yui-main, .yui-t5 #yui-main, .yui-t6 #yui-main
|
136
|
+
float: left
|
137
|
+
margin-right: -25em
|
138
|
+
|
139
|
+
|
140
|
+
.yui-t1
|
141
|
+
.yui-b
|
142
|
+
float: left
|
143
|
+
width: 12.30769em
|
144
|
+
*width: 12.00em
|
145
|
+
|
146
|
+
#yui-main .yui-b
|
147
|
+
margin-left: 13.30769em
|
148
|
+
*margin-left: 13.05em
|
149
|
+
|
150
|
+
|
151
|
+
.yui-t2
|
152
|
+
.yui-b
|
153
|
+
float: left
|
154
|
+
width: 13.8461em
|
155
|
+
*width: 13.50em
|
156
|
+
|
157
|
+
#yui-main .yui-b
|
158
|
+
margin-left: 14.8461em
|
159
|
+
*margin-left: 14.55em
|
160
|
+
|
161
|
+
|
162
|
+
.yui-t3
|
163
|
+
.yui-b
|
164
|
+
float: left
|
165
|
+
width: 23.0769em
|
166
|
+
*width: 22.50em
|
167
|
+
|
168
|
+
#yui-main .yui-b
|
169
|
+
margin-left: 24.0769em
|
170
|
+
*margin-left: 23.62em
|
171
|
+
|
172
|
+
|
173
|
+
.yui-t4
|
174
|
+
.yui-b
|
175
|
+
float: right
|
176
|
+
width: 13.8456em
|
177
|
+
*width: 13.50em
|
178
|
+
|
179
|
+
#yui-main .yui-b
|
180
|
+
margin-right: 14.8456em
|
181
|
+
*margin-right: 14.55em
|
182
|
+
|
183
|
+
|
184
|
+
.yui-t5
|
185
|
+
.yui-b
|
186
|
+
float: right
|
187
|
+
width: 18.4615em
|
188
|
+
*width: 18.00em
|
189
|
+
|
190
|
+
#yui-main .yui-b
|
191
|
+
margin-right: 19.4615em
|
192
|
+
*margin-right: 19.125em
|
193
|
+
|
194
|
+
|
195
|
+
.yui-t6
|
196
|
+
.yui-b
|
197
|
+
float: right
|
198
|
+
width: 23.0769em
|
199
|
+
*width: 22.50em
|
200
|
+
|
201
|
+
#yui-main .yui-b
|
202
|
+
margin-right: 24.0769em
|
203
|
+
*margin-right: 23.62em
|
204
|
+
|
205
|
+
|
206
|
+
.yui-t7 #yui-main .yui-b
|
207
|
+
display: block
|
208
|
+
margin: 0 0 1em 0
|
209
|
+
|
210
|
+
|
211
|
+
#yui-main .yui-b
|
212
|
+
float: none
|
213
|
+
width: auto
|
214
|
+
|
215
|
+
|
216
|
+
.yui-gb .yui-u, .yui-g .yui-gb .yui-u
|
217
|
+
float: left
|
218
|
+
|
219
|
+
|
220
|
+
.yui-gb
|
221
|
+
.yui-g, .yui-gb, .yui-gc, .yui-gd, .yui-ge, .yui-gf
|
222
|
+
float: left
|
223
|
+
|
224
|
+
|
225
|
+
.yui-gc
|
226
|
+
.yui-u, .yui-g
|
227
|
+
float: left
|
228
|
+
|
229
|
+
|
230
|
+
.yui-gd .yui-u
|
231
|
+
float: left
|
232
|
+
|
233
|
+
|
234
|
+
.yui-g
|
235
|
+
.yui-u, .yui-g, .yui-gb, .yui-gc, .yui-gd, .yui-ge, .yui-gf
|
236
|
+
float: right
|
237
|
+
|
238
|
+
|
239
|
+
.yui-gc .yui-u, .yui-gd .yui-g, .yui-g .yui-gc .yui-u
|
240
|
+
float: right
|
241
|
+
|
242
|
+
|
243
|
+
.yui-ge
|
244
|
+
.yui-u, .yui-g
|
245
|
+
float: right
|
246
|
+
|
247
|
+
|
248
|
+
.yui-gf
|
249
|
+
.yui-g, .yui-u
|
250
|
+
float: right
|
251
|
+
|
252
|
+
|
253
|
+
.yui-g div.first, .yui-gb div.first, .yui-gc div.first, .yui-gd div.first, .yui-ge div.first, .yui-gf div.first
|
254
|
+
float: left
|
255
|
+
|
256
|
+
|
257
|
+
.yui-g
|
258
|
+
.yui-gc div.first, .yui-ge div.first
|
259
|
+
float: left
|
260
|
+
|
261
|
+
|
262
|
+
.yui-gc div.first div.first
|
263
|
+
float: left
|
264
|
+
|
265
|
+
|
266
|
+
.yui-g
|
267
|
+
.yui-u, .yui-g, .yui-gb, .yui-gc, .yui-gd, .yui-ge, .yui-gf
|
268
|
+
width: 49.1%
|
269
|
+
|
270
|
+
|
271
|
+
.yui-gb .yui-u, .yui-g .yui-gb .yui-u
|
272
|
+
width: 32%
|
273
|
+
margin-left: 1.99%
|
274
|
+
|
275
|
+
|
276
|
+
.yui-gb
|
277
|
+
.yui-g, .yui-gb, .yui-gc, .yui-gd, .yui-ge, .yui-gf
|
278
|
+
width: 32%
|
279
|
+
margin-left: 1.99%
|
280
|
+
|
281
|
+
|
282
|
+
.yui-gc
|
283
|
+
.yui-u, .yui-g
|
284
|
+
width: 32%
|
285
|
+
margin-left: 1.99%
|
286
|
+
|
287
|
+
|
288
|
+
.yui-gd .yui-u
|
289
|
+
width: 32%
|
290
|
+
margin-left: 1.99%
|
291
|
+
|
292
|
+
|
293
|
+
.yui-gb .yui-u
|
294
|
+
*margin-left: 1.9%
|
295
|
+
*width: 31.9%
|
296
|
+
|
297
|
+
|
298
|
+
.yui-gc div.first
|
299
|
+
width: 66%
|
300
|
+
|
301
|
+
|
302
|
+
.yui-gd
|
303
|
+
.yui-u
|
304
|
+
width: 66%
|
305
|
+
|
306
|
+
div.first
|
307
|
+
width: 32%
|
308
|
+
|
309
|
+
|
310
|
+
.yui-ge div.first, .yui-gf .yui-u
|
311
|
+
width: 74.2%
|
312
|
+
|
313
|
+
|
314
|
+
.yui-ge .yui-u, .yui-gf div.first
|
315
|
+
width: 24%
|
316
|
+
|
317
|
+
|
318
|
+
.yui-g .yui-gb div.first, .yui-gb div.first, .yui-gc div.first, .yui-gd div.first
|
319
|
+
margin-left: 0
|
320
|
+
|
321
|
+
|
322
|
+
.yui-g .yui-g .yui-u, .yui-gb .yui-g .yui-u, .yui-gc .yui-g .yui-u, .yui-gd .yui-g .yui-u, .yui-ge .yui-g .yui-u, .yui-gf .yui-g .yui-u
|
323
|
+
width: 49%
|
324
|
+
*width: 48.1%
|
325
|
+
*margin-left: 0
|
326
|
+
|
327
|
+
|
328
|
+
.yui-g .yui-gb div.first, .yui-gb .yui-gb div.first
|
329
|
+
*margin-right: 0
|
330
|
+
*width: 32%
|
331
|
+
_width: 31.7%
|
332
|
+
|
333
|
+
|
334
|
+
.yui-g .yui-gc div.first, .yui-gd .yui-g
|
335
|
+
width: 66%
|
336
|
+
|
337
|
+
|
338
|
+
.yui-gb
|
339
|
+
.yui-g div.first
|
340
|
+
*margin-right: 4%
|
341
|
+
_margin-right: 1.3%
|
342
|
+
|
343
|
+
.yui-gc div.first, .yui-gd div.first
|
344
|
+
*margin-right: 0
|
345
|
+
|
346
|
+
.yui-gb .yui-u, .yui-gc .yui-u
|
347
|
+
*margin-left: 1.8%
|
348
|
+
_margin-left: 4%
|
349
|
+
|
350
|
+
|
351
|
+
.yui-g .yui-gb .yui-u
|
352
|
+
_margin-left: 1.0%
|
353
|
+
|
354
|
+
|
355
|
+
.yui-gb .yui-gd
|
356
|
+
.yui-u
|
357
|
+
*width: 66%
|
358
|
+
_width: 61.2%
|
359
|
+
|
360
|
+
div.first
|
361
|
+
*width: 31%
|
362
|
+
_width: 29.5%
|
363
|
+
|
364
|
+
|
365
|
+
.yui-g .yui-gc .yui-u
|
366
|
+
width: 32%
|
367
|
+
_float: right
|
368
|
+
margin-right: 0
|
369
|
+
_margin-left: 0
|
370
|
+
|
371
|
+
|
372
|
+
.yui-gb
|
373
|
+
.yui-gc
|
374
|
+
.yui-u
|
375
|
+
width: 32%
|
376
|
+
_float: right
|
377
|
+
margin-right: 0
|
378
|
+
_margin-left: 0
|
379
|
+
|
380
|
+
div.first
|
381
|
+
width: 66%
|
382
|
+
*float: left
|
383
|
+
*margin-left: 0
|
384
|
+
|
385
|
+
.yui-ge .yui-u, .yui-gf .yui-u
|
386
|
+
margin: 0
|
387
|
+
|
388
|
+
.yui-gb .yui-u
|
389
|
+
_margin-left: .7%
|
390
|
+
|
391
|
+
.yui-g div.first, .yui-gb div.first
|
392
|
+
*margin-left: 0
|
393
|
+
|
394
|
+
|
395
|
+
.yui-gc .yui-g .yui-u, .yui-gd .yui-g .yui-u
|
396
|
+
*width: 48.1%
|
397
|
+
*margin-left: 0
|
398
|
+
|
399
|
+
|
400
|
+
s .yui-gb .yui-gd div.first
|
401
|
+
width: 32%
|
402
|
+
|
403
|
+
|
404
|
+
.yui-g .yui-gd div.first
|
405
|
+
_width: 29.9%
|
406
|
+
|
407
|
+
|
408
|
+
.yui-ge .yui-g
|
409
|
+
width: 24%
|
410
|
+
|
411
|
+
|
412
|
+
.yui-gf .yui-g
|
413
|
+
width: 74.2%
|
414
|
+
|
415
|
+
|
416
|
+
.yui-gb
|
417
|
+
.yui-ge div.yui-u, .yui-gf div.yui-u
|
418
|
+
float: right
|
419
|
+
|
420
|
+
.yui-ge div.first, .yui-gf div.first
|
421
|
+
float: left
|
422
|
+
|
423
|
+
.yui-ge .yui-u, .yui-gf div.first
|
424
|
+
*width: 24%
|
425
|
+
_width: 20%
|
426
|
+
|
427
|
+
.yui-ge div.first, .yui-gf .yui-u
|
428
|
+
*width: 73.5%
|
429
|
+
_width: 65.5%
|
430
|
+
|
431
|
+
|
432
|
+
.yui-ge div.first .yui-gd
|
433
|
+
.yui-u
|
434
|
+
width: 65%
|
435
|
+
|
436
|
+
div.first
|
437
|
+
width: 32%
|
438
|
+
|
439
|
+
|
440
|
+
#bd:after, .yui-g:after, .yui-gb:after, .yui-gc:after, .yui-gd:after, .yui-ge:after, .yui-gf:after
|
441
|
+
content: "."
|
442
|
+
display: block
|
443
|
+
height: 0
|
444
|
+
clear: both
|
445
|
+
visibility: hidden
|
446
|
+
|
447
|
+
|
448
|
+
#bd, .yui-g, .yui-gb, .yui-gc, .yui-gd, .yui-ge, .yui-gf
|
449
|
+
zoom: 1
|
@@ -0,0 +1,16 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
module WhoNeedsWP
|
4
|
+
def self.load_templates
|
5
|
+
template_folder = File.expand_path(File.join(File.dirname(__FILE__), "templates"))
|
6
|
+
@template = Hash.new
|
7
|
+
Dir.glob("#{template_folder}/*.haml").each do |template|
|
8
|
+
# If a local template exists then over-write
|
9
|
+
if File.exists? "templates/#{File.basename(template)}"
|
10
|
+
template = "templates/#{File.basename(template)}"
|
11
|
+
end
|
12
|
+
@logger.debug "Loading template #{template}"
|
13
|
+
@template[File.basename(template, '.haml')] = Haml::Engine.new(File.read(template))
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
!!! Strict
|
2
|
+
%html
|
3
|
+
%head
|
4
|
+
%link{:rel => "stylesheet", :type => "text/css", :href => "#{options[:url]}/style.css"}/
|
5
|
+
%title
|
6
|
+
= options[:title]
|
7
|
+
- if defined? title
|
8
|
+
\-
|
9
|
+
= title
|
10
|
+
- if defined? options[:stylesheet]
|
11
|
+
%link{:rel => "stylesheet", :type => "text/css", :href => "#{options[:url]}/#{options[:stylesheet]}"}/
|
12
|
+
%meta{:"http-equiv" => "Content-Type", :content => "text/html; charset=utf-8"}/
|
13
|
+
%body
|
14
|
+
#doc4.yui-t2
|
15
|
+
#hd
|
16
|
+
%h1
|
17
|
+
%a{:href => "#{options[:url]}/index.html"}= options[:title]
|
18
|
+
#bd
|
19
|
+
#yui-main
|
20
|
+
.yui-b
|
21
|
+
.yui-gc
|
22
|
+
.yui-u.first
|
23
|
+
=content
|
24
|
+
.yui-u
|
25
|
+
=sidebar
|
26
|
+
.yui-b
|
27
|
+
|
28
|
+
#ft
|
29
|
+
Generated using who-needs-wp
|
30
|
+
|
31
|
+
|
@@ -0,0 +1,11 @@
|
|
1
|
+
|
2
|
+
module WhoNeedsWP
|
3
|
+
def self.twitter
|
4
|
+
if @options[:twitter][:user]
|
5
|
+
@sidebar << @template['twitter'].render(Object.new, {
|
6
|
+
:tweets => Twitter::Search.new(@options[:twitter][:user]).per_page(5).fetch().results,
|
7
|
+
:options => @options
|
8
|
+
})
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: who-needs-wp
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Owen Griffin
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2010-03-15 00:00:00 +00:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rdiscount
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.5.8
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: haml
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 2.2.20
|
34
|
+
version:
|
35
|
+
- !ruby/object:Gem::Dependency
|
36
|
+
name: twitter
|
37
|
+
type: :runtime
|
38
|
+
version_requirement:
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - ">="
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.8.4
|
44
|
+
version:
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: nokogiri
|
47
|
+
type: :runtime
|
48
|
+
version_requirement:
|
49
|
+
version_requirements: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - ">="
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.4.1
|
54
|
+
version:
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: open4
|
57
|
+
type: :runtime
|
58
|
+
version_requirement:
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: 1.0.1
|
64
|
+
version:
|
65
|
+
- !ruby/object:Gem::Dependency
|
66
|
+
name: makers-mark
|
67
|
+
type: :runtime
|
68
|
+
version_requirement:
|
69
|
+
version_requirements: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: 0.1.1
|
74
|
+
version:
|
75
|
+
description: A static web site generator.
|
76
|
+
email: owen.griffin@gmail.com
|
77
|
+
executables:
|
78
|
+
- wordpress2wnwp~
|
79
|
+
- who-needs-wp
|
80
|
+
- wordpress2wnwp
|
81
|
+
extensions: []
|
82
|
+
|
83
|
+
extra_rdoc_files:
|
84
|
+
- LICENSE
|
85
|
+
- README.rdoc
|
86
|
+
files:
|
87
|
+
- lib/who-needs-wp.rb
|
88
|
+
- lib/who-needs-wp/css.rb
|
89
|
+
- lib/who-needs-wp/delicious.rb
|
90
|
+
- lib/who-needs-wp/posts.rb
|
91
|
+
- lib/who-needs-wp/stylesheets/base.sass
|
92
|
+
- lib/who-needs-wp/stylesheets/pygments.sass
|
93
|
+
- lib/who-needs-wp/stylesheets/reset-fonts-grids.sass
|
94
|
+
- lib/who-needs-wp/stylesheets/style.sass
|
95
|
+
- lib/who-needs-wp/templates.rb
|
96
|
+
- lib/who-needs-wp/templates/delicious.haml
|
97
|
+
- lib/who-needs-wp/templates/layout.haml
|
98
|
+
- lib/who-needs-wp/templates/post.haml
|
99
|
+
- lib/who-needs-wp/templates/recentposts.haml
|
100
|
+
- lib/who-needs-wp/templates/twitter.haml
|
101
|
+
- lib/who-needs-wp/twitter.rb
|
102
|
+
- LICENSE
|
103
|
+
- README.rdoc
|
104
|
+
has_rdoc: true
|
105
|
+
homepage: http://github.com/owengriffin/who-needs-wp
|
106
|
+
licenses: []
|
107
|
+
|
108
|
+
post_install_message:
|
109
|
+
rdoc_options:
|
110
|
+
- --charset=UTF-8
|
111
|
+
require_paths:
|
112
|
+
- lib
|
113
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: "0"
|
118
|
+
version:
|
119
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
requirements:
|
121
|
+
- - ">="
|
122
|
+
- !ruby/object:Gem::Version
|
123
|
+
version: "0"
|
124
|
+
version:
|
125
|
+
requirements: []
|
126
|
+
|
127
|
+
rubyforge_project:
|
128
|
+
rubygems_version: 1.3.5
|
129
|
+
signing_key:
|
130
|
+
specification_version: 3
|
131
|
+
summary: Who needs Wordpress? A static website generator based on Markdown and Git
|
132
|
+
test_files: []
|
133
|
+
|