octopress 3.0.10 → 3.0.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 04ef50919f33ca1251c84f8ac6312a153cc0e15d
4
- data.tar.gz: 26afaead4b8f062d3d1dc7f9db9382a110840a45
3
+ metadata.gz: 6e6b29a3b51423e35fba71f3d0d4fe5778585265
4
+ data.tar.gz: 7247be37b187c33ce20e4d9591c334c0a1b9b72b
5
5
  SHA512:
6
- metadata.gz: 7bf544c5b8190e857828290c7c2293f20e09ed68f915915f2c6bf46813fc4e354cef48a08f9a099448d69ba782d8fe8b89877140af23e9c8a59b14cd7cfd33e6
7
- data.tar.gz: 6fe594627c736bec1b48ae1eac4a887c1bdb587abab11c0f52cb07045f943d6fbb037a606f5895d5869099c099be653e0001e37fc785da243d022272b08cbfd0
6
+ metadata.gz: 28d7371b758f4d894575fb3cc87acc3680843830579cc361c790ab8be85eeb545e9cbda60fb38426f8952caca5914bc36c137abab20c04dc0563b135f7f618e6
7
+ data.tar.gz: 2c391db9477a119d06718345d8ed23fedb55179dc832e8c2a9def22d7259ce79b05fda48f2ebee685c99ea5930655667f2f7edb9d36c1a11b3f68ad02d395b4e
@@ -1,7 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ### 3.0.11 (2015-07-15)
4
+ - Fix: filenames and extensions are preserved when publishing drafts and unpublishing posts.
5
+
3
6
  ### 3.0.10 (2015-07-15)
4
- - Fixed issue where `--force` flag wouldn't work when publishing drafts
7
+ - Fix: `--force` flag works properly when publishing drafts and unpublishing posts.
5
8
 
6
9
  ### 3.0.9 (2015-06-18)
7
10
  - Documentation improvements
@@ -21,7 +21,11 @@ module Octopress
21
21
  end
22
22
 
23
23
  def path
24
- name = "#{title_slug}.#{extension}"
24
+ name = if @options['path']
25
+ "#{path_slug(@options['path'])}.#{File.extname(@options['path']).sub(/^\./, '')}"
26
+ else
27
+ "#{title_slug}.#{extension}"
28
+ end
25
29
  File.join(site.source, '_drafts', name)
26
30
  end
27
31
 
@@ -35,14 +39,15 @@ module Octopress
35
39
  @options['title'] = read_post_yaml('title')
36
40
 
37
41
  post_options = {
38
- 'title' => @options['title'],
39
- 'date' => @options['date'],
40
- 'slug' => title_slug,
41
- 'force' => @options['force'],
42
- 'content' => read_post_content,
43
- 'dir' => @options['dir'],
44
- 'type' => "post from draft",
45
- 'write_message' => "Published: #{relative_path(path)} →"
42
+ 'title' => @options['title'],
43
+ 'date' => @options['date'],
44
+ 'slug' => path_slug(@options['path']),
45
+ 'extension' => File.extname(@options['path']).sub(/^\./, ''),
46
+ 'content' => read_post_content,
47
+ 'dir' => @options['dir'],
48
+ 'type' => "post from draft",
49
+ 'write_message' => "Published: #{relative_path(path)} →",
50
+ 'force' => @options['force']
46
51
  }
47
52
 
48
53
  # Create a new post file
@@ -200,6 +200,12 @@ module Octopress
200
200
  def date_slug
201
201
  @options['date'].split('T')[0]
202
202
  end
203
+
204
+ # Returns a slug extracted from a path
205
+ #
206
+ def path_slug(path)
207
+ File.basename(path, '.*').scan(/((\d+-){3})?(\S+)/).flatten[2]
208
+ end
203
209
 
204
210
  # Returns a string which is url compatible.
205
211
  #
@@ -18,6 +18,12 @@ module Octopress
18
18
  end
19
19
 
20
20
  def path
21
+ name = if @options['path']
22
+ "#{date_slug}-#{path_slug(@options['path'])}.#{File.extname(@options['path']).sub(/^\./, '')}"
23
+ else
24
+ "#{date_slug}-#{title_slug}.#{extension}"
25
+ end
26
+ File.join(site.source, '_drafts', name)
21
27
  name = "#{date_slug}-#{title_slug}.#{extension}"
22
28
  dir = File.join(site.source, '_posts', @options['dir'])
23
29
  FileUtils.mkdir_p dir
@@ -33,17 +39,18 @@ module Octopress
33
39
  @options['title'] = read_post_yaml('title')
34
40
 
35
41
  post_options = {
36
- 'title' => @options['title'],
37
- 'date' => @options['date'],
38
- 'slug' => title_slug,
39
- 'force' => @options['force'],
40
- 'content' => read_post_content,
41
- 'dir' => @options['dir'],
42
- 'type' => "draft from post",
43
- 'write_message' => "Unpublished: #{relative_path(path)} →"
42
+ 'title' => @options['title'],
43
+ 'date' => @options['date'],
44
+ 'slug' => path_slug(@options['path']),
45
+ 'extension' => File.extname(@options['path']).sub(/^\./, ''),
46
+ 'content' => read_post_content,
47
+ 'dir' => @options['dir'],
48
+ 'type' => "draft from post",
49
+ 'write_message' => "Unpublished: #{relative_path(path)} →",
50
+ 'force' => @options['force']
44
51
  }
45
52
 
46
- Draft.new(site, post_options).write
53
+ Draft.new(site, post_options).write
47
54
 
48
55
  # Remove the old post file
49
56
  #
@@ -1,3 +1,3 @@
1
1
  module Octopress
2
- VERSION = "3.0.10"
2
+ VERSION = "3.0.11"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: octopress
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.10
4
+ version: 3.0.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Mathis