who-needs-wp 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/who-needs-wp.rb CHANGED
@@ -47,8 +47,12 @@ module WhoNeedsWP
47
47
  # Generate the index page for the blog
48
48
  def self.index
49
49
  contents = ""
50
- @POSTS[0..3].each do |post|
51
- contents << post[:html]
50
+ if @POSTS.length > 0
51
+ @POSTS[0..3].each do |post|
52
+ contents << post[:html]
53
+ end
54
+ else
55
+ contents << @pages.first[:html]
52
56
  end
53
57
  self.render_html("index.html", "index", contents)
54
58
  end
@@ -1,10 +1,12 @@
1
1
 
2
2
  module WhoNeedsWP
3
3
  def self.css(filename="style.css")
4
+ if @options[:stylesheet] == nil or @options[:stylesheet].empty?
4
5
  stylesheets_folder = File.expand_path(File.join(File.dirname(__FILE__), "stylesheets"))
5
6
  @logger.debug "Generating stylesheets from #{stylesheets_folder}"
6
7
  File.open(filename, "w") do |file|
7
8
  file.puts Sass::Engine.new(File.read("#{stylesheets_folder}/style.sass"), { :load_paths => [stylesheets_folder]}).to_css
8
9
  end
10
+ end
9
11
  end
10
12
  end
@@ -16,7 +16,7 @@ module WhoNeedsWP
16
16
  :created_at => date
17
17
  }
18
18
  # Generate a unique post ID to be used in the Atom feed
19
- post[:id] = "#{options[:url]}#{generated_filename}".gsub!(/http:\/\//, 'tag:')
19
+ post[:id] = "#{options[:url]}#{generated_filename}".gsub(/http:\/\//, 'tag:')
20
20
  match = post[:id].match(/([^\/]*)\/(.*)/)
21
21
  post[:id] = "#{match[1]},#{date.strftime('%Y-%m-%d')}:#{match[2]}" if match
22
22
  # Append the post to the global list of posts
@@ -1,7 +1,8 @@
1
1
  !!! Strict
2
2
  %html
3
3
  %head
4
- %link{:rel => "stylesheet", :type => "text/css", :href => "#{options[:url]}/style.css"}/
4
+ - if options[:stylesheet] == nil or options[:stylesheet].empty?
5
+ %link{:rel => "stylesheet", :type => "text/css", :href => "#{options[:url]}/style.css"}/
5
6
  %link{:rel => "alternate", :type => "application/atom+xml", :href => "#{options[:url]}/posts.atom", :title => "#{options[:title]} - Atom"}/
6
7
  %link{:rel => "alternate", :type => "application/rss+xml", :href => "#{options[:url]}/posts.rss", :title => "#{options[:title]} - RSS"}/
7
8
  %title
@@ -1,8 +1,9 @@
1
- %h2 Recent Posts
2
- %ul
3
- - posts.each do |post|
1
+ - if posts != nil and posts.length > 0
2
+ %h2 Recent Posts
3
+ %ul
4
+ - posts.each do |post|
5
+ %li
6
+ %span.date= post[:created_at].strftime('%Y-%m-%d')
7
+ %a.title{:href => "#{options[:url]}/#{post[:filename][:generated]}", :title => post[:title]}= post[:title]
4
8
  %li
5
- %span.date= post[:created_at].strftime('%Y-%m-%d')
6
- %a.title{:href => "#{options[:url]}/#{post[:filename][:generated]}", :title => post[:title]}= post[:title]
7
- %li
8
- %a{:href => "#{options[:url]}/posts/all.html", :title => "All posts"} more
9
+ %a{:href => "#{options[:url]}/posts/all.html", :title => "All posts"} more
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 0
9
- version: 0.5.0
8
+ - 1
9
+ version: 0.5.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Owen Griffin
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-03-24 00:00:00 +00:00
17
+ date: 2010-03-26 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency