nanoc3 3.0.7 → 3.0.8

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 CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2007-2009 Denis Defreyne and contributors
1
+ Copyright (c) 2007-2010 Denis Defreyne and contributors
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
data/NEWS.rdoc CHANGED
@@ -1,5 +1,12 @@
1
1
  = nanoc News
2
2
 
3
+ == 3.0.8
4
+
5
+ * #atom_tag_for now works with base_urls that contain a path [Eric Sunshine]
6
+ * Generated root URLs in #atom_feed now end with a slash [Eric Sunshine]
7
+ * Autocompiler now recognises requests to index files
8
+ * Blogging helper now allows created_at to be a Time instance
9
+
3
10
  == 3.0.7
4
11
 
5
12
  * Fixed bug which could cause layout rules not be matched in order
data/README.rdoc CHANGED
@@ -69,9 +69,11 @@ You may need to manually install the rdoc gem and update the rubygems installati
69
69
 
70
70
  * Colin Barrett
71
71
  * Dmitry Bilunov
72
+ * Brian Candler
72
73
  * Christian Plessl
73
74
  * Šime Ramov
74
75
  * "Soryu"
76
+ * Eric Sunshine
75
77
  * Dennis Sutch
76
78
 
77
79
  Special thanks to Ale Muñoz.
@@ -200,7 +200,7 @@ module Nanoc3::CLI
200
200
  def handle_option(option)
201
201
  case option
202
202
  when :version
203
- puts "nanoc #{Nanoc3::VERSION} (c) 2007-2009 Denis Defreyne."
203
+ puts "nanoc #{Nanoc3::VERSION} (c) 2007-2010 Denis Defreyne."
204
204
  puts "Ruby #{RUBY_VERSION} (#{RUBY_RELEASE_DATE}) running on #{RUBY_PLATFORM}"
205
205
  exit 0
206
206
  when :verbose
@@ -29,7 +29,10 @@ module Nanoc3::Extra
29
29
  # Find rep
30
30
  path = Rack::Utils::unescape(env['PATH_INFO'])
31
31
  reps = site.items.map { |i| i.reps }.flatten
32
- rep = reps.find { |r| r.path == path }
32
+ rep = reps.find do |r|
33
+ r.path == path ||
34
+ r.raw_path == site.config[:output_dir] + path
35
+ end
33
36
 
34
37
  if rep
35
38
  serve(rep)
@@ -32,7 +32,10 @@ module Nanoc3::Helpers
32
32
  # articles appear first).
33
33
  def sorted_articles
34
34
  require 'time'
35
- articles.sort_by { |a| Time.parse(a[:created_at]) }.reverse
35
+ articles.sort_by do |a|
36
+ time = a[:created_at]
37
+ time.is_a?(String) ? Time.parse(time) : time
38
+ end.reverse
36
39
  end
37
40
 
38
41
  # Returns a string representing the atom feed containing recent articles,
@@ -142,7 +145,10 @@ module Nanoc3::Helpers
142
145
  end
143
146
 
144
147
  # Get sorted relevant articles
145
- sorted_relevant_articles = relevant_articles.sort_by { |a| Time.parse(a[:created_at]) }.reverse.first(limit)
148
+ sorted_relevant_articles = relevant_articles.sort_by do |a|
149
+ time = a[:created_at]
150
+ time.is_a?(String) ? Time.parse(time) : time
151
+ end.reverse.first(limit)
146
152
 
147
153
  # Get most recent article
148
154
  last_article = sorted_relevant_articles.first
@@ -154,15 +160,18 @@ module Nanoc3::Helpers
154
160
  # Build feed
155
161
  xml.instruct!
156
162
  xml.feed(:xmlns => 'http://www.w3.org/2005/Atom') do
163
+ root_url = @site.config[:base_url] + '/'
164
+
157
165
  # Add primary attributes
158
- xml.id @site.config[:base_url] + '/'
166
+ xml.id root_url
159
167
  xml.title @item[:title]
160
168
 
161
169
  # Add date
162
- xml.updated Time.parse(last_article[:created_at]).to_iso8601_time
170
+ time = last_article[:created_at]
171
+ xml.updated (time.is_a?(String) ? Time.parse(time) : time).to_iso8601_time
163
172
 
164
173
  # Add links
165
- xml.link(:rel => 'alternate', :href => @site.config[:base_url])
174
+ xml.link(:rel => 'alternate', :href => root_url)
166
175
  xml.link(:rel => 'self', :href => feed_url)
167
176
 
168
177
  # Add author information
@@ -183,7 +192,8 @@ module Nanoc3::Helpers
183
192
  xml.title a[:title], :type => 'html'
184
193
 
185
194
  # Add dates
186
- xml.published Time.parse(a[:created_at]).to_iso8601_time
195
+ time = a[:created_at]
196
+ xml.published (time.is_a?(String) ? Time.parse(time) : time).to_iso8601_time
187
197
  xml.updated a.mtime.to_iso8601_time
188
198
 
189
199
  # Add link
@@ -234,10 +244,12 @@ module Nanoc3::Helpers
234
244
  def atom_tag_for(item)
235
245
  require 'time'
236
246
 
237
- hostname = @site.config[:base_url].sub(/.*:\/\/(.+?)\/?$/, '\1')
238
- formatted_date = Time.parse(item[:created_at]).to_iso8601_date
247
+ hostname, base_dir = %r{^.+?://([^/]+)(.*)$}.match(@site.config[:base_url])[1..2]
248
+
249
+ time = item[:created_at]
250
+ formatted_date = (time.is_a?(String) ? Time.parse(time) : time).to_iso8601_date
239
251
 
240
- 'tag:' + hostname + ',' + formatted_date + ':' + (item.reps[0].path || item.identifier)
252
+ 'tag:' + hostname + ',' + formatted_date + ':' + base_dir + (item.reps[0].path || item.identifier)
241
253
  end
242
254
 
243
255
  end
data/lib/nanoc3.rb CHANGED
@@ -3,7 +3,7 @@
3
3
  module Nanoc3
4
4
 
5
5
  # The current nanoc version.
6
- VERSION = '3.0.7'
6
+ VERSION = '3.0.8'
7
7
 
8
8
  end
9
9
 
data/vendor/cri/LICENSE CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2009 Denis Defreyne and contributors
1
+ Copyright (c) 2009‒2010 Denis Defreyne and contributors
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nanoc3
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.7
4
+ version: 3.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Denis Defreyne
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2010-01-30 00:00:00 +01:00
12
+ date: 2010-02-24 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies: []
15
15